Skip to content

Commit

Permalink
Reverting temporary changes to enforce document replication on lock i…
Browse files Browse the repository at this point in the history
…ndex now that SegRep supports retrieval by document ID

Signed-off-by: Joshua Palis <[email protected]>
  • Loading branch information
joshpalis committed Aug 22, 2023
1 parent 6abaa3c commit 06b0f37
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.opensearch.action.update.UpdateRequest;
import org.opensearch.client.Client;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.LoggingDeprecationHandler;
import org.opensearch.core.xcontent.NamedXContentRegistry;
import org.opensearch.core.xcontent.ToXContent;
Expand All @@ -43,9 +42,6 @@
import java.nio.charset.StandardCharsets;
import java.time.Instant;

import static org.opensearch.indices.replication.common.ReplicationType.DOCUMENT;
import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_REPLICATION_TYPE;

public final class LockService {
private static final Logger logger = LogManager.getLogger(LockService.class);
private static final String LOCK_INDEX_NAME = ".opendistro-job-scheduler-lock";
Expand Down Expand Up @@ -84,10 +80,7 @@ void createLockIndex(ActionListener<Boolean> listener) {
if (lockIndexExist()) {
listener.onResponse(true);
} else {
// Temporarily force DOCUMENT replication until SEGMENT supports GET by id
// https://github.com/opensearch-project/OpenSearch/issues/8536
Settings replicationSettings = Settings.builder().put(SETTING_REPLICATION_TYPE, DOCUMENT.name()).build();
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME, replicationSettings).mapping(lockMapping());
final CreateIndexRequest request = new CreateIndexRequest(LOCK_INDEX_NAME).mapping(lockMapping());
client.admin()
.indices()
.create(request, ActionListener.wrap(response -> listener.onResponse(response.isAcknowledged()), exception -> {
Expand Down

0 comments on commit 06b0f37

Please sign in to comment.