Skip to content
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] [Remote State] Cluster chaining can break if there is consecutive node replace and restart #10841

Closed
linuxpi opened this issue Oct 23, 2023 · 0 comments · Fixed by #10832
Assignees
Labels
bug Something isn't working Cluster Manager Storage:Remote Storage Issues and PRs relating to data and metadata storage v2.12.0 Issues and PRs related to version 2.12.0

Comments

@linuxpi
Copy link
Collaborator

linuxpi commented Oct 23, 2023

Describe the bug
Cluster chaining can break if there is consecutive node replace and restart

To Reproduce
Step for single node cluster

  1. Bootstrap single node

  2. No local disk state found

  3. No remote disk state found

  4. Cluster Manager Election success

  5. First cluster uuid formed - uuid_1

  6. First pre-publish - write Metadata to remote

  7. First publish - write Metadata to disk with clusterUUID uuid_1 and clusterUUIDCommitted as false

  8. First pre-commit - write Metadata to remote with clusterUUID uuid_1 and clusterUUIDCommitted as true
    first commit - write Metadata to local disk with clusterUUID commmitted true

  9. Terminate the node and replace with a new one so that all local disk state is lost

  10. Bootstrap new replacement node

  11. No local disk state found, hence no cluster uuid.

  12. Go to remote for latest state.

  13. Found Metadata in remote with clusterUUID uuid_1 and clusterUUIDCommitted as true

  14. Construct ClusterState from remote Metadata with clusterUUID ClusterState.UNKNOWN_UUID and clusterUUIDCommitted as false.

  15. Write new ClusterState to disk with clusterUUID ClusterState.UNKNOWN_UUID and clusterUUIDCommitted as false.

  16. Cluster Manager Election success

  17. New cluster uuid formed - uuid_2

  18. Pre publish - write to remote with clusterUUID uuid_2 and clusterUUIDCommitted as false.

  19. Publish - write to local disk with clusterUUID uuid_2 and clusterUUIDCommitted as false.

  20. Kill process on the node.

  21. Process restarts and local disk state is found with clusterUUID uuid_2 and clusterUUIDCommitted as false.

  22. Don't go to remote as clusterUUID is not ClusterState.UNKNOWN_UUID .

  23. lastKnownClusterUUID remains ClusterState.UNKNOWN_UUID and RemotePersistedState is initialized with previousClusterUUID as ClusterState.UNKNOWN_UUID .

  24. First pre-commit after this will write state to remote by calling RemotePersistedState.setLastAcceptedState . This will write new ClusterState to remote with previousClusterUUID as ClusterState.UNKNOWN_UUID

if (DiscoveryNode.isClusterManagerNode(settings) && isRemoteStoreClusterStateEnabled(settings)) {
// If the cluster UUID loaded from local is unknown (_na_) then fetch the best state from remote
// If there is no valid state on remote, continue with initial empty state
// If there is a valid state, then restore index metadata using this state
String lastKnownClusterUUID = ClusterState.UNKNOWN_UUID;
if (ClusterState.UNKNOWN_UUID.equals(clusterState.metadata().clusterUUID())) {
lastKnownClusterUUID = remoteClusterStateService.getLastKnownUUIDFromRemote(
clusterState.getClusterName().value()
);
if (ClusterState.UNKNOWN_UUID.equals(lastKnownClusterUUID) == false) {
// Load state from remote
final RemoteRestoreResult remoteRestoreResult = remoteStoreRestoreService.restore(
// Remote Metadata should always override local disk Metadata
// if local disk Metadata's cluster uuid is UNKNOWN_UUID
ClusterState.builder(clusterState).metadata(Metadata.EMPTY_METADATA).build(),
lastKnownClusterUUID,
false,
new String[] {}
);
clusterState = remoteRestoreResult.getClusterState();
}
}
remotePersistedState = new RemotePersistedState(remoteClusterStateService, lastKnownClusterUUID);
}

Expected behavior
previousClusterUUID chaining should not break in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Cluster Manager Storage:Remote Storage Issues and PRs relating to data and metadata storage v2.12.0 Issues and PRs related to version 2.12.0
Projects
None yet
1 participant