Skip to content

Commit

Permalink
[#20305] xCluster: Rename cdc_consumer_handler_thread_pool_size to xc…
Browse files Browse the repository at this point in the history
…luster_consumer_thread_pool_size

Summary:
Deprecate `cdc_consumer_handler_thread_pool_size` and replaced with `xcluster_consumer_thread_pool_size`.
The old name does not clearly indicate that this is used by xCluster and not cdc. Also before 2.20 the user had to set this flag to a high number when more than a dozen tablets were under replication. The scheduling fixes introduced in 2.20 (10508a7/D27433 ) eliminates the need for this change.
Renaming the flag will help users who have set the old flag to a high number by reducing CPU and memory usage from the large number of unused threads.

Fixes #20305
Jira: DB-9271

Test Plan: Jenkins

Reviewers: jhe, slingam, xCluster

Reviewed By: jhe

Subscribers: ybase

Differential Revision: https://phorge.dev.yugabyte.com/D34921
  • Loading branch information
hari90 committed May 10, 2024
1 parent b6d1f1e commit e6b5f35
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/yb/tserver/xcluster_consumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ METRIC_DEFINE_counter(server, xcluster_consumer_poll_failure_count,
"Number of poll failures encountered by XClusterConsumer. Poll failures are "
"errors applying changes to the target cluster.");

DEFINE_NON_RUNTIME_int32(cdc_consumer_handler_thread_pool_size, 0,
DEPRECATE_FLAG(int32, cdc_consumer_handler_thread_pool_size, "05_2024");

DEFINE_NON_RUNTIME_int32(xcluster_consumer_thread_pool_size, 0,
"Override the max thread pool size for XClusterConsumerHandler, which is used by "
"XClusterPoller. If set to 0, then the thread pool will use the default size (number of "
"cpus on the system).");
TAG_FLAG(cdc_consumer_handler_thread_pool_size, advanced);
TAG_FLAG(xcluster_consumer_thread_pool_size, advanced);

DEFINE_RUNTIME_int32(xcluster_safe_time_update_interval_secs, 1,
"The interval at which xcluster safe time is computed. This controls the staleness of the data "
Expand Down Expand Up @@ -220,8 +222,8 @@ Status XClusterConsumer::Init() {
RETURN_NOT_OK(yb::Thread::Create(
"XClusterConsumer", "Poll", &XClusterConsumer::RunThread, this, &run_trigger_poll_thread_));
ThreadPoolBuilder cdc_consumer_thread_pool_builder("XClusterConsumerHandler");
if (FLAGS_cdc_consumer_handler_thread_pool_size > 0) {
cdc_consumer_thread_pool_builder.set_max_threads(FLAGS_cdc_consumer_handler_thread_pool_size);
if (FLAGS_xcluster_consumer_thread_pool_size > 0) {
cdc_consumer_thread_pool_builder.set_max_threads(FLAGS_xcluster_consumer_thread_pool_size);
}

return cdc_consumer_thread_pool_builder.Build(&thread_pool_);
Expand Down

0 comments on commit e6b5f35

Please sign in to comment.