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

Integrate remote cluster state in publish flow #3

Open
wants to merge 5 commits into
base: remote_state
Choose a base branch
from

Conversation

soosinha
Copy link
Owner

@soosinha soosinha commented Aug 22, 2023

Description

Follow up PR for : opensearch-project#9160
In the above PR, RemotePersistedState and RemoteClusterStateService were created. In the current PR, these classes are integrated into the cluster state publish flow. The upload of cluster metadata will happen just before the cluster state publish request is sent to all nodes

Related Issues

opensearch-project#9338

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@soosinha soosinha force-pushed the remote_state_publish branch 3 times, most recently from 38eebe4 to 0345ea5 Compare August 23, 2023 03:46
@soosinha soosinha force-pushed the remote_state_publish branch from 0345ea5 to e06aeaf Compare August 23, 2023 04:56
@@ -1308,6 +1312,12 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
leaderChecker.setCurrentNodes(publishNodes);
followersChecker.setCurrentNodes(publishNodes);
lagDetector.setTrackedNodes(publishNodes);
if (clusterState.nodes().isLocalNodeElectedClusterManager()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add a comment here why you are doing it here. This add extra latency to overall publish flow. How will this change with remote only state.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add comment.

Comment on lines 1773 to 1779
final Optional<ApplyCommitRequest> optionalApplyCommitRequest = coordinationState.get()
.handlePublishResponse(sourceNode, publishResponse);
optionalApplyCommitRequest.ifPresent(applyCommitRequest -> {
if (REMOTE_CLUSTER_STATE_ENABLED_SETTING.get(settings) == true) {
final CoordinationState.PersistedState remotePersistedState = remotePersistedStateSupplier.get();
assert remotePersistedState != null : "Remote state has not been initialized";
remotePersistedState.markLastAcceptedStateAsCommitted();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be triggered when commit is being performed on the active cluster manager node. why do you need special handling here? Are you doing this to ensure it is always committed to remote first.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Even while publishing I am storing in remote first. So to keep it consistent, I am committing to remote first.

@@ -122,7 +129,8 @@ public void start(
MetaStateService metaStateService,
MetadataIndexUpgradeService metadataIndexUpgradeService,
MetadataUpgrader metadataUpgrader,
PersistedClusterStateService persistedClusterStateService
PersistedClusterStateService persistedClusterStateService,
RemoteClusterStateService remoteClusterStateService

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current integration, it will always initialize RemoteClusterStateService even when remote cluster state is not enabled.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoteClusterStateService is not a heavy object. It is contains few fields (<10). Anyway I will see if can initialize this only when remote state is enabled.

@soosinha soosinha force-pushed the remote_state_publish branch 3 times, most recently from d4e3417 to 91c616f Compare August 25, 2023 05:58
@soosinha soosinha force-pushed the remote_state branch 3 times, most recently from e8f6f86 to be36097 Compare August 25, 2023 14:29
@soosinha soosinha force-pushed the remote_state_publish branch 4 times, most recently from 1bd3276 to 6819419 Compare August 28, 2023 05:37
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants