Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
qqqdan committed Apr 6, 2023
2 parents 004b4c3 + f27485b commit 527def7
Show file tree
Hide file tree
Showing 43 changed files with 1,326 additions and 498 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask TiDB User Group Forum (Chinese)
url: https://asktug.com/
about: Ask a question on the TiDB user group (Chinese).
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ By default, **CHOOSE MASTER ONLY** so your changes will be applied to the next T
For details, see [tips for choosing the affected versions (in Chinese)](https://github.com/pingcap/docs-cn/blob/master/CONTRIBUTING.md#版本选择指南).

- [ ] master (the latest development version)
- [ ] v7.1 (TiDB 7.1 versions)
- [ ] v7.0 (TiDB 7.0 versions)
- [ ] v6.6 (TiDB 6.6 versions)
- [ ] v6.5 (TiDB 6.5 versions)
- [ ] v6.4 (TiDB 6.4 versions)
- [ ] v6.1 (TiDB 6.1 versions)
- [ ] v5.4 (TiDB 5.4 versions)
- [ ] v5.3 (TiDB 5.3 versions)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
id: extract
shell: bash
run: |
echo "::set-output name=sha::$(sha=${{ github.sha }}; echo ${sha:0:6})"
echo "sha=$(sha=${{ github.sha }}; echo ${sha:0:6})" >> $GITHUB_OUTPUT
- name: trigger docs-staging workflow
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/link-fail-fast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
id: changed-files
run: |
CHANGED_FILES=$(git diff-tree --name-only --diff-filter 'AM' -r HEAD^1 HEAD -- "*.md" | sed -z "s/\n$//;s/\n/' '/g")
echo "::set-output name=all_changed_files::${CHANGED_FILES}"
echo "all_changed_files=${CHANGED_FILES}" >> $GITHUB_OUTPUT
- name: Download Exclude Path
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/link.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Create Issue From File
uses: peter-evans/create-issue-from-file@v3
uses: peter-evans/create-issue-from-file@v4
with:
title: Broken Link Detected
content-filepath: out.md
assignees: TomShawn

# - name: Fail if there were link errors
# run: exit ${{ steps.lychee.outputs.exit_code }}
602 changes: 401 additions & 201 deletions LICENSE

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
| 文档仓库 branch | 对应 TiDB 文档版本 |
|:---------|:----------|
| [`master`](https://github.com/pingcap/docs-cn/tree/master) | dev 最新开发版 |
| [`release-7.0`](https://github.com/pingcap/docs-cn/tree/release-7.0) | 7.0 开发里程碑版 (DMR) |
| [`release-6.6`](https://github.com/pingcap/docs-cn/tree/release-6.6) | 6.6 开发里程碑版 (DMR) |
| [`release-6.5`](https://github.com/pingcap/docs-cn/tree/release-6.5) | 6.5 长期支持版 (LTS) |
| [`release-6.4`](https://github.com/pingcap/docs-cn/tree/release-6.4) | 6.4 开发里程碑版 (DMR) |
| [`release-6.3`](https://github.com/pingcap/docs-cn/tree/release-6.3) | 6.3 开发里程碑版 (DMR) |
| [`release-6.2`](https://github.com/pingcap/docs-cn/tree/release-6.2) | 6.2 开发里程碑版 (DMR) |
| [`release-6.1`](https://github.com/pingcap/docs-cn/tree/release-6.1) | 6.1 长期支持版 (LTS) |
Expand All @@ -36,3 +40,7 @@
## 贡献者数量增长图

[![Contributor over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=pingcap/docs-cn)](https://www.apiseven.com/en/contributor-graph?chart=contributorOverTime&repo=pingcap/docs-cn)

## License

自 TiDB v7.0 起,所有文档的许可证均为 [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)
4 changes: 3 additions & 1 deletion TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- [文档中心](https://docs.pingcap.com/zh)
- 关于 TiDB
- [TiDB 简介](/overview.md)
- [TiDB 6.6 Release Notes](/releases/release-6.6.0.md)
- [TiDB 7.0 Release Notes](/releases/release-7.0.0.md)
- [功能概览](/basic-features.md)
- [与 MySQL 的兼容性](/mysql-compatibility.md)
- [使用限制](/tidb-limitations.md)
Expand Down Expand Up @@ -984,6 +984,8 @@
- [版本发布时间线](/releases/release-timeline.md)
- [TiDB 版本规则](/releases/versioning.md)
- [TiDB 离线包](/binary-package.md)
- v7.0
- [7.0.0-DMR](/releases/release-7.0.0.md)
- v6.6
- [6.6.0-DMR](/releases/release-6.6.0.md)
- v6.5
Expand Down
358 changes: 183 additions & 175 deletions basic-features.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion best-practices/java-app-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ TiDB 提供两个与 MySQL 兼容的超时控制参数,`wait_timeout` 和 `max

TiDB (MySQL) 连接建立是比较昂贵的操作(至少对于 OLTP),除了建立 TCP 连接外还需要进行连接鉴权操作,所以客户端通常会把 TiDB (MySQL) 连接保存到连接池中进行复用。

Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/HikariCP), [tomcat-jdbc](https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html), [druid](https://github.com/alibaba/druid), [c3p0](https://www.mchange.com/projects/c3p0/), [dbcp](https://commons.apache.org/proper/commons-dbcp/)),TiDB 不会限定使用的连接池,应用可以根据业务特点自行选择连接池实现。
Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/HikariCP), [tomcat-jdbc](https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html), [druid](https://github.com/alibaba/druid), [c3p0](https://www.mchange.com/projects/c3p0/), [dbcp](https://commons.apache.org/proper/commons-dbcp/)),TiDB 不会限定使用的连接池,应用可以根据业务特点自行选择连接池实现。

### 连接数配置

Expand Down
6 changes: 3 additions & 3 deletions br/backup-and-restore-use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ aliases: ['/docs-cn/dev/br/backup-and-restore-use-cases/','/docs-cn/dev/referenc

## 部署 TiDB 集群和 br 命令行工具

使用 PITR 功能,需要部署 v6.2.0 或以上版本的 TiDB 集群,并且更新 br 命令行工具到与 TiDB 集群相同的版本,本文假设使用的是 v6.6.0 版本。
使用 PITR 功能,需要部署 v6.2.0 或以上版本的 TiDB 集群,并且更新 br 命令行工具到与 TiDB 集群相同的版本,本文假设使用的是 v7.0.0 版本。

下表介绍了在 TiDB 集群中使用日志备份功能的推荐配置。

Expand All @@ -44,13 +44,13 @@ aliases: ['/docs-cn/dev/br/backup-and-restore-use-cases/','/docs-cn/dev/referenc
- 安装:

```shell
tiup install br:v6.6.0
tiup install br:v7.0.0
```

- 升级:

```shell
tiup update br:v6.6.0
tiup update br:v7.0.0
```

## 配置备份存储 (Amazon S3)
Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-connection-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ aliases: ['/zh/tidb/dev/connection-parameters']

TiDB (MySQL) 连接建立是比较昂贵的操作(至少对于 OLTP 来讲),除了建立 TCP 连接外还需要进行连接鉴权操作,所以客户端通常会把 TiDB (MySQL) 连接保存到连接池中进行复用。

Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/HikariCP), [tomcat-jdbc](https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html), [durid](https://github.com/alibaba/druid), [c3p0](https://www.mchange.com/projects/c3p0/), [dbcp](https://commons.apache.org/proper/commons-dbcp/)),TiDB 不会限定使用的连接池,应用可以根据业务特点自行选择连接池实现。
Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/HikariCP), [tomcat-jdbc](https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html), [durid](https://github.com/alibaba/druid), [c3p0](https://www.mchange.com/projects/c3p0/), [dbcp](https://commons.apache.org/proper/commons-dbcp/)),TiDB 不会限定使用的连接池,应用可以根据业务特点自行选择连接池实现。

### 连接数配置

Expand Down
2 changes: 1 addition & 1 deletion dm/quick-start-create-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ docker run --rm --name mysql-3307 -p 3307:3307 -e MYSQL_ALLOW_EMPTY_PASSWORD=tru
{{< copyable "shell-regular" >}}

```bash
wget https://download.pingcap.org/tidb-community-server-v6.6.0-linux-amd64.tar.gz
wget https://download.pingcap.org/tidb-community-server-v7.0.0-linux-amd64.tar.gz
tar -xzvf tidb-latest-linux-amd64.tar.gz
mv tidb-latest-linux-amd64/bin/tidb-server ./
./tidb-server -P 4000 --store mocktikv --log-file "./tidb.log" &
Expand Down
19 changes: 9 additions & 10 deletions faq/sql-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,23 @@ TiDB 中的 `SHOW PROCESSLIST` 与 MySQL 中的 `SHOW PROCESSLIST` 显示内容

TiDB 支持改变[全局](/system-variables.md#tidb_force_priority)或单个语句的优先级。优先级包括:

- HIGH_PRIORITY:该语句为高优先级语句,TiDB 在执行阶段会优先处理这条语句
- LOW_PRIORITY:该语句为低优先级语句,TiDB 在执行阶段会降低这条语句的优先级
- `HIGH_PRIORITY`:该语句为高优先级语句,TiDB 在执行阶段会优先处理这条语句
- `LOW_PRIORITY`:该语句为低优先级语句,TiDB 在执行阶段会降低这条语句的优先级
- `DELAYED`:该语句为正常优先级语句,TiDB 不强制改变这条语句的优先级,与 `tidb_force_priority` 设置为 `NO_PRIORITY` 相同

以上两种参数可以结合 TiDB 的 DML 语言进行使用,使用方法举例如下:

1. 通过在数据库中写 SQL 的方式来调整优先级:

{{< copyable "sql" >}}

```sql
select HIGH_PRIORITY | LOW_PRIORITY count(*) from table_name;
insert HIGH_PRIORITY | LOW_PRIORITY into table_name insert_values;
delete HIGH_PRIORITY | LOW_PRIORITY from table_name;
update HIGH_PRIORITY | LOW_PRIORITY table_reference set assignment_list where where_condition;
replace HIGH_PRIORITY | LOW_PRIORITY into table_name;
SELECT HIGH_PRIORITY | LOW_PRIORITY | DELAYED COUNT(*) FROM table_name;
INSERT HIGH_PRIORITY | LOW_PRIORITY | DELAYED INTO table_name insert_values;
DELETE HIGH_PRIORITY | LOW_PRIORITY | DELAYED FROM table_name;
UPDATE HIGH_PRIORITY | LOW_PRIORITY | DELAYED table_reference SET assignment_list WHERE where_condition;
REPLACE HIGH_PRIORITY | LOW_PRIORITY | DELAYED INTO table_name;
```

2. 全表扫会自动调整为低优先级,analyze 也是默认低优先级。
2. 全表扫会自动调整为低优先级,[`ANALYZE`](/sql-statements/sql-statement-analyze-table.md) 也是默认低优先级。

## 在 TiDB 中 auto analyze 的触发策略是怎样的?

Expand Down
20 changes: 15 additions & 5 deletions grafana-resource-control-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,36 @@ summary: 了解资源管控 (Resource Control) 的 Grafana Dashboard 中所展

如果你的集群配置了 [Resource Control](/tidb-resource-control.md) ,通过观察 Resource Control 面板上的 Metrics,你可以了解当前集群整体的资源消耗状态。

TiDB 使用[令牌桶算法](https://en.wikipedia.org/wiki/Token_bucket) 做流控,正如资源管控实现机制 ([RFC: Global Resource Control in TiDB](https://github.com/pingcap/tidb/blob/master/docs/design/2022-11-25-global-resource-control.md#distributed-token-buckets)) 中所描述:一个 TiDB 节点可能存在多个 Resource Group(资源组),将在 PD 端的 GAC(Global Admission Control)进行流控。每个 TiDB 节点中的本地令牌桶(Local Token Buckets)将定期(默认 5 秒)与 PD 端的 GAC 进行通信,以重新配置本地令牌。其中的本地令牌桶(Local Token Buckets)具体实现为 Resource Controller Client。

以下为 **Resource Control** 关键监控指标的说明。

## Request Unit 相关指标

- RU:以 Resource Group 为单位进行实时统计的 [Request Unit (RU)](/tidb-resource-control.md#什么是-request-unit-ru) 消耗信息。`total` 为当前所有 Resource Group 消耗的 Request Unit 之和。每个 Resource Group 的 Request Unit 消耗等于其读消耗 (Read Request Unit) 和写消耗 (Write Request Unit) 之和。
- RU:以 Resource Group(资源组)为单位进行实时统计的 [Request Unit (RU)](/tidb-resource-control.md#什么是-request-unit-ru) 消耗信息。`total` 为当前所有 Resource Group 消耗的 Request Unit 之和。每个 Resource Group 的 Request Unit 消耗等于其读消耗 (Read Request Unit) 和写消耗 (Write Request Unit) 之和。
- RU Per Query:平均每个 SQL 语句消耗的 Request Unit 数量。计算方法是将前述 Request Unit 监控指标除以当前每秒执行的 SQL 语句数量。
- RRU:以 Resource Group 为单位进行实时统计的读请求 Read Request Unit 消耗信息。`total` 为当前所有 Resource Group 消耗的 Read Request Unit 之和。
- RRU Per Query:平均每个 SQL 语句消耗的 Read Request Unit 数量。计算方法是将前述 Read Request Unit 监控指标除以当前每秒执行的 SQL 语句数量。
- WRU:以 Resource Group 为单位进行实时统计的写请求 Write Request Unit 消耗信息。`total` 为当前所有 Resource Group 消耗的 Write Request Unit 之和。
- WRU Per Query:平均每个 SQL 语句消耗的 Write Request Unit 数量。计算方法是将前述 Write Request Unit 监控指标除以当前每秒执行的 SQL 语句数量。

## 资源相关指标
## Resource 相关指标

- KV Request Count:以 Resource Group 为单位进行实时统计的 KV 请求数量,区分了读和写两种类型。`total` 为当前所有 Resource Group 涉及的 KV 请求数量之和。
- KV Request Count:以 Resource Group(资源组)为单位进行实时统计的 KV 请求数量,区分了读和写两种类型。`total` 为当前所有 Resource Group 涉及的 KV 请求数量之和。
- KV Request Count Per Query:平均每个 SQL 语句涉及的读写 KV 请求数量。计算方法是将前述 KV Request Count 监控指标除以当前每秒执行的 SQL 语句数量。
- Bytes Read:以 Resource Group 为单位进行实时统计的读取数据量。`total` 为当前所有 Resource Group 读取数据量之和。
- Bytes Read Per Query:平均每个 SQL 语句的读取数据量。将前述 Bytes Read 监控指标除以当前每秒执行的 SQL 语句数量。
- Bytes Written:以 Resource Group 为单位进行实时统计的写入数据量。`total` 为当前所有 Resource Group 写入数据量之和。
- Bytes Written Per Query:平均每个 SQL 语句的写入数据量。计算方法是将前述 Bytes Written 监控指标除以当前每秒执行的 SQL 语句数量。
- KV CPU Time:以 Resource Group 为单位进行实时统计的 KV 层 CPU 时间消耗。`total` 为当前所有 Resource Group 消耗 KV 层 CPU 时间之和。
- KV CPU Time Per Query:平均每个 SQL 语句的 KV 层 CPU 时间消耗之和。计算方法是将前述 KV CPU Time 监控指标除以当前每秒执行的 SQL 语句数量。
- SQL CPU Time:以 Resource Group 为单位进行实时统计的 SQL 层 CPU 时间消耗。`total` 为当前所有 Resource Group 消耗 SQL 层 CPU 时间之和。
- SQL CPU Time Per Query:平均每个 SQL 语句的 SQL 层 CPU 时间消耗之和。计算方法是将前述 SQL CPU Time 监控除以当前每秒执行的 SQL 语句数量。

## Resource Controller Client 相关指标

- Active Resource Groups:实时统计各个 Resource Controller Client 的 Resource Groups 数量。
- Total KV Request Count:以 Resource Group 为单位,实时统计各个 Resource Controller Client 的 KV 请求数量。`total` 为 Resource Controller Client 下 KV 请求数量之和。
- Failed KV Request Count:以 Resource Group 为单位,实时统计各个 Resource Controller Client 的 KV 失败请求数量。`total` 为 Resource Controller Client 下 KV 失败请求数量之和。
- Successful KV Request Count:以 Resource Group 为单位,实时统计各个 Resource Controller Client 的 KV 成功请求数量。`total` 为 Resource Controller Client 下 KV 成功请求数量之和。
- Successful KV Request Wait Duration (99/90):以 Resource Group 为单位,实时统计各个 Resource Controller Client 成功 KV 请求的等待时间(不同百分位)。
- Token Request Handle Duration (999/99):以 Resource Group 为单位,实时统计各个 Resource Controller Client 向 Server 端申请 Token 等待的响应时间(不同百分位)。
- Token Request Count:以 Resource Group 为单位,实时统计各个 Resource Controller Client 向 Server 端申请 Token 的次数。`successful``failed` 分别为 Resource Controller Client 下申请 Token 成功和失败数量之和。
Loading

0 comments on commit 527def7

Please sign in to comment.