-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[xCluster] Locality-Aware Placement for M:N tablet mapping in setup_replication #10186
Comments
Some code pointers to help out, currently we process tablet mappings in two locations:
Ideally we can use the same logic in both these cases, but tbd.. Tablet splitting already provides the start and end keys for all the producer tablets, but some work would be required if we want these keys for the setup case as well. |
@hulien22 to confirm, does this mapping also dynamically change, at runtime, based on consumer cluster changes, eg: add/remove nodes, LB moving tablets around, etc? |
The mapping won't change since its purely a tablet id : tablet id mapping. So moving tablets around won't change anything, but splitting tablets does as that is creating new tablets that need to be added/removed from the mapping |
…ablet counts in xCluster Summary: Use the tablet start and end keys to find best mapping when count of tablets between producer and consumer is different. Consumer tablet with the most key range overlap will be picked. Added start and end key to ProducerTabletListPB. This is populated at initial CDC stream create. When producer or consumer tablets split, and we have key ranges in ProducerTabletListPB then it is used to construct the new mapping. If mapping was created on older build in which case keys wont be available, we will fall back to old round robin behavior. Old code assumed same tablet count implied same key ranges. This need not be true, so has been fixed. ex: producer default 4 tablets, consumer default 3 tablets + consumer tablet split. Test Plan: Added new xcluster-tablet-split-itest XClusterTabletMapTest Added new validations in xcluster-tablet-split-itest XClusterTabletSplitITest Ensure these tests continue to work client-test ClientTest.TestKeyRangeFiltering All other xcluster-tablet-split-itest Reviewers: nicolas, jhe, rahuldesirazu Reviewed By: jhe, rahuldesirazu Subscribers: slingam, bogdan Differential Revision: https://phabricator.dev.yugabyte.com/D17050
…ith different tablet counts in xCluster Summary: Use the tablet start and end keys to find best mapping when count of tablets between producer and consumer is different. Consumer tablet with the most key range overlap will be picked. Added start and end key to ProducerTabletListPB. This is populated at initial CDC stream create. When producer or consumer tablets split, and we have key ranges in ProducerTabletListPB then it is used to construct the new mapping. If mapping was created on older build in which case keys wont be available, we will fall back to old round robin behavior. Old code assumed same tablet count implied same key ranges. This need not be true, so has been fixed. ex: producer default 4 tablets, consumer default 3 tablets + consumer tablet split. Original commit: a8f3801 / D17050 Test Plan: Added new xcluster-tablet-split-itest XClusterTabletMapTest Added new validations in xcluster-tablet-split-itest XClusterTabletSplitITest Ensure these tests continue to work client-test ClientTest.TestKeyRangeFiltering All other xcluster-tablet-split-itest Reviewers: nicolas, rahuldesirazu, jhe Reviewed By: jhe Subscribers: bogdan, slingam Differential Revision: https://phabricator.dev.yugabyte.com/D17322
Currently, setup_replication only does tablet mapping between Consumer & Producer clusters in the 1:1 use case. For the M:N use case, a naive round-robin strategy is used. It would be useful to have a best-effort mapping instead.
In addition to getting the list of tablets on the Producer side, get the start & end rowkey. Compute the max overlap in a rowkey interval with a local tablet and assign accordingly (only assign RR on failure).
-- Calculate a set of candidate tablets on the Consumer that have their [StartKey_C, EndKey_C] within the Producer’s [StartKey_P, EndKey_P] range.
-- For each candidate, determine the overlap window
-- [StartKey_O, EndKey_O] == [ max(StartKey_C, StartKey_P), min (EndKey_C, EndKey_P) ].
-- Pick the candidate with max(EndKey_O - StartKey_O)
We might be able to approximate this faster using a middle key algorithm:
Use the logical MiddleKey, instead of GetEncodedMiddleSplitKey(), for a fully in-memory operation.
This task is the first step towards adding this heuristic to the xDC + tablet splitting use case to keep reasonably good locality while allowing their split keys to diverge. See the Tablet Splitting + xDC Design Doc: https://docs.google.com/document/d/1MlhwjqSypnP8i6r7DJcm85GNIaguV51ZqiekRIyf0eU
The text was updated successfully, but these errors were encountered: