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
sdojjy committed Feb 22, 2024
2 parents bbde68c + ea6fc6b commit bad815a
Show file tree
Hide file tree
Showing 80 changed files with 2,996 additions and 234 deletions.
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)
- [ ] v8.0 (TiDB 8.0 versions)
- [ ] v7.6 (TiDB 7.6 versions)
- [ ] v7.5 (TiDB 7.5 versions)
- [ ] v7.4 (TiDB 7.4 versions)
- [ ] v7.3 (TiDB 7.3 versions)
- [ ] v7.1 (TiDB 7.1 versions)
- [ ] v6.5 (TiDB 6.5 versions)
- [ ] v6.1 (TiDB 6.1 versions)
Expand Down
Binary file modified .vaunt/1st_place.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions .vaunt/add-tidb-docs-dash-badge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 如何在你的 GitHub 个人资料页上添加 TiDB 文档挑战赛徽章

[GitHub 个人资料页](https://docs.github.com/zh/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/about-your-profile)不仅仅是你的 GitHub 仓库的集合,更是你在编程领域中的专业身份标志。

本指南介绍如何在你的 GitHub 个人资料页上添加 [2024 TiDB 文档挑战赛](https://asktug.com/t/topic/1019364) (TiDB Docs Dash) 活动徽章。

## 第 1 步:创建一个仓库,存放个人资料 README

如果你已经配置了 GitHub 个人资料 README,请跳过以下步骤,直接进入[第 2 步:编辑个人资料 README](#第-2-步编辑个人资料-readme)

1. 在 GitHub 任一页面的右上角,点击 **+**,然后点击 **New repository**

<img src="https://docs.github.com/assets/cb-34248/mw-1440/images/help/repository/repo-create-global-nav-update.webp" width="350" />

2. 以你的 GitHub 用户名命名该仓库。例如,如果你的用户名为 `ilovetidb`,则仓库名必须为 `ilovetidb`
3. 选择 **Public** 将该仓库设置为公共可见。
4.**Initialize this repository with:** 下面,选择 **Add a README file**
5. 点击 **Create repository**

## 第 2 步:编辑个人资料 README

1. 在你的 `<github_username>` 仓库的 GitHub 页面上,点击右侧边栏上方的 **Edit README**
2. 在 README 文件中添加以下代码,并将 `{{github_username}}` 替换为你的 GitHub 用户名,然后提交更改。

```HTML
<p>
<img src="https://api.vaunt.dev/v1/github/entities/{{github_username}}/achievements?format=svg&limit=3" width="350" />
</p>
```

此时,刷新你的 GitHub 个人资料页,即可看到 TiDB Docs Dash 活动徽章。

关于如何管理个人资料 README 的更多信息,请参阅 [GitHub 文档](https://docs.github.com/zh/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme)。

## (可选)通过 Vaunt 添加更多展示

本次 TiDB 文档挑战赛的徽章是通过 [Vaunt](https://vaunt.dev/) 授予的,Vaunt 是一个开发者关系平台,旨在赋能和发展开发者社区。

通过 Vaunt 提供的以下功能,你还可以在你的个人资料 README 中展示你在其它开源项目中做出的贡献:

- 集成你的 developer card 到个人资料 README

示例卡片:

<p>
<a href="https://vaunt.dev">
<img src="https://api.vaunt.dev/v1/github/entities/jeff1010322/contributions?format=svg" width="350" />
</a>
</p>

如需集成你的 developer card,请将以下代码添加到你的 README 文件中,并将 `{{github_username}}` 替换为你的用户名。

```HTML
<p>
<a href="https://vaunt.dev">
<img src="https://api.vaunt.dev/v1/github/entities/{{github_username}}/contributions?format=svg" width="350" />
</a>
</p>
```

- 集成你的社区贡献看板到个人资料 README

社区贡献看板通过视图的形式,可以综合展示你在 GitHub 各个仓库的贡献统计数据。

[![VauntCommunity](https://api.vaunt.dev/v1/github/entities/pingcap/badges/community)](https://community.vaunt.dev/board/pingcap)

- 查看[你的社区看板](https://community.vaunt.dev/)。
- 如需集成你的社区看板,请将以下代码添加到你的 README 文件中,并将 `{{github_username}}` 替换为你的 GitHub 用户名:

```Markdown
[![VauntCommunity](https://api.vaunt.dev/v1/github/entities/{{github_username}}/badges/community)](https://community.vaunt.dev/board/{{github_username}})
```
1 change: 0 additions & 1 deletion .vaunt/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ actions:
action: pull_request
condition:
"created_at >= 01-09-2024 08:00:00 & created_at <= 01-12-2024 07:59:00
& merged = true & merged_at <= 2024-02-01 20:00:00
& labels in {'contribution','tidb-docs-dash-bonus'}"
value: 20
achievements:
Expand Down
Binary file modified .vaunt/contributor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
| [`release-7.6`](https://github.com/pingcap/docs-cn/tree/release-7.6) | 7.6 开发里程碑版 (DMR) |
| [`release-7.5`](https://github.com/pingcap/docs-cn/tree/release-7.5) | 7.5 长期支持版 (LTS) |
| [`release-7.4`](https://github.com/pingcap/docs-cn/tree/release-7.4) | 7.4 开发里程碑版 (DMR) |
| [`release-7.3`](https://github.com/pingcap/docs-cn/tree/release-7.3) | 7.3 开发里程碑版 (DMR) |
| [`release-7.3`](https://github.com/pingcap/docs-cn/tree/release-7.3) | 7.3 开发里程碑版 (DMR) (该版本文档已归档,不再提供任何更新)|
| [`release-7.2`](https://github.com/pingcap/docs-cn/tree/release-7.2) | 7.2 开发里程碑版 (DMR)(该版本文档已归档,不再提供任何更新) |
| [`release-7.1`](https://github.com/pingcap/docs-cn/tree/release-7.1) | 7.1 长期支持版 (LTS) |
| [`release-7.0`](https://github.com/pingcap/docs-cn/tree/release-7.0) | 7.0 开发里程碑版 (DMR)(该版本文档已归档,不再提供任何更新) |
Expand Down
9 changes: 9 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@
- [node-mysql2](/develop/dev-guide-sample-application-nodejs-mysql2.md)
- [mysql.js](/develop/dev-guide-sample-application-nodejs-mysqljs.md)
- [Prisma](/develop/dev-guide-sample-application-nodejs-prisma.md)
- [Sequelize](/develop/dev-guide-sample-application-nodejs-sequelize.md)
- [TypeORM](/develop/dev-guide-sample-application-nodejs-typeorm.md)
- [Next.js](/develop/dev-guide-sample-application-nextjs.md)
- [AWS Lambda](/develop/dev-guide-sample-application-aws-lambda.md)
- Ruby
- [mysql2](/develop/dev-guide-sample-application-ruby-mysql2.md)
- [Rails](/develop/dev-guide-sample-application-ruby-rails.md)
- 连接到 TiDB
- GUI 数据库工具
- [MySQL Workbench](/develop/dev-guide-gui-mysql-workbench.md)
- [Navicat](/develop/dev-guide-gui-navicat.md)
- [选择驱动或 ORM 框架](/develop/dev-guide-choose-driver-or-orm.md)
- [连接到 TiDB](/develop/dev-guide-connect-to-tidb.md)
- [连接池与连接参数](/develop/dev-guide-connection-parameters.md)
Expand Down Expand Up @@ -129,6 +135,7 @@
- [从大数据量 MySQL 迁移数据到 TiDB](/migrate-large-mysql-to-tidb.md)
- [从小数据量分库分表 MySQL 合并迁移数据到 TiDB](/migrate-small-mysql-shards-to-tidb.md)
- [从大数据量分库分表 MySQL 合并迁移数据到 TiDB](/migrate-large-mysql-shards-to-tidb.md)
- [从 MariaDB 迁移数据到 TiDB](/migrate-from-mariadb.md)
- [从 CSV 文件迁移数据到 TiDB](/migrate-from-csv-files-to-tidb.md)
- [从 SQL 文件迁移数据到 TiDB](/migrate-from-sql-files-to-tidb.md)
- [从 Parquet 文件迁移数据到 TiDB](/migrate-from-parquet-files-to-tidb.md)
Expand Down Expand Up @@ -653,6 +660,7 @@
- [TiDB 分布式执行框架介绍](/tidb-distributed-execution-framework.md)
- [TiDB 全局排序](/tidb-global-sort.md)
- [系统变量](/system-variables.md)
- [服务器状态变量](/status-variables.md)
- 配置文件参数
- [tidb-server](/tidb-configuration-file.md)
- [tikv-server](/tikv-configuration-file.md)
Expand Down Expand Up @@ -1047,6 +1055,7 @@
- v6.6
- [6.6.0-DMR](/releases/release-6.6.0.md)
- v6.5
- [6.5.8](/releases/release-6.5.8.md)
- [6.5.7](/releases/release-6.5.7.md)
- [6.5.6](/releases/release-6.5.6.md)
- [6.5.5](/releases/release-6.5.5.md)
Expand Down
9 changes: 7 additions & 2 deletions best-practices/java-app-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ aliases: ['/docs-cn/dev/best-practices/java-app-best-practices/','/docs-cn/dev/r
- 网络协议:客户端通过标准 [MySQL 协议](https://dev.mysql.com/doc/dev/mysql-server/latest/PAGE_PROTOCOL.html)和 TiDB 进行网络交互。
- JDBC API 及实现:Java 应用通常使用 [JDBC (Java Database Connectivity)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) 来访问数据库。JDBC 定义了访问数据库 API,而 JDBC 实现完成标准 API 到 MySQL 协议的转换,常见的 JDBC 实现是 [MySQL Connector/J](https://github.com/mysql/mysql-connector-j),此外有些用户可能使用 [MariaDB Connector/J](https://mariadb.com/kb/en/library/about-mariadb-connector-j/#about-mariadb-connectorj)
- 数据库连接池:为了避免每次创建连接,通常应用会选择使用数据库连接池来复用连接,JDBC [DataSource](https://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html) 定义了连接池 API,开发者可根据实际需求选择使用某种开源连接池实现。
- 数据访问框架:应用通常选择通过数据访问框架 ([MyBatis](http://www.mybatis.org/mybatis-3/zh/index.html), [Hibernate](https://hibernate.org/)) 的封装来进一步简化和管理数据库访问操作。
- 数据访问框架:应用通常选择通过数据访问框架 ([MyBatis](https://mybatis.org/mybatis-3/zh_CN/index.html), [Hibernate](https://hibernate.org/)) 的封装来进一步简化和管理数据库访问操作。
- 业务实现:业务逻辑控制着何时发送和发送什么指令到数据库,其中有些业务会使用 [Spring Transaction](https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/transaction.html) 切面来控制管理事务的开始和提交逻辑。

![Java Component](/media/best-practices/java-practice-1.png)
Expand Down Expand Up @@ -200,7 +200,12 @@ Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/Hik

### 探活配置

连接池维护到 TiDB 的长连接,TiDB 默认不会主动关闭客户端连接(除非报错),但一般客户端到 TiDB 之间还会有 LVS 或 HAProxy 之类的网络代理,它们通常会在连接空闲一定时间(由代理的 idle 配置决定)后主动清理连接。除了注意代理的 idle 配置外,连接池还需要进行保活或探测连接。
连接池维护客户端到 TiDB 的长连接的方式如下:

- v5.4 版本前,TiDB 默认不会主动关闭客户端连接,除非出现报错情况。
- 从 v5.4 起,TiDB 默认会在连接空闲超过 `28800` 秒(即 8 小时)后,自动关闭客户端连接。你可以使用 TiDB 与 MySQL 兼容的 `wait_timeout` 变量控制此超时时间,详见 [JDBC 查询超时](/develop/dev-guide-timeouts-in-tidb.md#jdbc-查询超时)文档。

此外,客户端到 TiDB 之间通常还会有 [LVS](https://en.wikipedia.org/wiki/Linux_Virtual_Server)[HAProxy](https://en.wikipedia.org/wiki/HAProxy) 之类的网络代理。这些代理通常会在连接空闲超过特定时间(由代理的 idle 配置决定)后主动清理连接。除了关注代理的 idle 配置外,连接池还需要进行保活或探测连接。

如果常在 Java 应用中看到以下错误:

Expand Down
6 changes: 4 additions & 2 deletions character-set-and-collation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ SELECT 'A' = 'a';
1 row in set (0.00 sec)
```

TiDB 默认使用二进制排序规则。这一点与 MySQL 不同,MySQL 默认使用不区分大小写的排序规则。

## 支持的字符集和排序规则

目前 TiDB 支持以下字符集:
Expand Down Expand Up @@ -116,6 +114,10 @@ SHOW COLLATION;
> **注意:**
>
> TiDB 中的默认排序规则(后缀为 `_bin` 的二进制排序规则)与 [MySQL 中的默认排序规则](https://dev.mysql.com/doc/refman/8.0/en/charset-charsets.html)不同,后者通常是一般排序规则,后缀为 `_general_ci``_ai_ci`。当用户指定了显式字符集,但依赖于待选的隐式默认排序规则时,这个差异可能导致兼容性问题。
> 在 TiDB 中,默认的排序规则也受到客户端的[连接排序规则](https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html#charset-connection-system-variables)设置的影响。例如,MySQL 8.x 客户端默认使用 `utf8mb4_0900_ai_ci` 作为 `utf8mb4` 字符集的连接排序规则。
>
> - 在 TiDB v7.4.0 之前,如果客户端使用 `utf8mb4_0900_ai_ci` 作为[连接排序规则](https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html#charset-connection-system-variables),因为 TiDB 不支持 `utf8mb4_0900_ai_ci` 排序规则,TiDB 将回退到使用 TiDB 服务器默认的排序规则 `utf8mb4_bin`
> - 从 v7.4.0 开始,如果客户端使用 `utf8mb4_0900_ai_ci` 作为[连接排序规则](https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html#charset-connection-system-variables),TiDB 将遵循客户端的配置,使用 `utf8mb4_0900_ai_ci` 作为默认排序规则。
利用以下的语句可以查看字符集对应的排序规则(以下是[新的排序规则框架](#新框架下的排序规则支持))下的结果:

Expand Down
9 changes: 5 additions & 4 deletions configure-placement-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Placement Rules 特性在 TiDB v5.0 及以上的版本中默认开启。如需
enable-placement-rules = true
```

这样,PD 在初始化成功后会开启这个特性,并根据 `max-replicas``location-labels` 配置生成对应的规则:
这样,PD 在初始化成功后会开启这个特性,并根据 [`max-replicas`](/pd-configuration-file.md#max-replicas)[`location-labels`](/pd-configuration-file.md#location-labels)[`isolation-level`](/pd-configuration-file.md#isolation-level) 配置生成对应的规则:

{{< copyable "" >}}

Expand All @@ -107,11 +107,12 @@ enable-placement-rules = true
pd-ctl config placement-rules enable
```

PD 同样将根据系统的 `max-replicas``location-labels` 生成默认的规则。
PD 同样将根据系统的 `max-replicas``location-labels``isolation-level` 生成默认的规则。

> **注意:**
>
> 开启 Placement Rules 后,原先的 `max-replicas``location-labels` 配置项将不再生效。如果需要调整副本策略,应当使用 Placement Rules 相关接口。
> - 开启 Placement Rules 且存在多条 rule 的情况下,原先的 `max-replicas``location-labels``isolation-level` 配置项将不再生效。如果需要调整副本策略,应当使用 Placement Rules 相关接口。
> - 开启 Placement Rules 且只存在一条默认的 rule 的情况下,当改变 `max-replicas``location-labels``isolation-level` 配置项时,系统会自动更新这条默认的 rule。
### 关闭 Placement Rules 特性

Expand All @@ -125,7 +126,7 @@ pd-ctl config placement-rules disable

> **注意:**
>
> 关闭 Placement Rules 后,PD 将使用原先的 `max-replicas``location-labels` 配置。在 Placement Rules 开启期间对 Rule 的修改不会导致这两项配置的同步更新。此外,设置好的所有 Rule 都会保留在系统中,会在下次开启 Placement Rules 时被使用。
> 关闭 Placement Rules 后,PD 将使用原先的 `max-replicas``location-labels``isolation-level` 配置。在 Placement Rules 开启期间对 Rule 的修改不会导致这三项配置的同步更新。此外,设置好的所有 Rule 都会保留在系统中,会在下次开启 Placement Rules 时被使用。
### 使用 pd-ctl 设置规则

Expand Down
7 changes: 6 additions & 1 deletion develop/dev-guide-connection-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ Java 的连接池实现很多 ([HikariCP](https://github.com/brettwooldridge/Hik

### 探活配置

连接池维护到 TiDB 的长连接,TiDB 默认不会主动关闭客户端连接(除非报错),但一般客户端到 TiDB 之间还会有 [LVS](https://en.wikipedia.org/wiki/Linux_Virtual_Server)[HAProxy](https://en.wikipedia.org/wiki/HAProxy) 之类的网络代理,它们通常会在连接空闲一定时间后主动清理连接。除了注意代理的 idle 配置外,连接池还需要进行保活或探测连接。
连接池维护客户端到 TiDB 的长连接的方式如下:

- v5.4 版本前,TiDB 默认不会主动关闭客户端连接,除非出现报错情况。
- 从 v5.4 起,TiDB 默认会在连接空闲超过 `28800` 秒(即 8 小时)后,自动关闭客户端连接。你可以使用 TiDB 与 MySQL 兼容的 `wait_timeout` 变量控制此超时时间,详见 [JDBC 查询超时](/develop/dev-guide-timeouts-in-tidb.md#jdbc-查询超时)文档。

此外,客户端到 TiDB 之间通常还会有 [LVS](https://en.wikipedia.org/wiki/Linux_Virtual_Server)[HAProxy](https://en.wikipedia.org/wiki/HAProxy) 之类的网络代理。这些代理通常会在连接空闲超过特定时间(由代理的 idle 配置决定)后主动清理连接。除了关注代理的 idle 配置外,连接池还需要进行保活或探测连接。

如果常在 Java 应用中看到以下错误:

Expand Down
Loading

0 comments on commit bad815a

Please sign in to comment.