diff --git a/server/src/main/java/org/opensearch/index/IndexService.java b/server/src/main/java/org/opensearch/index/IndexService.java index 153d78f1cafab..92f957633db84 100644 --- a/server/src/main/java/org/opensearch/index/IndexService.java +++ b/server/src/main/java/org/opensearch/index/IndexService.java @@ -549,7 +549,7 @@ public synchronized IndexShard createShard( retentionLeaseSyncer, circuitBreakerService, // TODO Replace with remote translog factory in the follow up PR - new InternalTranslogFactory(), + this.indexSettings.isRemoteTranslogStoreEnabled() ? null : new InternalTranslogFactory(), this.indexSettings.isSegRepEnabled() ? checkpointPublisher : null, remoteStore ); diff --git a/server/src/main/java/org/opensearch/index/IndexSettings.java b/server/src/main/java/org/opensearch/index/IndexSettings.java index 41235bc7fe063..7648f0a192ce7 100644 --- a/server/src/main/java/org/opensearch/index/IndexSettings.java +++ b/server/src/main/java/org/opensearch/index/IndexSettings.java @@ -1001,8 +1001,7 @@ public boolean isRemoteStoreEnabled() { * Returns if remote translog store is enabled for this index. */ public boolean isRemoteTranslogStoreEnabled() { - // return isRemoteTranslogStoreEnabled; - return isSegRepEnabled(); + return isRemoteTranslogStoreEnabled; } /** diff --git a/server/src/main/java/org/opensearch/index/shard/ReplicationGroup.java b/server/src/main/java/org/opensearch/index/shard/ReplicationGroup.java index dd04ee786d10f..43340a790fcbf 100644 --- a/server/src/main/java/org/opensearch/index/shard/ReplicationGroup.java +++ b/server/src/main/java/org/opensearch/index/shard/ReplicationGroup.java @@ -37,7 +37,6 @@ import org.opensearch.common.util.set.Sets; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Set; @@ -68,7 +67,7 @@ public ReplicationGroup( boolean remoteTranslogEnabled ) { if (!remoteTranslogEnabled) { - assert trackedAllocationIds.equals(localTranslogAllocationIds) + assert localTranslogAllocationIds.containsAll(trackedAllocationIds) : "In absence of remote translog store, all tracked shards must have local translog store"; } this.routingTable = routingTable; @@ -125,7 +124,7 @@ public ReplicationGroup( Set trackedAllocationIds, long version ) { - this(routingTable, inSyncAllocationIds, trackedAllocationIds, Collections.emptySet(), version, false); + this(routingTable, inSyncAllocationIds, trackedAllocationIds, trackedAllocationIds, version, false); } public long getVersion() {