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.