-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24918] CDC: Enable tablet split for logical replication
Summary: There exists a bug in the hidden tablet deletion logic because of which we might end up not deleting the hidden parent tablets when logical replication is in use. To prevent getting into this state, automatic tablet splitting had been disabled when logical replication is in use. This diff fixes the bug and re-enables automatic tablet splitting along with logical replication. Currently, a stream gives approval for the deletion of a hidden tablet if one of the below three conditions are satisfied: # Both its children are polled. # The state table entry for the hidden table is already deleted. # The hidden tablet is unpolled. This is inferred from the state table entry's checkpoint and with consistent snapshot streams this criteria is never satisfied However for the tablets of an unpolled table none of these conditions are satisfied. In this diff we calculate the min restart time (given by the `record_id_commit_time` field of the slot entry) across all the slots over the hidden tablet. We also store the tablet split time (which is given by the hide time of the parent tablet) along with parent-children mapping in the `retained_by_cdcsdk_` map in master. In addition to above mentioned conditions, we now allow for the hidden tablet deletion if: # The tablet split time of a hidden tablet is less than the min restart time across all the slots, as it implies that no slot will ever stream a record with commit time <= split time of this hidden tablet. # The cdc_state entry for hidden parent tablet has expired or become not of interest. In this case the retention barriers will be lifted and such a tablet will become unusable from CDC POV. In both these cases we remove the state table entry for the hidden parent tablet. In addition to this, in case of logical replication, at the time of tablet split, we add children tablet entries to the cdc_state table with their parent's checkpoint. This is required because a user can perform an alter publication anytime adding a previously unpolled table with split tablets. Since the split parent's state table entry will be removed, we need to inherit the parent's checkpoint into children entries at the time of split. **Note:** All the changes are applicable to logical replication model of CDC only. Also post this commit, we will have to set the flag `cdc_intent_retention_ms` and `cdcsdk_tablet_not_of_interest_timeout_secs ` on both master and tserver. Jira: DB-14049 Test Plan: ./yb_build.sh --cxx-test integration-tests_cdcsdk_consumption_consistent_changes-test --gtest_filter CDCSDKConsumptionConsistentChangesTest.TestHiddenTabletDeletionWithUnusedSlot ./yb_build.sh --cxx-test integration-tests_cdcsdk_consumption_consistent_changes-test --gtest_filter CDCSDKConsumptionConsistentChangesTest.TestHiddenTabletDeletionOfUnpolledTable ./yb_build.sh --cxx-test integration-tests_cdcsdk_consumption_consistent_changes-test --gtest_filter CDCSDKConsumptionConsistentChangesTest.TestDynamicTablesAdditionAfterHiddenTabletDeletion Reviewers: skumar, siddharth.shah, xCluster, hsunder Reviewed By: siddharth.shah Subscribers: ybase, ycdcxcluster Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D41406
- Loading branch information
1 parent
2575f61
commit 6448b6d
Showing
6 changed files
with
409 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.