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

RATIS-2102. AsyncApi#send() is not handling retry and reply correctly for replication levels higher than MAJORITY #1104

Merged
merged 2 commits into from
May 29, 2024

Conversation

smengcl
Copy link
Contributor

@smengcl smengcl commented May 25, 2024

What changes were proposed in this pull request?

Background: RATIS-1994 adds a feature allowing AsyncApi#send() to return only when a specified replication level is reached. This was done by adding waitForReplication() in RaftServer.

However, two bugs are found with RATIS-1994 when the (write) replication level is set to higher than MAJORITY (the default):

  1. When the request is retried (e.g. when timed out), the future retrieved from cache is not correctly waited on with waitForReplication() again. This causes divergence in the desired behavior depending on if the request is retried or not. This is fixed by invoking waitForReplication() in writeAsync() rather than appendTransaction().

  2. waitForReplication()'s watch request reply was incorrectly ignored, this is fixed by combining the reply from write and watch together using combineReplies().

Thanks @szetszwo for the help during debugging and making the patch.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-2102

How was this patch tested?

  • Tested manually during HDDS-10108 dev.
  • Added UT testWriteAsyncCustomReplicationLevel.

@smengcl smengcl marked this pull request as ready for review May 29, 2024 17:50
Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

@szetszwo szetszwo merged commit bd4ab14 into apache:master May 29, 2024
12 checks passed
@smengcl
Copy link
Contributor Author

smengcl commented May 29, 2024

Thanks @szetszwo for reviewing this!

SzyWilliam pushed a commit that referenced this pull request Jun 12, 2024
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request Jun 16, 2024
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