-
Notifications
You must be signed in to change notification settings - Fork 0
test0329 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughA new documentation file has been added to explain common DDL issues in TiDB clusters. The document, titled "DDL 常见问题", details the concurrent DDL execution introduced in TiDB v6.2. It explains the conditions under which DDL statements can be executed concurrently, describes the distinction between general and reorg DDL statements, and outlines how the concurrency level is determined based on available CPU resources. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant DDL_Engine as TiDB DDL Engine
participant Scheduler as Concurrency Scheduler
Client->>DDL_Engine: Submit DDL statement
DDL_Engine->>Scheduler: Check correlation & type
alt Statements are correlated
Scheduler-->>DDL_Engine: Execute sequentially
else Statements are uncorrelated
alt General DDL
Scheduler-->>DDL_Engine: Execute with concurrency=1
else Reorg DDL
Scheduler-->>DDL_Engine: Compute concurrency based on CPU and execute concurrently
end
end
DDL_Engine-->>Client: Return execution result
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
/bot-review |
|
||
# DDL 常见问题 | ||
|
||
本文档介绍 TiDB 集群中常见的些 DDL 问题。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
句子表述不够通顺,建议修改措辞。
本文档介绍 TiDB 集群中常见的些 DDL 问题。 | |
本文档介绍 TiDB 集群中常见的 DDL 问题。 |
|
||
本文档介绍 TiDB 集群中常见的些 DDL 问题。 | ||
|
||
## TiDB DDL 是否支持 DDL 语句间并行?具体一些运行特征是怎样地? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
标题表述不够规范,建议修改为更专业的提问方式。
## TiDB DDL 是否支持 DDL 语句间并行?具体一些运行特征是怎样地? | |
## TiDB DDL 是否支持 DDL 语句间的并行执行?具体有哪些运行特征? |
|
||
## TiDB DDL 是否支持 DDL 语句间并行?具体一些运行特征是怎样地? | ||
|
||
在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
句子存在多处语病和错别字,建议全面修改。
在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: | |
从 TiDB v6.2 版本开始,TiDB 提供并发 DDL(Concurrent DDL)执行能力。并发 DDL 主要支持 DDL 语句间的并行执行。与之前的 DDL 执行相比,主要变化如下: |
|
||
在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: | ||
|
||
1. 需要判断 DDL 语句间是否有相关性,如果有相关性的 DDL 语句将会按照进入 TiDB 的顺序执行,没有相关性的 DDL 语句可以并发执行。并发判断规则: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
列表项描述不够清晰,建议补充说明相关性判断的具体标准。
1. 需要判断 DDL 语句间是否有相关性,如果有相关性的 DDL 语句将会按照进入 TiDB 的顺序执行,没有相关性的 DDL 语句可以并发执行。并发判断规则: | |
1. 需要判断 DDL 语句间是否存在相关性。有相关性的 DDL 语句将按照进入 TiDB 的顺序执行,无相关性的 DDL 语句可以并发执行。相关性判断规则如下: |
在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: | ||
|
||
1. 需要判断 DDL 语句间是否有相关性,如果有相关性的 DDL 语句将会按照进入 TiDB 的顺序执行,没有相关性的 DDL 语句可以并发执行。并发判断规则: | ||
1. 相同表上的 DDL 语句之间具有相关性,需要按照进入 TiDB 的顺序执行; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
表述不够严谨,建议明确说明"相同表"的范围。
1. 相同表上的 DDL 语句之间具有相关性,需要按照进入 TiDB 的顺序执行; | |
1. 对同一张表的 DDL 操作具有相关性,需要按顺序执行; |
1. 需要判断 DDL 语句间是否有相关性,如果有相关性的 DDL 语句将会按照进入 TiDB 的顺序执行,没有相关性的 DDL 语句可以并发执行。并发判断规则: | ||
1. 相同表上的 DDL 语句之间具有相关性,需要按照进入 TiDB 的顺序执行; | ||
2. 对于 Schema 上的操作,可能会对于 schema 中的表上的 DDL 语句建立相关性,目前 Drop Schema 会对于其包含 Schema 上的 DDL 产生相关性;也需要顺序执行; | ||
2. 是否所有的 DDL 语句都会并发执行? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提问方式不够专业,建议修改。
2. 是否所有的 DDL 语句都会并发执行? | |
2. 是否所有 DDL 语句都支持并发执行? |
2. 是否所有的 DDL 语句都会并发执行? | ||
当前,答案是否定的,在 TiDB 中 DDL 语句被分为两类, | ||
1. 普通(general)DDL 语句,这类 DDL 语句的执行只需要修改对象的元数据,不需要操作 schema 存储的数据,通常在秒级完成;需要的计算资源相对少; | ||
2. 需要重组(reorg)DDL 语句, 这类 DDL 语句的执行不仅需要修改对象的元数据,也需要对于 schema 存储的数据进行处理,例如:加索引,需要扫描全表数据,来创建索引,需要比较多的计算资源与较长的执行时间; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
术语使用不一致,建议统一使用"reorganize"。
2. 需要重组(reorg)DDL 语句, 这类 DDL 语句的执行不仅需要修改对象的元数据,也需要对于 schema 存储的数据进行处理,例如:加索引,需要扫描全表数据,来创建索引,需要比较多的计算资源与较长的执行时间; | |
2. 需要重组数据(reorganize)的 DDL 语句:这类 DDL 语句不仅需要修改元数据,还需要处理 schema 中存储的数据(例如创建索引需要扫描全表数据)。这类操作需要较多计算资源和较长的执行时间; |
当前,答案是否定的,在 TiDB 中 DDL 语句被分为两类, | ||
1. 普通(general)DDL 语句,这类 DDL 语句的执行只需要修改对象的元数据,不需要操作 schema 存储的数据,通常在秒级完成;需要的计算资源相对少; | ||
2. 需要重组(reorg)DDL 语句, 这类 DDL 语句的执行不仅需要修改对象的元数据,也需要对于 schema 存储的数据进行处理,例如:加索引,需要扫描全表数据,来创建索引,需要比较多的计算资源与较长的执行时间; | ||
当前我们仅对于需要重组的 DDL 语句启动了并发执行支持。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
表述不够准确,建议明确说明当前支持的范围。
当前我们仅对于需要重组的 DDL 语句启动了并发执行支持。 | |
目前仅支持需要重组数据的 DDL 语句的并发执行。 |
2. 需要重组(reorg)DDL 语句, 这类 DDL 语句的执行不仅需要修改对象的元数据,也需要对于 schema 存储的数据进行处理,例如:加索引,需要扫描全表数据,来创建索引,需要比较多的计算资源与较长的执行时间; | ||
当前我们仅对于需要重组的 DDL 语句启动了并发执行支持。 | ||
3. 对于启动了并发 DDL 语句支持的 TiDB 集群,DDL 语句间的并发度是如何确定的? | ||
目前因为 DDL 等后台任务的执行可能会占用相当的资源,因此我们采取了一个相对保守的策略来确定 DDL 语句执行的并发度 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
句子表述不够通顺,建议修改。
目前因为 DDL 等后台任务的执行可能会占用相当的资源,因此我们采取了一个相对保守的策略来确定 DDL 语句执行的并发度 | |
由于 DDL 等后台任务执行可能占用较多资源,因此采用了相对保守的并发度策略: |
目前因为 DDL 等后台任务的执行可能会占用相当的资源,因此我们采取了一个相对保守的策略来确定 DDL 语句执行的并发度 | ||
1. 对于普通 DDL(general DDL) 语句,我们当前语句并发度为 1(后续将会提供并发执行支持); | ||
2. 对于需要重组的 DDL(Reorg DDL)语句,我们的并发度设置规则如下(并发度不允许用户自己设置): | ||
TiDB DDL owner 节点容器能够使用的 CPU 资源数量的 1/4 与 1 之间的最大值,例如 8C 规格的 TiDB DDL owner 节点,并发度将会是 2。 No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
技术细节描述不够准确,建议补充计算公式。
TiDB DDL owner 节点容器能够使用的 CPU 资源数量的 1/4 与 1 之间的最大值,例如 8C 规格的 TiDB DDL owner 节点,并发度将会是 2。 | |
TiDB DDL owner 节点容器可用 CPU 核数的 1/4(向下取整)与 1 之间的最大值。例如 8 核的 TiDB DDL owner 节点,并发度为 2。 |
✅ AI review completed, 12 comments generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (6)
faq/ddl-faq-test3.md (6)
6-8
: Header and Introduction:
The main header on line 6 is clear. However, the sentence on line 8 could be slightly refined for natural readability. Consider changing:
- From: “本文档介绍 TiDB 集群中常见的些 DDL 问题。”
- To: “本文档介绍 TiDB 集群中一些常见的 DDL 问题。”
10-10
: Section Heading Clarity:
The section heading on line 10 clearly poses the question. For improved clarity, consider rephrasing “具体一些运行特征是怎样地?” to “具体的运行特征是什么?”
12-12
: Typo and Wording Correction:
Line 12 contains a few minor issues:
- The phrase “之后时” is redundant; “之后” is sufficient.
- “concurent DDL” should be corrected to “concurrent DDL.”
- “并发 DDL 主是” would be clearer as “并发 DDL 主要是.”
Below is a suggested diff to address these points:
-在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: +在 TiDB v6.2 之后,TiDB 提供并发 DDL(concurrent DDL)执行的能力。并发 DDL 主要提供 DDL 语句间的并发执行支持。与以往的 DDL 执行方式相比,其变化如下:
14-16
: DDL Correlation Rules Detail:
The explanation on lines 14–16 regarding how to judge the correlation between DDL statements is clear and adequately detailed. A minor rewording could improve flow, but the content itself is correct.
17-21
: Categorization of DDL Statements:
The document clearly differentiates between general and reorg DDL statements, which is valuable for readers. To further enhance understanding, you might consider adding specific examples for each category.
22-26
: Concurrency Level Determination Clarification:
The explanation of how the concurrency level is determined is informative. However, the phrase “CPU 资源数量的 1/4 与 1 之间的最大值” could be ambiguous. For better clarity, consider rephrasing it to something like:
“并发度为 max(1, CPU核心数/4)”
This notation clearly communicates the intended calculation.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
faq/ddl-faq-test3.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pull
🔇 Additional comments (1)
faq/ddl-faq-test3.md (1)
1-4
: YAML Front Matter Review:
The YAML front matter is well-formatted with clear title and summary fields. This sets a good context for the document.
/bot-review: a78d41a |
当前我们仅对于需要重组的 DDL 语句启动了并发执行支持。 | ||
3. 对于启动了并发 DDL 语句支持的 TiDB 集群,DDL 语句间的并发度是如何确定的? | ||
目前因为 DDL 等后台任务的执行可能会占用相当的资源,因此我们采取了一个相对保守的策略来确定 DDL 语句执行的并发度 | ||
1. 对于普通 DDL(general DDL) 语句,我们当前语句并发度是 1(后续将会提供并发执行支持); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改后的表述虽然更口语化,但技术文档建议保持一致性,建议保留原表述或采用更正式的表述方式。
1. 对于普通 DDL(general DDL) 语句,我们当前语句并发度是 1(后续将会提供并发执行支持); | |
1. 对于普通 DDL(general DDL)语句,当前语句并发度为 1(后续将会提供并发执行支持); |
✅ AI review completed, 1 comments generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (12)
faq/ddl-faq-test3.md (12)
1-4
: Front Matter Metadata Check
The front matter is correctly formatted with a title and summary. You may consider expanding the summary for added context, though it meets basic requirements.
12-12
: Correct Typographical and Language Errors
There are several issues on this line:
- Remove the extra "时" after "之后" (i.e., change "在 TiDB v6.2 之后时" to "在 TiDB v6.2 之后").
- Fix the typo "concurent" to "concurrent".
- Rephrase "并发 DDL 主是提供 DDL 语句间的并发执行支持" for clarity.
- Modify "这里和以前的 DDL 执将会发生如下变化" to a clearer form.
For example:
-在 TiDB v6.2 之后时,TiDB 提供并发 DDL(concurent DDL) 执行的能力。 并发 DDL 主是提供 DDL 语句间的并发执行支持。这里和以前的 DDL 执将会发生如下变化: +在 TiDB v6.2 之后,TiDB 提供并发 DDL(concurrent DDL)执行能力,即支持 DDL 语句间的并行执行。相比之前的 DDL 执行方式,其变化如下:
14-14
: Clarify Concurrency Check Rules
Consider refining the wording in this list item. For instance, use "无相关性的 DDL 语句" instead of "没有相关性的 DDL 语句" to improve clarity.
18-18
: Improve Punctuation and Structure
Enhance clarity by refining punctuation. For example, consider:答案是否定的。TiDB 中的 DDL 语句分为两类:
19-19
: Refine Resource Description for General DDL
Consider changing “需要的计算资源相对少” to “所需计算资源较少” for better clarity and readability.
20-20
: Clarify Description of Reorg DDL
This sentence is a bit convoluted. A revised version might be:需要重组(reorg)DDL 语句:这类语句不仅修改对象元数据,还需处理 schema 数据(例如,加索引时需进行全表扫描),因而需要更多计算资源和更长的执行时间;
21-21
: Simplify Execution Support Statement
Consider using “目前” in place of “当前” and rephrasing to:目前,仅对需要重组的 DDL 语句启用了并发执行支持。
22-22
: Refine the Concurrency Determination Question
Rephrase the query for better clarity. For example, you might use:对于启用了并发 DDL 支持的 TiDB 集群,如何确定 DDL 语句的并发度?
23-23
: Enhance Explanation on Concurrency Strategy
The explanation is generally clear; consider adding punctuation for improved readability.
24-24
: Rephrase Concurrency Level for General DDL
Consider rewording to:对于普通 DDL 语句,目前的并发度为 1(后续将支持并发执行)。
25-25
: Standardize Phrasing in Reorg DDL Concurrency Setting
Ensure consistent punctuation and phrasing throughout the list item. Clarifying the sentence will improve overall readability.
26-26
: Clarify CPU Resource Calculation
Specify the CPU resource clearly (e.g., "8C" should be rendered as "8 核" if referring to CPU cores) and streamline the sentence. For example:-TiDB DDL owner 节点容器能够使用的 CPU 资源数量的 1/4 与 1 之间的最大值,例如 8C 规格的 TiDB DDL owner 节点,并发度将会是 2. +TiDB DDL owner 节点可用 CPU 数量的 1/4 与 1 中的最大值。例如,8 核节点的并发度为 2.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
faq/ddl-faq-test3.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pull
🔇 Additional comments (5)
faq/ddl-faq-test3.md (5)
8-8
: Improve Sentence Clarity in Introduction
The sentence "本文档介绍 TiDB 集群中常见的些 DDL 问题。" contains an extra word ("些") that may be a typo. Consider revising it to:本文档介绍 TiDB 集群中常见的 DDL 问题。
10-10
: Refine Section Header
The header "## TiDB DDL 是否支持 DDL 语句间并行?具体一些运行特征是怎样地?" can be rephrased for clarity and professionalism. For example, consider:## TiDB DDL 是否支持 DDL 语句间的并行执行?具体有哪些运行特征?
15-15
: Define the Scope of "相同表"
Clarify what is meant by "相同表" (for example, specify whether it means“同一张表”) to avoid ambiguity.
16-16
: Reorganize and Clarify Schema Operation Description
The statement about Schema operations is a bit unclear. Consider revising it to something like:对于 Schema 级操作,可能会导致该 Schema 下所有表的 DDL 语句产生关联,因此需要按顺序执行;
17-17
: Refine the Execution Query
Rephrase the question slightly to maintain a professional tone. For example:是否所有 DDL 语句均支持并发执行?
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 (in Chinese).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?
Summary by CodeRabbit