sys-var: clarify tidb_slow_log_rules syntax/behavior and de-duplicate slow log docs#21337
sys-var: clarify tidb_slow_log_rules syntax/behavior and de-duplicate slow log docs#21337
tidb_slow_log_rules syntax/behavior and de-duplicate slow log docs#21337Conversation
system-variables.md
Outdated
| - 规则更新行为:每次执行 `SET [SESSION|GLOBAL] tidb_slow_log_rules = '...'` 都会覆盖对应作用域原有规则,不会追加。 | ||
| - 规则清空行为:`SET [SESSION|GLOBAL] tidb_slow_log_rules = ''` 会清空对应作用域规则。 | ||
| - 在当前会话存在可生效的 `tidb_slow_log_rules`(SESSION 规则、GLOBAL 的当前 `Conn_ID` 规则,或未指定 `Conn_ID` 的全局规则)时,慢查询日志输出由规则匹配结果决定,`tidb_slow_log_threshold` 不再参与判断。 | ||
| - 在当前会话不存在可生效的规则(例如对应作用域规则被清空)时,慢查询日志触发仍依赖 `tidb_slow_log_threshold`(单位:毫秒)。 |
There was a problem hiding this comment.
除了 对应作用域规则被清空 的情况,若所有规则均不生效,还会回退到使用 tidb_slow_log_threshold 进行判断吗
system-variables.md
Outdated
| - 规则清空行为:`SET [SESSION|GLOBAL] tidb_slow_log_rules = ''` 会清空对应作用域规则。 | ||
| - 在当前会话存在可生效的 `tidb_slow_log_rules`(SESSION 规则、GLOBAL 的当前 `Conn_ID` 规则,或未指定 `Conn_ID` 的全局规则)时,慢查询日志输出由规则匹配结果决定,`tidb_slow_log_threshold` 不再参与判断。 | ||
| - 在当前会话不存在可生效的规则(例如对应作用域规则被清空)时,慢查询日志触发仍依赖 `tidb_slow_log_threshold`(单位:毫秒)。 | ||
| - 如果希望规则中仍使用 SQL 执行时间作为输出慢日志的条件,可在规则中使用 `Query_time`(单位:秒)并设置阈值。 |
There was a problem hiding this comment.
这里再额外说明一下,注意 tidb_slow_log_threshold 单位是 ms,不要配错
There was a problem hiding this comment.
上面 5224 行写了单位毫秒,感觉没必要特别说明了。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
PTAL @XuHuaiyu |
|
@XuHuaiyu: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn 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. |
c652e99 to
403903b
Compare
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
Add a new “tidb_slow_log_rules 使用方法” section to identify-slow-queries.md that documents rule syntax, type constraints, supported fields, matching semantics, scope/priority, examples and usage recommendations (including notes on units and rate-limiting). Remove the duplicated detailed rule text from system-variables.md and replace it with a link to the new section and an updated tip. This centralizes slow-log rule documentation on the slow-query diagnostics page and avoids maintaining the same content in multiple places.
tidb_slow_log_rules syntax/behavior and de-duplicate slow log docs
Synced from: pingcap/docs-cn#21337 Target PR: pingcap#22567 AI Provider: gemini Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
/retest |
|
@zhaoshangzi: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn 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. |
What is changed, added or deleted? (Required)
This PR refactors and clarifies
tidb_slow_log_rulesdocumentation in:system-variables.mdidentify-slow-queries.mdMain updates:
Reorganized
tidb_slow_log_rulesinsystem-variables.mdwith clearer structure:Clarified key behavior/constraints:
Conn_ID(GLOBAL only)>=for numeric,=for string/bool)tidb_slow_log_thresholdwhen no effective rules,/;(quoted values still not supported)tidb_slow_log_rulestime fields are seconds, threshold is milliseconds)Reduced duplication between docs:
system-variables.mdidentify-slow-queries.mdWhich 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.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?