Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Lakshya Taragi <lakshya.taragi@gmail.com>
  • Loading branch information
ltaragi committed Apr 22, 2024
1 parent 3dea5ff commit 3a25b08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ private void unassignPrimaryAndPromoteActiveReplicaIfExists(
) {
assert failedShard.primary();
ShardRouting activeReplica = null;
if (isMigratingToRemoteStore(metadata.settings())) {
if (isMigratingToRemoteStore(metadata)) {
// we might not find any replica on remote node
activeReplica = activeReplicaOnRemoteNode(failedShard.shardId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.opensearch.cluster.metadata.Metadata;
import org.opensearch.cluster.metadata.RepositoriesMetadata;
import org.opensearch.cluster.metadata.RepositoryMetadata;
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.repositories.RepositoriesService;
import org.opensearch.repositories.Repository;
Expand Down Expand Up @@ -241,14 +241,14 @@ public static boolean isMigratingToRemoteStore(ClusterSettings clusterSettings)
}

/**
* To check if the cluster is undergoing remote store migration using metadata settings
* To check if the cluster is undergoing remote store migration using clusterState metadata
* @return
* <code>true</code> For <code>REMOTE_STORE</code> migration direction and <code>MIXED</code> compatibility mode,
* <code>false</code> otherwise
*/
public static boolean isMigratingToRemoteStore(Settings settings) {
boolean isMixedMode = REMOTE_STORE_COMPATIBILITY_MODE_SETTING.get(settings).equals(CompatibilityMode.MIXED);
boolean isRemoteStoreMigrationDirection = MIGRATION_DIRECTION_SETTING.get(settings).equals(Direction.REMOTE_STORE);
public static boolean isMigratingToRemoteStore(Metadata metadata) {
boolean isMixedMode = REMOTE_STORE_COMPATIBILITY_MODE_SETTING.get(metadata.settings()).equals(CompatibilityMode.MIXED);
boolean isRemoteStoreMigrationDirection = MIGRATION_DIRECTION_SETTING.get(metadata.settings()).equals(Direction.REMOTE_STORE);

return (isMixedMode && isRemoteStoreMigrationDirection);
}
Expand Down

0 comments on commit 3a25b08

Please sign in to comment.