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

[compat][da-vinci][test] Global RT DIV improvement (part 1): RT and VT DIV se… #1179

Merged
merged 18 commits into from
Oct 4, 2024

Conversation

lluwm
Copy link
Contributor

@lluwm lluwm commented Sep 17, 2024

…paration

Problem:
Data Integrity Validator (DIV) is used for validating and discovering data issues residing in the Kafka topics when consumed. However, without a shared global view of the RealTime (RT) topics among all leaders, DIV states for RT topics are scattered among all past leaders and without a way to pass RT DIV from leader to its successors, DIV results can be inaccurate especially during the leadership transitions.

At a high level, we proposes to replicate the leader DIV states into the local VT periodically or on-demand. Followers consume these leader DIV states and sync itself up to the leader state along the way.

This PR:
As the first part of the implementation for global DIV improvement, this PR contains the following:

  1. introduce a new flag for the global rt div feature.
  2. introduce a new realtimeTopicProducerStates in PartitionState in the local rocksdb checkpoint.
avro diff: 
    {
      "name": "realtimeTopicProducerStates",
      "doc": "A map that maps upstream Kafka bootstrap server url -> to a map of producer GUID -> producer state for real-time data.",
      "type": {
        "type": "map",
        "values": {
          "type": "map",
          "values": "com.linkedin.venice.kafka.protocol.state.ProducerPartitionState"
        },
        "java-key-class": "java.lang.String",
        "avro.java.string": "String"
      },
      "default": {}
   }
  1. divide today's complete DIV into two groups: VT and RT DIV, and RT DIV is further divided by its source fabric, so that each group can be updated separately based on which topic the Kafka records come from. (without feature enabled, only VT DIV is updated).
  2. Adding test to verify the read/write of an OffsetRecord with new the new added field.

Future changes:
After this PR, as the next step, we will start to implement the following:

  1. In the leader replica, create a snapshot of the RT DIV and replicate it to the local VT by using a chunking supported heartbeat messages (DIV heartbeat).
  2. In follower replicas, consume the leader's RT DIV snapshot and sync itself up to the leader state along the way. (this actually needs to be checked in first to handle potential deployment rollbacks).
  3. The lifecycle of the in memory RT DIV states will be managed by the leader and is shown in the following figure:
Screenshot 2024-10-02 at 9 34 08 AM

How was this PR tested?

CI (with or without feature enabled)

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.

…paration

Problem
Data Integrity Validator (DIV) is used for validating and descovering data issues residing in the Kafka topics when consumed.
However, without a shared gloabal view of the RealTime (RT) topics among all leaders, DIV states for RT topics are scattered
among all past leaders and without a way to pass RT DIV from leader to its successors, DIV results can be inaccurate especially
during the leadership transitions.

At a high level, we proposes to replicate the leader DIV states into the local VT periodically or on-demand. Followers consume
these leader DIV states and sync itself up to the leader state along the way.

As the first part of the implementation for global DIV improvement, this PR contains the following:
1. introduce a new flag for the global rt div feature.
2. introduce a new realtimeTopicProducerStates in PartitionState in the local rocksdb checkpoint.
3. divide today's complete DIV into two groups: VT and RT DIV, so that each group can be updated separately based on which topic
   the Kafka records come from. (without feature enabled, only VT DIV is updated).
4. Adding test to verify the read/write of an offsetrecord with new the new added field.
@lluwm lluwm changed the title [da-vinci][test] Global RT DIV improvement (part 1): RT and VT DIV se… [compat][da-vinci][test] Global RT DIV improvement (part 1): RT and VT DIV se… Sep 18, 2024
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.

If the SIT is not ingesting the leader replica, will SIT load the RT DIV or not?
Also when the replica transitions from leader replicas to follower replica, will SIT offload RT DIV from the memory and reload it when necessary?

Maybe this is not part of the scope of this PR, and some clarification will be hepful.

@lluwm
Copy link
Contributor Author

lluwm commented Oct 1, 2024

If the SIT is not ingesting the leader replica, will SIT load the RT DIV or not? Also when the replica transitions from leader replicas to follower replica, will SIT offload RT DIV from the memory and reload it when necessary?

Maybe this is not part of the scope of this PR, and some clarification will be hepful.

Will update the description part to address this comment.

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.

Thanks!

@lluwm lluwm merged commit 5889f63 into linkedin:main Oct 4, 2024
45 checks passed
@lluwm lluwm deleted the separation_of_rt_and_vt_div branch October 4, 2024 18:23
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