Skip to content

Commit

Permalink
Merge pull request #109 from Rishikesh1159/verify_its_with_segrep
Browse files Browse the repository at this point in the history
Add few changes to make sure SEGREP is used always.
  • Loading branch information
dreamer-89 authored Apr 12, 2023
2 parents f5a65e3 + a730091 commit 986dbc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
15 changes: 8 additions & 7 deletions server/src/main/java/org/opensearch/index/IndexSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,14 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
nodeName = Node.NODE_NAME_SETTING.get(settings);
this.indexMetadata = indexMetadata;
numberOfShards = settings.getAsInt(IndexMetadata.SETTING_NUMBER_OF_SHARDS, null);
if (FeatureFlags.isEnabled(FeatureFlags.SEGMENT_REPLICATION_EXPERIMENTAL)
&& indexMetadata.isSystem() == false
&& settings.get(IndexMetadata.SETTING_REPLICATION_TYPE) == null) {
replicationType = IndicesService.CLUSTER_REPLICATION_TYPE_SETTING.get(settings);
} else {
replicationType = IndexMetadata.INDEX_REPLICATION_TYPE_SETTING.get(settings);
}
replicationType = IndexMetadata.INDEX_REPLICATION_TYPE_SETTING.get(settings);
// if (FeatureFlags.isEnabled(FeatureFlags.SEGMENT_REPLICATION_EXPERIMENTAL)
// && indexMetadata.isSystem() == false
// && settings.get(IndexMetadata.SETTING_REPLICATION_TYPE) == null) {
// replicationType = IndicesService.CLUSTER_REPLICATION_TYPE_SETTING.get(settings);
// } else {
// replicationType = IndexMetadata.INDEX_REPLICATION_TYPE_SETTING.get(settings);
// }
isRemoteStoreEnabled = settings.getAsBoolean(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, false);
isRemoteTranslogStoreEnabled = settings.getAsBoolean(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_ENABLED, false);
remoteStoreTranslogRepository = settings.get(IndexMetadata.SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public class IndicesService extends AbstractLifecycleComponent

public static final Setting<ReplicationType> CLUSTER_REPLICATION_TYPE_SETTING = new Setting<>(
CLUSTER_SETTING_REPLICATION_TYPE,
ReplicationType.DOCUMENT.toString(),
ReplicationType.SEGMENT.toString(),
ReplicationType::parseString,
Property.NodeScope,
Property.Final
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.opensearch.index.engine.Engine;
import org.opensearch.index.engine.EngineConfig;
import org.opensearch.index.engine.EngineFactory;
import org.opensearch.index.engine.NRTReplicationEngine;

public final class MockEngineFactory implements EngineFactory {

Expand All @@ -46,6 +47,9 @@ public MockEngineFactory(Class<? extends FilterDirectoryReader> wrapper) {

@Override
public Engine newReadWriteEngine(EngineConfig config) {
if (config.isReadOnlyReplica()) {
return new NRTReplicationEngine(config);
}
return new MockInternalEngine(config, wrapper);
}
}

0 comments on commit 986dbc4

Please sign in to comment.