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

[dvc][common][test] leader complete status to follower part 1: leader produce HB and SOS to local VT with new header #741

Merged
merged 13 commits into from
Nov 16, 2023

Conversation

m-nagarajan
Copy link
Contributor

@m-nagarajan m-nagarajan commented Nov 6, 2023

Summary

Issue: For hybrid stores, followers are marked completed once EOP in VT is received and before leaders are marked complete and when leader handover happens to one of the completed follower instances, even though the ingestion is not completed, it will be marked completed and ready to serve.

Fix:
Part 1:
The proposal is to have a new isLeaderCompleted Kafka header which can be added to heartbeat SOS messages. The value of that header would be:0 or 1. As soon as the leader partition determines that it is complete (according to whatever rule it determines completion by, usually offset lag, but could be time lag also) the leader will then immediately send a heartbeat message containing the header: isLeaderCompleted = 1. All future heartbeats will also contain that same header.

Implementation details of part 1:

  1. Added a new PubSubMessageHeader in PubSubMessageHeaders to hold this info in HB messages sent from leader to VT. This information won't be produced to RT.
  2. PubSubMessageHeaders will be added as a part of PubSubMessage during deserialization of the consumed records to be later used by the followers in part 2.
  3. using PartitionConsumptionState#isCompletionReported() to determine whether leader is marked completed or not and piggybacking on reportCompleted() to initiate heartbeat message immediately once leader is marked completed.

Part 2 (TBD):
This includes followers reading the header added in part 1 and using that as an additional factor to decide whether it should be completed or not.

How was this PR tested?

Tested whether the new header is being received by consuming the version topic in an integration test

Does this PR introduce any user-facing changes?

  • No. You can skip the rest of this section.
  • Yes. Make sure to explain your proposed changes and call out the behavior change.

Copy link
Contributor Author

@m-nagarajan m-nagarajan left a comment

Choose a reason for hiding this comment

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

Thanks @sushantmane for the review. Addressed review comments.

@m-nagarajan m-nagarajan marked this pull request as ready for review November 7, 2023 19:25
@m-nagarajan m-nagarajan changed the title [WIP][dvc][common][test] leader complete status to follower part 1: leader produce HB and SOS to local VT with new header [dvc][common][test] leader complete status to follower part 1: leader produce HB and SOS to local VT with new header Nov 7, 2023
Copy link
Contributor

@sushantmane sushantmane left a comment

Choose a reason for hiding this comment

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

I've left two comments. I think it would be good to have this PR reviewed by @FelixGV as well. Thanks!

Copy link
Contributor

@FelixGV FelixGV left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM overall. Left a few minor comments.

Copy link
Contributor Author

@m-nagarajan m-nagarajan left a comment

Choose a reason for hiding this comment

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

Thanks @gaojieliu and @FelixGV for the review. Addressed review comments. Please take another look at it.

Copy link
Contributor

@FelixGV FelixGV left a comment

Choose a reason for hiding this comment

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

Looks good overall. Just a minor nitpick...

Copy link
Contributor

@gaojieliu gaojieliu left a comment

Choose a reason for hiding this comment

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

Please update the commit message to describe the updated behavior that the leader complete header will only be sent in HB SOS message.

Also, I didn't see any test cases for the new logic, so is it expected? or you want to keep all the test cases in the second PR?

FelixGV
FelixGV previously approved these changes Nov 16, 2023
Copy link
Contributor

@FelixGV FelixGV left a comment

Choose a reason for hiding this comment

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

LGTM, but please check Gaojie's latest comments as well in case there is something to address there.

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.

5 participants