Skip to content

Commit

Permalink
relaxing the join validation for nodes which have only store disabled…
Browse files Browse the repository at this point in the history
… but only publication enabled
  • Loading branch information
rajiv-kv committed Aug 28, 2024
1 parent dac6460 commit 366e344
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,21 @@ private static void ensureRemoteStoreNodesCompatibility(DiscoveryNode joiningNod
}

if (STRICT.equals(remoteStoreCompatibilityMode)) {
Optional<DiscoveryNode> existingRemoteIndexStoreNodes = existingNodes.stream()
.filter(node -> node.isRemoteIndexStoreEnabled())
.findFirst();
if (existingRemoteIndexStoreNodes.isEmpty()) {
// cluster-manager validates and enables publication only when all the nodes have remote publication enabled.

Optional<DiscoveryNode> existingRemotePublicationNodes = existingNodes.stream()
.filter(node -> node.isRemoteStatePublicationEnabled())
.findFirst();
// validating the attributes only if it is set both in cluster and on the joining node.
if (existingRemotePublicationNodes.isEmpty() || !joiningNode.isRemoteStatePublicationEnabled()) {
return;
}
}

DiscoveryNode existingNode = remoteRoutingTableNode.orElseGet(() -> existingNodes.get(0));
if (joiningNode.isRemoteStoreNode()) {
ensureRemoteStoreNodesCompatibility(joiningNode, existingNode, reposToSkip);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY;
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_NODE_ATTRIBUTE_KEY_PREFIX;
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_ROUTING_TABLE_REPOSITORY_NAME_ATTRIBUTE_KEY;
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY;
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY;

/**
* A discovery node represents a node that is part of the cluster.
Expand Down Expand Up @@ -476,6 +478,16 @@ public boolean isRemoteStoreNode() {
return this.getAttributes().keySet().stream().anyMatch(key -> key.startsWith(REMOTE_STORE_NODE_ATTRIBUTE_KEY_PREFIX));
}

public boolean isRemoteIndexStoreEnabled() {
return this.getAttributes()
.keySet()
.stream()
.anyMatch(
key -> (key.equals(REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY)
|| key.equals(REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY))
);
}

/**
* Returns whether remote cluster state publication is enabled on this node
* @return true if the node contains remote cluster state node attribute and remote routing table node attribute
Expand Down

0 comments on commit 366e344

Please sign in to comment.