You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BACKPORT 2024.1][yugabyte#19294] CDCSDK: Refactor reading of WAL messages for consistent CDC
Summary:
####Backport Description
Minor merge conflict was encountered in cdcsdk_test_base.h at the declaration of test flag.
####Original Description
In a workload with single shard transactions, it was observed that WAL contained operations that were replicated but not committed. In such a scenario an empty batch is returned by `ReadReplicatedMessagesForCDC` if the from_op_id is same as the commited_op_id. CDCSDK producer ends up updating the safe time. Hence in the next GetChanges call, the previously uncommitted messages get filtered out. This can lead to data loss in CDC operations.
This diff introduces a new method `ReadReplicatedMessagesForConsistentCDC` which takes consistent_stream_safe_time as a parameter and reads the WAL until the committed_op_id or till we encounter a message with hybrid time greater than consistent_stream_safe_time. This method checks whether committed_op_id and majority_replicated_op_id are same. If they differ, it waits in a loop until both become equal. However in the case where we reach close to the deadline and the mismatch between committed_op_id and majority_replicated_op_id still exists, in order to prevent GetChanges rpc timeout `ReadReplicatedMessagesForConsistentCDC` will return an empty batch of messages with an indication about the mismatch. In such a scenario cdcsdk producer will not update its safe time. The GetChanges response will have the same safe_hybrid_time as the request in this case.
Jira: DB-8105
Original commit: a0264d7 / D30420
Test Plan:
Existing CDC tests and QA tests
./yb_build.sh --cxx-test integration-tests_cdcsdk_ysql-test --gtest_filter CDCSDKYsqlTest.TestWithMajorityReplicatedButNonCommittedSingleShardTxn
Reviewers: vkushwaha, skumar, sergei, asrinivasan, stiwary, siddharth.shah
Reviewed By: siddharth.shah
Subscribers: ycdcxcluster, ybase, bogdan, sergei
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D37733
0 commit comments