From aca1baff4b8f59b17220c5f60d7d677c53f6834a Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Thu, 23 Jan 2025 11:04:41 +0800 Subject: [PATCH 1/4] add circuit breaker variable Signed-off-by: Ryan Leung --- system-variables.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/system-variables.md b/system-variables.md index 3fc49dadc3bfa..98a3b12d424b2 100644 --- a/system-variables.md +++ b/system-variables.md @@ -6052,6 +6052,16 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). > - `PARALLEL` and `PARALLEL-FAST` modes are incompatible with [`tidb_tso_client_batch_max_wait_time`](#tidb_tso_client_batch_max_wait_time-new-in-v530) and [`tidb_enable_tso_follower_proxy`](#tidb_enable_tso_follower_proxy-new-in-v530). If either [`tidb_tso_client_batch_max_wait_time`](#tidb_tso_client_batch_max_wait_time-new-in-v530) is set to a non-zero value or [`tidb_enable_tso_follower_proxy`](#tidb_enable_tso_follower_proxy-new-in-v530) is enabled, configuring `tidb_tso_client_rpc_mode` does not take effect, and TiDB always works in `DEFAULT` mode. > - `PARALLEL` and `PARALLEL-FAST` modes are designed to reduce the average time for retrieving TS in TiDB. In situations with significant latency fluctuations, such as long-tail latency or latency spikes, these two modes might not provide any remarkable performance improvements. + +### tidb_cb_pd_metadata_error_rate_threshold_pct + +- Scope: GLOBAL +- Persists to cluster: Yes +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Default value: `0` +- Range: `[0, 100]` +- This variable controls whether TiDB triggers the circuit breaker according to the error rate percentage of the specific requests sending to PD. + ### tidb_ttl_delete_rate_limit New in v6.5.0 > **Note:** From 58b886c0403a39c5b8f3cc2bb39c4c9ae91d140d Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 10 Jun 2025 13:35:01 +0800 Subject: [PATCH 2/4] address the comment Signed-off-by: Ryan Leung --- system-variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-variables.md b/system-variables.md index 98a3b12d424b2..0d5d5d2305c2d 100644 --- a/system-variables.md +++ b/system-variables.md @@ -6059,8 +6059,8 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Default value: `0` -- Range: `[0, 100]` -- This variable controls whether TiDB triggers the circuit breaker according to the error rate percentage of the specific requests sending to PD. +- Range: `[0, 1]` +- This variable is used to control when TiDB triggers the circuit breaker. If set to 0 (the default) then the circuit breaker is disabled. If the variable is set to 0.01 to 1 then the circuit breaker is triggered if the error rate percentage, of the specific requests sent to PD, meets or exceeds the threshold. ### tidb_ttl_delete_rate_limit New in v6.5.0 From b66f65d8d945e7cb842b0eaef5f3e052010221fb Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 24 Jun 2025 17:24:57 +0800 Subject: [PATCH 3/4] address the comment Signed-off-by: Ryan Leung --- system-variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-variables.md b/system-variables.md index 0d5d5d2305c2d..20220a49aa41c 100644 --- a/system-variables.md +++ b/system-variables.md @@ -6053,14 +6053,14 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). > - `PARALLEL` and `PARALLEL-FAST` modes are designed to reduce the average time for retrieving TS in TiDB. In situations with significant latency fluctuations, such as long-tail latency or latency spikes, these two modes might not provide any remarkable performance improvements. -### tidb_cb_pd_metadata_error_rate_threshold_pct +### tidb_cb_pd_metadata_error_rate_threshold_ratio - Scope: GLOBAL - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Default value: `0` - Range: `[0, 1]` -- This variable is used to control when TiDB triggers the circuit breaker. If set to 0 (the default) then the circuit breaker is disabled. If the variable is set to 0.01 to 1 then the circuit breaker is triggered if the error rate percentage, of the specific requests sent to PD, meets or exceeds the threshold. +- This variable is used to control when TiDB triggers the circuit breaker. If set to 0 (the default) then the circuit breaker is disabled. If the variable is set to 0.01 to 1 then the circuit breaker is triggered if the error rate ratio, of the specific requests sent to PD, meets or exceeds the threshold. ### tidb_ttl_delete_rate_limit New in v6.5.0 From 03f5e6ef0c1f7a68ede114b9f649aa47256cc197 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Mon, 30 Jun 2025 11:50:46 +0800 Subject: [PATCH 4/4] Apply suggestions from code review --- system-variables.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index 20220a49aa41c..eeb973a3868b3 100644 --- a/system-variables.md +++ b/system-variables.md @@ -6052,15 +6052,14 @@ For details, see [Identify Slow Queries](/identify-slow-queries.md). > - `PARALLEL` and `PARALLEL-FAST` modes are incompatible with [`tidb_tso_client_batch_max_wait_time`](#tidb_tso_client_batch_max_wait_time-new-in-v530) and [`tidb_enable_tso_follower_proxy`](#tidb_enable_tso_follower_proxy-new-in-v530). If either [`tidb_tso_client_batch_max_wait_time`](#tidb_tso_client_batch_max_wait_time-new-in-v530) is set to a non-zero value or [`tidb_enable_tso_follower_proxy`](#tidb_enable_tso_follower_proxy-new-in-v530) is enabled, configuring `tidb_tso_client_rpc_mode` does not take effect, and TiDB always works in `DEFAULT` mode. > - `PARALLEL` and `PARALLEL-FAST` modes are designed to reduce the average time for retrieving TS in TiDB. In situations with significant latency fluctuations, such as long-tail latency or latency spikes, these two modes might not provide any remarkable performance improvements. - -### tidb_cb_pd_metadata_error_rate_threshold_ratio +### tidb_cb_pd_metadata_error_rate_threshold_ratio New in v9.0.0 - Scope: GLOBAL - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Default value: `0` - Range: `[0, 1]` -- This variable is used to control when TiDB triggers the circuit breaker. If set to 0 (the default) then the circuit breaker is disabled. If the variable is set to 0.01 to 1 then the circuit breaker is triggered if the error rate ratio, of the specific requests sent to PD, meets or exceeds the threshold. +- This variable controls when TiDB triggers the circuit breaker. A value of `0` (default) disables the circuit breaker. A value between `0.01` and `1` enables it, causing the circuit breaker to trigger when the error rate of specific requests to PD meets or exceeds the threshold. ### tidb_ttl_delete_rate_limit New in v6.5.0