-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Commit Failures During Node Joins with Repositories Configured Result in Persistent NullPointerExceptions #16762
Comments
To understand this issue in-depth, as part of node-joins, we run the JoinTaskExecutor task to add the nodes and update the cluster state, here if the node has remote-store configured or remote-publication configured, we update the repositories metadata by reading the node-attributes of the joining node and updating the existing metadata. Notice here, we take the metadata from the current state OpenSearch/server/src/main/java/org/opensearch/cluster/coordination/JoinTaskExecutor.java Lines 197 to 215 in ac45643
Note: The current state used here is fetched from the last accepted state from CoordinationState. The OpenSearch/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java Lines 1296 to 1307 in ac45643
Moving forward, as part of RemoteStoreNodeService::updateRepositoriesMetadata, we get the repositories metadata from the joining node and for each of the RepositoriesMetadata coming from the joining node, we check if the metadata existing in our current cluster state and if so, we call RepositoriesService::ensureValidSystemRepositoryUpdate OpenSearch/server/src/main/java/org/opensearch/node/remotestore/RemoteStoreNodeService.java Lines 170 to 194 in ac45643
As part of ensuring valid system repositories, we fetch the corresponding repository from the repository service and face NPEs when we try to perform the OpenSearch/server/src/main/java/org/opensearch/repositories/RepositoriesService.java Lines 898 to 910 in ac45643
To understand why our repositories are lagging behind, we see that there are two ways to update the repository in the repository service. Method 1: updateRepositoriesMap
OpenSearch/server/src/main/java/org/opensearch/node/remotestore/RemoteStoreNodeService.java Lines 137 to 163 in ac45643
Method 2: applyClusterState -> Called as part of ClusterApplierService::runTask which in-turn is triggered as part of the apply task submitted when ApplyCommitRequest is received on the nodes Checks if new repositories appeared in or disappeared from cluster metadata and updates current list of repositories accordingly.
OpenSearch/server/src/main/java/org/opensearch/repositories/RepositoriesService.java Line 537 in ac45643
Now since we know that the existing nodes do not have the node-attributes, we can safely assume that the only path for the existing cluster-manager node to have the state updated is through Method 2. Since we know that the cluster-state is updated in coordinatorState as part of publish path (in handlePublishRequest), this will lead to cases wherein the cluster-state is ahead of the repository service incase the cluster-manager node fails to send the commit request OpenSearch/server/src/main/java/org/opensearch/cluster/coordination/CoordinationState.java Lines 416 to 460 in ac45643
|
Thanks @Pranshu-S for filing the issue. Please feel free to raise a fix. |
Describe the bug
Issue Overview
During node joins, when a new node containing new repository metadata joins the cluster, the cluster-manager attempts to publish the updated cluster state that includes the node and its metadata. While during this update if the publish operation succeeds and the commit fails due to other issues (like network disruption or joining leader in term), it leads to a persistent cycle of
NullPointerExceptions
which prevents the cluster to become stable. This is because as part of the publish, the last accepted version and cluster state are updated but due to commits not run, the cluster-state appliers are not executed. This results in the repositories service not in sync with the repositories metadata in the cluster state. Now when the current cluster-manager (leader) steps down and another cluster-manager is elected:NullPointerException
, causing instability in the cluster-manager election and transition process.[Logs from IT used to repro the issue]
Related component
Cluster Manager
To Reproduce
Expected behavior
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: