docs icon indicating copy to clipboard operation
docs copied to clipboard

Add circuit breaker variable

Open rleungx opened this issue 10 months ago • 15 comments

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • [x] master (the latest development version)
  • [ ] v9.0 (TiDB 9.0 versions)
  • [ ] v8.5 (TiDB 8.5 versions)
  • [ ] v8.4 (TiDB 8.4 versions)
  • [ ] v8.3 (TiDB 8.3 versions)
  • [ ] v8.1 (TiDB 8.1 versions)
  • [ ] v7.5 (TiDB 7.5 versions)
  • [ ] v7.1 (TiDB 7.1 versions)
  • [ ] v6.5 (TiDB 6.5 versions)
  • [ ] v6.1 (TiDB 6.1 versions)
  • [ ] v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s): https://github.com/tikv/pd/issues/8678, https://github.com/pingcap/tidb/issues/58780

Do your changes match any of the following descriptions?

  • [ ] Delete files
  • [ ] Change aliases
  • [ ] Need modification after applied to another branch
  • [ ] Might cause conflicts after applied to another branch

rleungx avatar Jan 23 '25 03:01 rleungx

/hold

rleungx avatar Mar 11 '25 07:03 rleungx

@benmeadowcroft: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

ti-chi-bot[bot] avatar Jun 05 '25 21:06 ti-chi-bot[bot]

@benmeadowcroft: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Let's make it a bit clearer how this should be set and the meaning.

E.g. perhaps updating to:

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 1 to 100 then the circuit breaker is triggered if the error rate percentage, of the specific requests sent to PD, meets or exceeds the threshold.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

ti-chi-bot[bot] avatar Jun 05 '25 22:06 ti-chi-bot[bot]

I am also confused why we are using Range: [0, 100] for this variable instead of Range: [0.0, 1.0] as we have done for other ratio/percentage based thresholds in this configuration file.

benmeadowcroft avatar Jun 05 '25 22:06 benmeadowcroft

Maybe we can change it to [0, 1]? /cc @tema @niubell @okJiang

rleungx avatar Jun 10 '25 03:06 rleungx

@rleungx: GitHub didn't allow me to request PR reviews from the following users: tema.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Maybe we can change it to [0, 1]? /cc @tema @niubell @okJiang

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

ti-chi-bot[bot] avatar Jun 10 '25 03:06 ti-chi-bot[bot]

Maybe we can change it to [0, 1]? /cc @Tema @niubell @okJiang

LGTM

okJiang avatar Jun 10 '25 03:06 okJiang

@benmeadowcroft: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

ti-chi-bot[bot] avatar Jun 10 '25 12:06 ti-chi-bot[bot]

Maybe we can change it to [0, 1]? /cc @Tema @niubell @okJiang

@rleungx I don't mind the pct/ratio, but I wish you changed the name as well. The _pct suffix in the name meant to mean percentage. Now it is a bit confusing. cc: @benmeadowcroft

Tema avatar Jun 10 '25 21:06 Tema

AFAIK, we have another variable tidb_instance_plan_cache_reserved_percentage which uses the percentage as the suffix. And its range is [0, 1]. See https://docs.pingcap.com/tidb/stable/system-variables/#tidb_instance_plan_cache_reserved_percentage-new-in-v840. /cc @benmeadowcroft

rleungx avatar Jun 11 '25 02:06 rleungx

@rleungx my primary interest is consistency so my suggestion to address the feedback from @Tema would be to either (1) spell out the abbreviation fully, e.g. tidb_cb_pd_metadata_error_rate_threshold_percentage, or (2) use the suffix _ratio for this variable.

Looking over the set of variables provided it looks like there is 1 instance of *_percentage and 6 instances of *_ratio so my preference would be to use the latter.

benmeadowcroft avatar Jun 23 '25 18:06 benmeadowcroft

change to tidb_cb_pd_metadata_error_rate_threshold_ratio.

rleungx avatar Jun 24 '25 09:06 rleungx

/hold cancel

rleungx avatar Jun 24 '25 09:06 rleungx

[LGTM Timeline notifier]

Timeline:

  • 2025-06-30 03:51:35.490446256 +0000 UTC m=+1280548.213625234: :ballot_box_with_check: agreed by hfxsd.
  • 2025-10-09 10:28:15.922494706 +0000 UTC m=+349684.953594024: :ballot_box_with_check: agreed by lilin90.

ti-chi-bot[bot] avatar Oct 09 '25 10:10 ti-chi-bot[bot]

/approve

hfxsd avatar Nov 07 '25 04:11 hfxsd

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hfxsd

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar Nov 07 '25 04:11 ti-chi-bot[bot]