You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: add tidb_general_log to TiDB configuration reference (#24014) - #24735
Add the missing instance.tidb_general_log entry to tidb-configuration-file.md.
Document the default value and boolean options so the permanent instance-level general query log setting is covered in the configuration reference.
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.
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
Summary by CodeRabbit
Documentation
Clarified that the general log records statements after compilation and before execution, including statements that fail during execution. Statements that fail to parse or compile are not recorded.
Clarified that general log entries are written at the info level regardless of the configured log level and can be found by searching for "GENERAL_LOG".
Documented the instance-level setting, including its false default and supported true or false values.
The documentation updates describe general-log recording behavior and add the instance.tidb_general_log configuration entry, including its default and accepted values.
Changes: General log documentation
Layer / File(s)
Summary
General log behavior and configuration system-variables.md, tidb-configuration-file.md
The system variable documentation states that compiled statements are logged even if execution fails, while parse- or compilation-failing statements are excluded. It also states that entries use the info level regardless of log.level. The configuration documentation adds instance.tidb_general_log, its default of false, and its accepted values.
This PR documents the instance.tidb_general_log setting and clarifies general-log behavior. The docs still overstate what the general log records: DDL such as CREATE TABLE goes to a different log entry. They also list field names that do not match the emitted log keys. Readers may search or filter for the wrong strings. There is no runtime risk, and the fixes are small.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change: adding tidb_general_log to the TiDB configuration reference. The raw summary confirms that tidb-configuration-file.md gained an instance.tidb_general_log entry. The title d…
Description check
The description follows the repository template. It includes the 'What is changed' section with a clear summary, the affected-version checkboxes (master and v8.5 ticked), and the related reference lin…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the change: adding tidb_general_log to the TiDB configuration reference. The raw summary confirms that tidb-configuration-file.md gained an instance.tidb_general_log entry. The title does not mention the system-variable documentation change in system-variables.md, which is a secondary part of the changeset. The title is specific and matches the main change.
Full details: Description check
Explanation
The description follows the repository template. It includes the 'What is changed' section with a clear summary, the affected-version checkboxes (master and v8.5 ticked), and the related reference link. It omits the first-time contributor checklist, which is optional. The 'AI agent involvement' section is absent from the author's version. The description does not mention the system-variables.md changes, which the raw summary shows are part of this PR. Its scope statement is incomplete relative to the actual changes.
Resolution
Optionally, mention the system-variables.md wording change (general log timing, log level independence, and the GENERAL_LOG search string) in the 'What is changed' section so the description matches the full changeset.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Correct the general-log field names. · system-variables.md:3336-3337
system-variables.md:3336-3337 Minor · Data Integrity & Integration · Quick win
Correct the general-log field names.
The v8.5.0 logger emits currentDB and sessionTxnMode, not current_db and txn_mode. Readers using the new GENERAL_LOG search guidance can otherwise build filters for keys that do not exist. Update the field list to match the emitted keys. (raw.githubusercontent.com)
Reviewing files that changed from the base of the PR and between 540e2d9 and 567d618.
Files selected for processing: 2
system-variables.md
tidb-configuration-file.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
- The [`tidb_redact_log`](#tidb_redact_log) variable enables you to redact SQL statements recorded in the general log.
- Only successfully executed statements are logged in the general log. Failed statements are not recorded in the general log but are instead logged in the TiDB log with a `command dispatched failed` message.
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Document that DDL statements are not recorded in the general log.
The general log does not record DDL statements, such as CREATE TABLE. TiDB writes these statements as CRUCIAL OPERATION entries in the TiDB log, whether or not general logging is enabled. Searching for "GENERAL_LOG", as this section instructs, misses them. The opening sentence also says the variable records "all SQL statements," which conflicts with the exclusions later in this section.
Suggested documentation change
-This variable is used to set whether to record all SQL statements in the [log](/tidb-configuration-file.md#logfile).+This variable is used to set whether to record SQL statements in the [log](/tidb-configuration-file.md#logfile).
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
+- DDL statements, such as `CREATE TABLE`, are not recorded in the general log. TiDB records them as `CRUCIAL OPERATION` entries in the TiDB log. To find them, search for the `"CRUCIAL OPERATION"` string.
Committable suggestion
IMPORTANT
Review the replacement and indentation, then test before committing.
Suggested change
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
- The general log records SQL statements after compilation and before execution, so statements that fail during execution might also be recorded. Statements that fail during parsing or compilation are not recorded in the general log.
- DDL statements, such as `CREATE TABLE`, are not recorded in the general log. TiDB records them as `CRUCIAL OPERATION` entries in the TiDB log. To find them, search for the `"CRUCIAL OPERATION"` string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #24014
What is changed, added or deleted? (Required)
instance.tidb_general_logentry totidb-configuration-file.md.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.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?
Summary by CodeRabbit
"GENERAL_LOG".falsedefault and supportedtrueorfalsevalues.