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 (#472) (#473)

Signed-off-by: Joshua Palis <[email protected]>
(cherry picked from commit 7021e39)

Co-authored-by: Joshua Palis <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and joshpalis authored Aug 22, 2023
1 parent f510461 commit 77bd862
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 77bd862

Please sign in to comment.