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

changefeedccl: add changefeed range distribution strategies #115166

Merged
merged 2 commits into from
Dec 19, 2023

Commits on Dec 13, 2023

  1. changefeedccl: add changefeed range distribution strategies

    This commit introduces several changes.
    
    It makes `replicaoracle.BinPackingChoice` the explicit default for changefeeds.
    Previously, we would use `physicalplan.DefaultReplicaChooser`, which would point
    to the bin packing oracle. This change is better since it gives the changefeed package more control over its dependencies.
    
    A new cluster setting `changefeed.default_range_distribution_strategy` is added to
     specify how changefeeds should distribute work. In the default case,
    `none`, we defer to distsql to select nodes and distribute work among them. This
    is the same behavior as running a changefeed today.
    
    In the other case, `balanced_simple`, we still let distsql choose nodes for us, but we attempt
    to evently distribute ranges over them. This case is exactly the same as setting
    `changefeed.balance_range_distribution.enable = true`, but it is allowed to be used
    outside of initial scans (`changefeed.balance_range_distribution.enable` was only allowed
    with `initial_scan=only`.
    
    This change also deprecates `changefeed.balance_range_distribution.enable` in favor of
    `changefeed.default_range_distribution_strategy` because the latter can be expanded
    in the future to add more functionality.
    
    This change also moves changefeed distribution tests to a dedicated file:
    `changefeed_dist_test.go`. This file contains a tester which can be used to
    start a cluster with a given topology and range distribution. Changefeed tests
    can use the tester to perform various load balancing strategies. Right now, the new
    tests assert how ranges are distributed after planning changefeeds, which implicitly tests
    code outside of the changefeedccl package (ie. `dsp.PartitionSpans()`). However,
    this is important since changefeeds rely on the behavior of this black box to perform well.
    In the future, cdc will implement more distribution strategies and likely implement its
    own partitioning logic. Tests for these strategies can be added in this file. Over time,
    cdc can move away from distsql planning.
    
    Informs: cockroachdb#113898
    Epic: None
    
    Release note (enterprise change): `changefeed.balance_range_distribution.enable` is now deprecated.
    Users should use a new cluster setting `changefeed.default_range_distribution_strategy`
    instead. `changefeed.default_range_distribution_strategy='balanced_simple'` has the same
    effect as setting `changefeed.balance_range_distribution.enable=true`. It does not require
    `initial_scan='only'`, which was required by the old setting.
    jayshrivastava committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    d092bd4 View commit details
    Browse the repository at this point in the history
  2. roachtest/cdc: metamorphically determine range distribution strategy

    This change adds a new metamorphic flag in cdc roachtests which choses
    a distribution strategy randomly.
    
    Release note: None
    jayshrivastava committed Dec 13, 2023
    Configuration menu
    Copy the full SHA
    0b1f895 View commit details
    Browse the repository at this point in the history