Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9c24ce2
Add files via upload
qiancai Sep 2, 2025
5b0f5a4
Add files via upload
qiancai Sep 2, 2025
fb28ac3
Add files via upload
qiancai Sep 2, 2025
a38b9ec
Update sync-cloud-zh-toc.yml
qiancai Sep 2, 2025
07ca99b
Add files via upload
qiancai Sep 2, 2025
3721393
Update sync-cloud-zh-toc.yml
qiancai Sep 2, 2025
20e8574
Merge branch 'master' of github.com:qiancai/docs
qiancai Sep 5, 2025
50a5f9a
Merge branch 'master' of github.com:qiancai/docs
qiancai Sep 9, 2025
7a411d4
Merge branch 'master' of github.com:qiancai/docs
qiancai Sep 15, 2025
7dbc37b
Merge branch 'master' of github.com:qiancai/docs
qiancai Sep 24, 2025
2aadfeb
add files
qiancai Sep 25, 2025
4fce98f
Discard changes to system-variables.md
qiancai Sep 25, 2025
e68d1c2
Discard changes to ticdc/ticdc-faq.md
qiancai Sep 25, 2025
88d9864
Discard changes to tikv-configuration-file.md
qiancai Sep 25, 2025
ab90fca
Merge pull request #43 from qiancai/sync
qiancai Sep 25, 2025
e7ed7d1
Update main_workflow.py
qiancai Sep 26, 2025
11efdef
Update sync-docs-cn-to-en.yml
qiancai Sep 26, 2025
322c671
Merge branch 'pingcap:master' into master
qiancai Sep 29, 2025
38c7536
Merge branch 'pingcap:master' into master
qiancai Sep 30, 2025
7e9621c
Merge branch 'upstream-master'
qiancai Oct 21, 2025
ebe65dd
Delete scripts/translate_doc_pr directory
qiancai Oct 21, 2025
bed0d76
Delete sync-en-cloud-toc-changes-to-zh.py
qiancai Oct 21, 2025
c748b45
Merge branch 'master' of github.com:qiancai/docs
qiancai Oct 21, 2025
bcea1e9
change the path to the scripts
qiancai Oct 21, 2025
2c5531f
Merge branch 'master' of github.com:qiancai/docs
qiancai Oct 23, 2025
f4fd062
Create sync-docs-cn-to-en.yml
qiancai Oct 23, 2025
af6b86c
support triggering from the forked repo
qiancai Oct 23, 2025
0e7bf69
v2: trigger from fork
qiancai Oct 23, 2025
2be37f0
Merge branch 'master' of github.com:qiancai/docs
qiancai Oct 24, 2025
d3960c3
Add files via upload
qiancai Nov 10, 2025
9e72600
Add files via upload
qiancai Nov 10, 2025
99fb7bc
Merge branch 'master' of github.com:qiancai/docs
qiancai Nov 10, 2025
b2ebd64
Update sync-docs-cn-to-en.yml
qiancai Nov 12, 2025
f6a96a4
Add temp.md
qiancai Nov 12, 2025
3ab4cc7
Delete temp.md
qiancai Nov 12, 2025
1441d5d
Auto-sync: Update English docs from Chinese PR
github-actions[bot] Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions .github/workflows/sync-docs-cn-to-en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Sync Docs Changes from ZH PR to EN PR

on:
workflow_dispatch:
inputs:
source_pr_url:
description: 'Source PR URL (Chinese docs repository)'
required: true
type: string
default: ''
target_pr_url:
description: 'Target PR URL (English docs repository)'
required: true
type: string
default: ''
ai_provider:
description: 'AI Provider to use for translation'
required: false
type: choice
options:
- deepseek
- gemini
default: 'gemini'

jobs:
sync-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Checkout ai-pr-translator repository
uses: actions/checkout@v4
with:
repository: "qiancai/ai-pr-translator"
ref: "main"
path: "ai-pr-translator"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: pip install -r ai-pr-translator/scripts/requirements.txt

- name: Extract PR information
id: extract_info
env:
SOURCE_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_URL: ${{ github.event.inputs.target_pr_url }}
run: |
if [[ ! "$SOURCE_URL" =~ ^https://github\.com/[^/]+/[^/]+/pull/[0-9]+$ ]]; then
echo "❌ Invalid source PR URL format"; exit 1
fi
if [[ ! "$TARGET_URL" =~ ^https://github\.com/[^/]+/[^/]+/pull/[0-9]+$ ]]; then
echo "❌ Invalid target PR URL format"; exit 1
fi

SOURCE_OWNER=$(echo "$SOURCE_URL" | cut -d'/' -f4)
SOURCE_REPO=$(echo "$SOURCE_URL" | cut -d'/' -f5)
SOURCE_PR=$(echo "$SOURCE_URL" | cut -d'/' -f7)
TARGET_OWNER=$(echo "$TARGET_URL" | cut -d'/' -f4)
TARGET_REPO=$(echo "$TARGET_URL" | cut -d'/' -f5)
TARGET_PR=$(echo "$TARGET_URL" | cut -d'/' -f7)

{
echo "source_owner<<EOF"; echo "$SOURCE_OWNER"; echo "EOF"
echo "source_repo<<EOF"; echo "$SOURCE_REPO"; echo "EOF"
echo "source_pr<<EOF"; echo "$SOURCE_PR"; echo "EOF"
echo "target_owner<<EOF"; echo "$TARGET_OWNER"; echo "EOF"
echo "target_repo<<EOF"; echo "$TARGET_REPO"; echo "EOF"
echo "target_pr<<EOF"; echo "$TARGET_PR"; echo "EOF"
} >> $GITHUB_OUTPUT

echo "Source: ${SOURCE_OWNER}/${SOURCE_REPO}#${SOURCE_PR}"
echo "Target: ${TARGET_OWNER}/${TARGET_REPO}#${TARGET_PR}"

- name: Get target PR branch info
id: target_branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET_OWNER: ${{ steps.extract_info.outputs.target_owner }}
TARGET_REPO: ${{ steps.extract_info.outputs.target_repo }}
TARGET_PR: ${{ steps.extract_info.outputs.target_pr }}
run: |
PR_INFO=$(curl -s -H "Authorization: token ${GH_TOKEN}" -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${TARGET_OWNER}/${TARGET_REPO}/pulls/${TARGET_PR}")
TARGET_BRANCH=$(echo "$PR_INFO" | jq -r '.head.ref')
HEAD_REPO=$(echo "$PR_INFO" | jq -r '.head.repo.full_name')
echo "target_branch=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
echo "head_repo=${HEAD_REPO}" >> $GITHUB_OUTPUT
echo "Target branch: ${TARGET_BRANCH}, Head repo: ${HEAD_REPO}"

- name: Clone target repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_REPO: ${{ steps.target_branch.outputs.head_repo }}
TARGET_BRANCH: ${{ steps.target_branch.outputs.target_branch }}
run: |
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${HEAD_REPO}.git" target_repo
cd target_repo && git checkout "$TARGET_BRANCH"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Run sync script
id: sync_script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEEPSEEK_API_TOKEN: ${{ secrets.DEEPSEEK_API_TOKEN }}
GEMINI_API_TOKEN: ${{ secrets.GEMINI_API_TOKEN }}
SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }}
AI_PROVIDER: ${{ github.event.inputs.ai_provider }}
TARGET_REPO_PATH: ${{ github.workspace }}/target_repo
run: |
cd ai-pr-translator/scripts
if python main_workflow.py; then
echo "sync_success=true" >> $GITHUB_OUTPUT
echo "✅ Sync script completed successfully"
else
echo "sync_success=false" >> $GITHUB_OUTPUT
echo "❌ Sync script failed"
exit 1
fi

- name: Commit and push changes
if: steps.sync_script.outputs.sync_success == 'true'
env:
SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }}
AI_PROVIDER: ${{ github.event.inputs.ai_provider }}
TARGET_BRANCH: ${{ steps.target_branch.outputs.target_branch }}
run: |
cd target_repo && git add .
if ! git diff --staged --quiet; then
printf "Auto-sync: Update English docs from Chinese PR\n\nSynced from: %s\nTarget PR: %s\nAI Provider: %s\n\nCo-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" \
"$SOURCE_PR_URL" "$TARGET_PR_URL" "$AI_PROVIDER" | git commit -F -
git push origin "$TARGET_BRANCH"
echo "Changes pushed to $TARGET_BRANCH"
else
echo "No changes to commit"
fi

- name: Add success comment to target PR
if: steps.sync_script.outputs.sync_success == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }}
TARGET_OWNER: ${{ steps.extract_info.outputs.target_owner }}
TARGET_REPO: ${{ steps.extract_info.outputs.target_repo }}
TARGET_PR: ${{ steps.extract_info.outputs.target_pr }}
run: |
BODY=$(printf '%s\n\n%s\n%s\n%s\n\n%s' "**Auto-sync completed successfully**" \
"**Source PR**: ${SOURCE_PR_URL}" "**Target PR**: ${TARGET_PR_URL}" \
"English documentation has been updated based on Chinese documentation changes." )
PAYLOAD=$(jq -n --arg body "$BODY" '{body: $body}')
curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${TARGET_OWNER}/${TARGET_REPO}/issues/${TARGET_PR}/comments" \
-d "$PAYLOAD"

- name: Add failure comment to target PR
if: steps.sync_script.outputs.sync_success == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }}
TARGET_OWNER: ${{ steps.extract_info.outputs.target_owner }}
TARGET_REPO: ${{ steps.extract_info.outputs.target_repo }}
TARGET_PR: ${{ steps.extract_info.outputs.target_pr }}
run: |
BODY=$(printf '%s\n\n%s\n%s\n%s\n\n%s' "**Auto-sync failed**" \
"**Source PR**: ${SOURCE_PR_URL}" "**Target PR**: ${TARGET_PR_URL}" \
"The sync process encountered an error. Please check the workflow logs for details.")
PAYLOAD=$(jq -n --arg body "$BODY" '{body: $body}')
curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${TARGET_OWNER}/${TARGET_REPO}/issues/${TARGET_PR}/comments" \
-d "$PAYLOAD"
2 changes: 1 addition & 1 deletion scripts/sync-en-cloud-toc-changes-to-zh.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from urllib.error import URLError, HTTPError
from google import genai

REPO_OWNER = "pingcap"
REPO_OWNER = "qiancai"
REPO_NAME = "docs"
EN_BRANCH = "release-8.5"
ZH_BRANCH = "i18n-zh-release-8.5"
Expand Down
167 changes: 167 additions & 0 deletions sync-docs-cn-to-en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Sync Docs Changes from ZH PR to EN PR

on:
workflow_dispatch:
inputs:
source_pr_url:
description: 'Source PR URL (Chinese docs repository)'
required: true
type: string
default: ''
target_pr_url:
description: 'Target PR URL (English docs repository)'
required: true
type: string
default: ''
ai_provider:
description: 'AI Provider to use for translation'
required: false
type: choice
options:
- deepseek
- gemini
default: 'gemini'

jobs:
sync-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Checkout ai-pr-translator repository
uses: actions/checkout@v4
with:
repository: "qiancai/ai-pr-translator"
ref: "main"
path: "ai-pr-translator"

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ai-pr-translator/scripts/requirements.txt

- name: Extract PR information
id: extract_info
run: |
# Extract source repo info
SOURCE_URL="${{ github.event.inputs.source_pr_url }}"
SOURCE_OWNER=$(echo $SOURCE_URL | cut -d'/' -f4)
SOURCE_REPO=$(echo $SOURCE_URL | cut -d'/' -f5)
SOURCE_PR=$(echo $SOURCE_URL | cut -d'/' -f7)

# Extract target repo info
TARGET_URL="${{ github.event.inputs.target_pr_url }}"
TARGET_OWNER=$(echo $TARGET_URL | cut -d'/' -f4)
TARGET_REPO=$(echo $TARGET_URL | cut -d'/' -f5)
TARGET_PR=$(echo $TARGET_URL | cut -d'/' -f7)

echo "source_owner=${SOURCE_OWNER}" >> $GITHUB_OUTPUT
echo "source_repo=${SOURCE_REPO}" >> $GITHUB_OUTPUT
echo "source_pr=${SOURCE_PR}" >> $GITHUB_OUTPUT
echo "target_owner=${TARGET_OWNER}" >> $GITHUB_OUTPUT
echo "target_repo=${TARGET_REPO}" >> $GITHUB_OUTPUT
echo "target_pr=${TARGET_PR}" >> $GITHUB_OUTPUT

echo "Source: ${SOURCE_OWNER}/${SOURCE_REPO}#${SOURCE_PR}"
echo "Target: ${TARGET_OWNER}/${TARGET_REPO}#${TARGET_PR}"

- name: Get target PR branch info
id: target_branch
run: |
# Get target PR information including head repository
PR_INFO=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/pulls/${{ steps.extract_info.outputs.target_pr }}")

TARGET_BRANCH=$(echo "$PR_INFO" | jq -r '.head.ref')
HEAD_REPO=$(echo "$PR_INFO" | jq -r '.head.repo.full_name')

echo "target_branch=${TARGET_BRANCH}" >> $GITHUB_OUTPUT
echo "head_repo=${HEAD_REPO}" >> $GITHUB_OUTPUT
echo "Target branch: ${TARGET_BRANCH}"
echo "Head repository: ${HEAD_REPO}"

- name: Clone target repository
run: |
# Clone the head repository (where the PR branch is)
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ steps.target_branch.outputs.head_repo }}.git target_repo
cd target_repo
git checkout ${{ steps.target_branch.outputs.target_branch }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Run sync script
id: sync_script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEEPSEEK_API_TOKEN: ${{ secrets.DEEPSEEK_API_TOKEN }}
GEMINI_API_TOKEN: ${{ secrets.GEMINI_API_TOKEN }}
SOURCE_PR_URL: ${{ github.event.inputs.source_pr_url }}
TARGET_PR_URL: ${{ github.event.inputs.target_pr_url }}
AI_PROVIDER: ${{ github.event.inputs.ai_provider }}
TARGET_REPO_PATH: ${{ github.workspace }}/target_repo
run: |
cd ai-pr-translator/scripts
if python main_workflow.py; then
echo "sync_success=true" >> $GITHUB_OUTPUT
echo "✅ Sync script completed successfully"
else
echo "sync_success=false" >> $GITHUB_OUTPUT
echo "❌ Sync script failed"
exit 1
fi

- name: Commit and push changes
if: steps.sync_script.outputs.sync_success == 'true'
run: |
cd target_repo
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Auto-sync: Update English docs from Chinese PR ${{ github.event.inputs.source_pr_url }}

Synced from: ${{ github.event.inputs.source_pr_url }}
Target PR: ${{ github.event.inputs.target_pr_url }}
AI Provider: ${{ github.event.inputs.ai_provider }}

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"

git push origin ${{ steps.target_branch.outputs.target_branch }}
echo "Changes pushed to target PR branch: ${{ steps.target_branch.outputs.target_branch }}"
fi

- name: Add success comment to target PR
if: steps.sync_script.outputs.sync_success == 'true'
run: |
# Add a comment to the target PR about the sync success
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/issues/${{ steps.extract_info.outputs.target_pr }}/comments" \
-d "{
\"body\": \"🤖 **Auto-sync completed successfully**\\n\\n📥 **Source PR**: ${{ github.event.inputs.source_pr_url }}\\n🎯 **Target PR**: ${{ github.event.inputs.target_pr_url }}\\n✅ English documentation has been updated based on Chinese documentation changes.\\n\\n_This comment was generated automatically by the sync workflow._\"
}"

- name: Add failure comment to target PR
if: steps.sync_script.outputs.sync_success == 'false'
run: |
# Add a comment to the target PR about the sync failure
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ steps.extract_info.outputs.target_owner }}/${{ steps.extract_info.outputs.target_repo }}/issues/${{ steps.extract_info.outputs.target_pr }}/comments" \
-d "{
\"body\": \"🤖 **Auto-sync failed**\\n\\n📥 **Source PR**: ${{ github.event.inputs.source_pr_url }}\\n🎯 **Target PR**: ${{ github.event.inputs.target_pr_url }}\\n❌ The sync process encountered an error. Please check the workflow logs for details.\\n\\n_This comment was generated automatically by the sync workflow._\"
}"
12 changes: 10 additions & 2 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,6 @@ mysql> SELECT job_info FROM mysql.analyze_jobs ORDER BY end_time DESC LIMIT 1;
- If `tidb_ddl_enable_fast_reorg` is set to `OFF`, `ADD INDEX` is executed as a transaction. If there are many update operations such as `UPDATE` and `REPLACE` in the target columns during the `ADD INDEX` execution, a larger batch size indicates a larger probability of transaction conflicts. In this case, it is recommended that you set the batch size to a smaller value. The minimum value is 32.
- If the transaction conflict does not exist, or if `tidb_ddl_enable_fast_reorg` is set to `ON`, you can set the batch size to a large value. This makes data backfilling faster but also increases the write pressure on TiKV. For a proper batch size, you also need to refer to the value of `tidb_ddl_reorg_worker_cnt`. See [Interaction Test on Online Workloads and `ADD INDEX` Operations](https://docs.pingcap.com/tidb/dev/online-workloads-and-add-index-operations) for reference.
- Starting from v8.3.0, this parameter is supported at the SESSION level. Modifying the parameter at the GLOBAL level will not impact currently running DDL statements. It will only apply to DDLs submitted in new sessions.
- Starting from v8.5.0, you can modify this parameter for a running DDL job by executing `ADMIN ALTER DDL JOBS <job_id> BATCH_SIZE = <new_batch_size>;`. Note that this operation is not supported for `ADD INDEX` DDL when [`tidb_enable_dist_task`](/system-variables.md#tidb_enable_dist_task-new-in-v710) is enabled. For details, see [`ADMIN ALTER DDL JOBS`](/sql-statements/sql-statement-admin-alter-ddl.md).

### tidb_ddl_reorg_priority

Expand Down Expand Up @@ -1780,7 +1779,6 @@ Assume that you have a cluster with 4 TiDB nodes and multiple TiKV nodes. In thi
- Unit: Threads
- This variable is used to set the concurrency of the DDL operation in the `re-organize` phase.
- Starting from v8.3.0, this parameter is supported at the SESSION level. Modifying the parameter at the GLOBAL level will not impact currently running DDL statements. It will only apply to DDLs submitted in new sessions.
- Starting from v8.5.0, you can modify this parameter for a running DDL job by executing `ADMIN ALTER DDL JOBS <job_id> THREAD = <new_thread_count>;`. Note that this operation is not supported for `ADD INDEX` DDL when [`tidb_enable_dist_task`](/system-variables.md#tidb_enable_dist_task-new-in-v710) is enabled. For details, see [`ADMIN ALTER DDL JOBS`](/sql-statements/sql-statement-admin-alter-ddl.md).

### `tidb_enable_fast_create_table` <span class="version-mark">New in v8.0.0</span>

Expand All @@ -1794,6 +1792,16 @@ Assume that you have a cluster with 4 TiDB nodes and multiple TiKV nodes. In thi
- This variable is renamed from the variable [`tidb_ddl_version`](https://docs-archive.pingcap.com/tidb/v7.6/system-variables#tidb_ddl_version-new-in-v760) that is introduced in v7.6.0. Starting from v8.0.0, `tidb_ddl_version` no longer takes effect.
- Starting from TiDB v8.5.0, the accelerated table creation feature is enabled by default for newly created clusters, with `tidb_enable_fast_create_table` set to `ON`. For clusters upgraded from v8.4.0 or earlier versions, the default value of `tidb_enable_fast_create_table` remains unchanged.

### `tidb_opt_selectivity_factor` <span class="version-mark">Introduced in v9.0.0</span>

- Scope: SESSION | GLOBAL
- Persist to cluster: Yes
- Controlled by hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
- Type: Floating-point number
- Value range: `[0, 1]`
- Default value: `0.8`
- This variable specifies the default selectivity of the TiDB optimizer. In some cases, when the optimizer cannot derive the predicate selectivity based on statistics, the optimizer uses this default selectivity as an alternative value. **We do not recommend** modifying this value.

Comment on lines +1795 to +1804
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Align wording with house style; tighten description; consider relocating under tidb_opt_ block*

  • Use “New in v9.0.0”, “Persists to cluster”, “Applies to hint [SET_VAR]”, type “Float”, and label “Range” to match conventions.
  • Prefer the stronger “It is NOT recommended to modify this variable.” used elsewhere.
  • Optional: Move this entry down to the tidb_opt_* section to keep variables grouped consistently.
-### `tidb_opt_selectivity_factor` <span class="version-mark">Introduced in v9.0.0</span>
+### `tidb_opt_selectivity_factor` <span class="version-mark">New in v9.0.0</span>
 
 - Scope: SESSION | GLOBAL
-- Persist to cluster: Yes
-- Controlled by hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
-- Type: Floating-point number
-- Value range: `[0, 1]`
+- Persists to cluster: Yes
+- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
+- Type: Float
+- Range: `[0, 1]`
 - Default value: `0.8`
-- This variable specifies the default selectivity of the TiDB optimizer. In some cases, when the optimizer cannot derive the predicate selectivity based on statistics, the optimizer uses this default selectivity as an alternative value. **We do not recommend** modifying this value.
+- Specifies the default predicate selectivity the optimizer uses when statistics cannot estimate selectivity (for example, complex expressions or missing stats). Lower values assume more selective predicates and influence cardinality estimates and plan choices. It is NOT recommended to modify this value; instead, prefer improving statistics collection.

To ensure no duplicate entries slipped in, please run:


🏁 Script executed:

#!/bin/bash
rg -n "tidb_opt_selectivity_factor" system-variables.md -C2

Length of output: 436


I need to verify whether the suggested conventions in the review comment actually match the file's established style. Let me check the documentation patterns:


🏁 Script executed:

#!/bin/bash
# Check patterns for version markers, type labels, and attribute naming
rg -n "Introduced in|New in" system-variables.md | head -20
rg -n "Persist|Persists" system-variables.md | head -20
rg -n "Floating-point|Float|Integer|Boolean" system-variables.md | head -20
rg -n "Value range|Range:" system-variables.md | head -20
rg -n "Controlled by hint|Applies to hint" system-variables.md | head -20

Length of output: 299



---

🏁 Script executed:

```shell
#!/bin/bash
# Locate the file
fd -t f "system-variables.md" 

Length of output: 19


🏁 Script executed:

#!/bin/bash
# Check patterns for version markers, type labels, and attribute naming
echo "=== Version markers ==="
rg -n "Introduced in|New in" system-variables.md | head -10

echo ""
echo "=== Persist/Persists usage ==="
rg -n "Persist to cluster|Persists to cluster" system-variables.md | head -10

echo ""
echo "=== Type labels ==="
rg -n "Type:.*Floating-point|Type:.*Float|Type:.*Integer|Type:.*Boolean" system-variables.md | head -10

echo ""
echo "=== Range labels ==="
rg -n "Value range|^- Range:" system-variables.md | head -10

echo ""
echo "=== Hint references ==="
rg -n "Controlled by hint|Applies to hint" system-variables.md | head -10

Length of output: 4040


🏁 Script executed:

#!/bin/bash
# Search more broadly for type labels including Floating-point
echo "=== All Floating-point type labels ==="
rg -n "Type: Floating-point" system-variables.md

echo ""
echo "=== All Float type labels ==="
rg -n "Type: Float" system-variables.md

echo ""
echo "=== Find tidb_opt_ variables ==="
rg -n "tidb_opt_" system-variables.md | head -20

echo ""
echo "=== Recommendation phrasing patterns ==="
rg -n "NOT recommended|do not recommend|We do not recommend|It is NOT" system-variables.md | head -10

Length of output: 4273


Fix style inconsistencies: use "New", "Persists to cluster", "Applies to hint", "Float", "Range", and "It is NOT recommended"

Multiple attributes do not match established file conventions:

  • Version marker: "Introduced in" should be "New in" (see lines 55, 64, 74, etc.)
  • Persist attribute: "Persist to cluster" should be "Persists to cluster" (see lines 58, 67, 77, etc.)
  • Hint attribute: "Controlled by hint" should be "Applies to hint" (see lines 59, 68, 78, etc.)
  • Type: "Floating-point number" should be "Float" (see line 1260, 1810, 3454, and 40+ other occurrences)
  • Attribute: "Value range" should be "Range" (see lines 117, 127, 146, etc.)
  • Recommendation: "We do not recommend" should be "It is NOT recommended" (see lines 339, 371, 2334, etc.)

Optional: Move this entry to the tidb_opt_* variables section around line 4153 for consistency with other optimizer settings.

-### `tidb_opt_selectivity_factor` <span class="version-mark">Introduced in v9.0.0</span>
+### `tidb_opt_selectivity_factor` <span class="version-mark">New in v9.0.0</span>
 
 - Scope: SESSION | GLOBAL
-- Persist to cluster: Yes
-- Controlled by hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
-- Type: Floating-point number
-- Value range: `[0, 1]`
+- Persists to cluster: Yes
+- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): Yes
+- Type: Float
+- Range: `[0, 1]`
 - Default value: `0.8`
-- This variable specifies the default selectivity of the TiDB optimizer. In some cases, when the optimizer cannot derive the predicate selectivity based on statistics, the optimizer uses this default selectivity as an alternative value. **We do not recommend** modifying this value.
+- This variable specifies the default selectivity of the TiDB optimizer. In some cases, when the optimizer cannot derive the predicate selectivity based on statistics, the optimizer uses this default selectivity as an alternative value. **It is NOT recommended** to modify this value.

### tidb_default_string_match_selectivity <span class="version-mark">New in v6.2.0</span>

- Scope: SESSION | GLOBAL
Expand Down
Loading