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
hfxsd committed May 6, 2024
2 parents 47c69f8 + 705405a commit 4d28f9a
Show file tree
Hide file tree
Showing 48 changed files with 196 additions and 224 deletions.
3 changes: 3 additions & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,13 @@
- [目标数据库要求](/tidb-lightning/tidb-lightning-requirements.md)
- 数据源
- [文件匹配规则](/tidb-lightning/tidb-lightning-data-source.md)
- [表库重命名](/tidb-lightning/tidb-lightning-data-source.md#表库重命名)
- [CSV](/tidb-lightning/tidb-lightning-data-source.md#csv)
- [SQL](/tidb-lightning/tidb-lightning-data-source.md#sql)
- [Parquet](/tidb-lightning/tidb-lightning-data-source.md#parquet)
- [压缩文件](/tidb-lightning/tidb-lightning-data-source.md#压缩文件)
- [自定义文件匹配](/tidb-lightning/tidb-lightning-data-source.md#自定义文件匹配)
- [从 Amazon S3 导入数据](/tidb-lightning/tidb-lightning-data-source.md#从-amazon-s3-导入数据)
- 物理导入模式
- [概述](/tidb-lightning/tidb-lightning-physical-import-mode.md)
- [必要条件及限制](/tidb-lightning/tidb-lightning-physical-import-mode.md#必要条件及限制)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/dashboard-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-profiling/']
- Heap:TiDB、PD、TiKV 实例上各个内部函数的内存占用开销情况

> 从 v7.5 版本开始,支持获取 TiKV Heap Profile,并且需要 TiDB Dashboad 的运行环境中有 Perl 依赖,否则会报错。
> 从 v7.5 版本开始,支持获取 TiKV Heap Profile,并且需要 TiDB Dashboard 的运行环境中有 Perl 依赖,否则会报错。
- Mutex:TiDB、PD 实例上各个处于等待状态的 Mutex 情况

Expand Down
2 changes: 1 addition & 1 deletion dm/dm-open-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ curl -X 'GET' \
"name": "string",
"source_name": "string",
"worker_name": "string",
"stage": "runing",
"stage": "running",
"unit": "sync",
"unresolved_ddl_lock_id": "string",
"load_status": {
Expand Down
19 changes: 9 additions & 10 deletions enable-tls-between-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,17 @@ aliases: ['/docs-cn/dev/enable-tls-between-components/','/docs-cn/dev/how-to/sec

如希望进行组件调用者身份认证,需要在生证书时通过 `Common Name` 标识证书使用者身份,并在被调用者配置检查证书 `Common Name` 列表来检查调用者身份。

> **注意:**
>
> 目前 PD 的 `cert-allowed-cn` 配置项只能设置一个值。因此所有认证对象的 `commonName` 都要设置成同一个值。

- TiDB

在 `config` 文件或命令行参数中设置:

```toml
[security]
cluster-verify-cn = [
"TiDB-Server",
"TiKV-Control",
]
cluster-verify-cn = ["TiDB"]
```

- TiKV
Expand All @@ -157,9 +158,7 @@ aliases: ['/docs-cn/dev/enable-tls-between-components/','/docs-cn/dev/how-to/sec

```toml
[security]
cert-allowed-cn = [
"TiDB-Server", "PD-Server", "TiKV-Control", "RawKvClient1",
]
cert-allowed-cn = ["TiDB"]
```

- PD
Expand All @@ -168,7 +167,7 @@ aliases: ['/docs-cn/dev/enable-tls-between-components/','/docs-cn/dev/how-to/sec

```toml
[security]
cert-allowed-cn = ["TiKV-Server", "TiDB-Server", "PD-Control"]
cert-allowed-cn = ["TiDB"]
```

- TiFlash(从 v4.0.5 版本开始引入)
Expand All @@ -177,14 +176,14 @@ aliases: ['/docs-cn/dev/enable-tls-between-components/','/docs-cn/dev/how-to/sec

```toml
[security]
cert_allowed_cn = ["TiKV-Server", "TiDB-Server"]
cert_allowed_cn = ["TiDB"]
```

在 `tiflash-learner.toml` 文件中设置:

```toml
[security]
cert-allowed-cn = ["PD-Server", "TiKV-Server", "TiFlash-Server"]
cert-allowed-cn = ["TiDB"]
```

## 证书重新加载
Expand Down
2 changes: 1 addition & 1 deletion encryption-at-rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ TiFlash 当前支持的加密算法与 TiKV 一致,包括 AES128-CTR、AES192-

多个 TiFlash 实例可共用一个主密钥,并且也可以和 TiKV 共用一个主密钥。在生产环境中,推荐通过 AWS KMS 提供主密钥。另外,你也可以通过文件形式提供主密钥。具体的主密钥生成方式和格式均与 TiKV 相同。

TiFlash 使用数据密钥加密所有落盘的数据文件,包括数据文件、Schmea 文件和计算过程中产生的临时数据文件等。默认情况下,TiFlash 每周自动轮换数据密钥,该轮换周期也可根据需要自定义配置。密钥轮换时,TiFlash 不会重写全部现有文件来替换密钥,但如果集群的写入量恒定,则后台 compaction 任务将会用最新的数据密钥对数据重新加密。TiFlash 跟踪密钥和加密方法,并使用密钥信息对读取的内容进行解密。
TiFlash 使用数据密钥加密所有落盘的数据文件,包括数据文件、Schema 文件和计算过程中产生的临时数据文件等。默认情况下,TiFlash 每周自动轮换数据密钥,该轮换周期也可根据需要自定义配置。密钥轮换时,TiFlash 不会重写全部现有文件来替换密钥,但如果集群的写入量恒定,则后台 compaction 任务将会用最新的数据密钥对数据重新加密。TiFlash 跟踪密钥和加密方法,并使用密钥信息对读取的内容进行解密。

### 创建密钥

Expand Down
2 changes: 1 addition & 1 deletion faq/migration-tidb-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ DB2、Oracle 到 TiDB 数据迁移(增量+全量),通常做法有:

目前看来 OGG 最为合适。

### 用 Sqoop 批量写入 TiDB 数据,虽然配置了 `--batch` 选项,但还是会遇到 `java.sql.BatchUpdateExecption:statement count 5001 exceeds the transaction limitation` 的错误,该如何解决?
### 用 Sqoop 批量写入 TiDB 数据,虽然配置了 `--batch` 选项,但还是会遇到 `java.sql.BatchUpdateException:statement count 5001 exceeds the transaction limitation` 的错误,该如何解决?

- 在 Sqoop 中,`--batch` 是指每个批次提交 100 条 statement,但是默认每个 statement 包含 100 条 SQL 语句,所以此时 100 * 100 = 10000 条 SQL 语句,超出了 TiDB 的事务限制 5000 条,可以增加选项 `-Dsqoop.export.records.per.statement=10` 来解决这个问题,完整的用法如下:

Expand Down
2 changes: 1 addition & 1 deletion faq/sql-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ TiDB 支持在会话或全局作用域上修改 [`sql_mode`](/system-variables.m
- 对全局作用域变量的修改,设置后将作用于集群中的其它服务器,并且重启后更改依然有效。因此,你无需在每台 TiDB 服务器上都更改 `sql_mode` 的值。
- 对会话作用域变量的修改,设置后只影响当前会话,重启后更改消失。

## 用 Sqoop 批量写入 TiDB 数据,虽然配置了 `--batch` 选项,但还是会遇到 `java.sql.BatchUpdateExecption:statement count 5001 exceeds the transaction limitation` 的错误,该如何解决?
## 用 Sqoop 批量写入 TiDB 数据,虽然配置了 `--batch` 选项,但还是会遇到 `java.sql.BatchUpdateException:statement count 5001 exceeds the transaction limitation` 的错误,该如何解决?

问题原因:在 Sqoop 中,`--batch` 是指每个批次提交 100 条 statement,但是默认每个 statement 包含 100 条 SQL 语句,所以此时 100 * 100 = 10000 条 SQL 语句,超出了 TiDB 的事务限制 5000 条。

Expand Down
15 changes: 13 additions & 2 deletions functions-and-operators/bit-functions-and-operators.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: 位函数和操作符
aliases: ['/docs-cn/dev/functions-and-operators/bit-functions-and-operators/','/docs-cn/dev/reference/sql/functions-and-operators/bit-functions-and-operators/']
summary: TiDB 支持 MySQL 5.7 中的所有位函数和操作符,包括BIT_COUNT()、&、~、|、^、<<和>>。BIT_COUNT() 返回参数二进制表示中为 1 的个数,& 表示位与,~ 表示按位取反,| 表示位或,^ 表示位亦或,<< 表示左移,>> 表示右移
summary: TiDB 支持 MySQL 8.0 中的所有位函数和操作符。
---

# 位函数和操作符

TiDB 支持使用 MySQL 5.7 中提供的所有[位函数和操作符](https://dev.mysql.com/doc/refman/5.7/en/bit-functions.html)
TiDB 支持使用 MySQL 8.0 中提供的所有[位函数和操作符](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html)

**位函数和操作符表**

Expand All @@ -19,3 +19,14 @@ TiDB 支持使用 MySQL 5.7 中提供的所有[位函数和操作符](https://de
| [^](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_bitwise-xor) | 位亦或 |
| [<<](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_left-shift) | 左移 |
| [>>](https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#operator_right-shift) | 右移 |

## MySQL 兼容性

在处理位函数和操作符时,MySQL 8.0 与之前版本的 MySQL 之间存在一些差异。TiDB 旨在遵循 MySQL 8.0 的行为。

## 已知问题

在以下情况中,TiDB 中的查询结果与 MySQL 5.7 相同,但与 MySQL 8.0 不同。

- 二进制参数的位操作。更多信息,请参考 [#30637](https://github.com/pingcap/tidb/issues/30637)
- `BIT_COUNT()` 函数的结果。更多信息,请参考 [#44621](https://github.com/pingcap/tidb/issues/44621)
8 changes: 4 additions & 4 deletions functions-and-operators/date-and-time-functions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: 日期和时间函数
aliases: ['/docs-cn/dev/functions-and-operators/date-and-time-functions/','/docs-cn/dev/reference/sql/functions-and-operators/date-and-time-functions/']
summary: TiDB 支持 MySQL 5.7 中的所有日期和时间函数。但是 TiDB 可能无法完全匹配 MySQL 的行为,建议使用正确的日期格式。TiDB 支持 str_to_date() 函数,但无法解析所有日期和时间值。此外,TiDB 不支持特定的日期和时间格式化选项。系统变量 default_week_format 影响 WEEK() 函数。更多信息,请参见 GitHub Issue #30082
summary: TiDB 支持 MySQL 8.0 中的所有日期和时间函数。
---

# 日期和时间函数

TiDB 支持使用 MySQL 5.7 中提供的所有[日期和时间函数](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html)
TiDB 支持使用 MySQL 8.0 中提供的所有[日期和时间函数](https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html)

> **注意:**
>
Expand Down Expand Up @@ -80,7 +80,7 @@ TiDB 支持使用 MySQL 5.7 中提供的所有[日期和时间函数](https://de

## MySQL 兼容性

TiDB 支持 `str_to_date()` 函数,但是无法解析所有的日期和时间值。此外,TiDB 不支持以下日期和时间格式化选项:
TiDB 支持 `STR_TO_DATE()` 函数,但是无法解析所有的日期和时间值。此外,TiDB 不支持以下日期和时间格式化选项:

| 格式 | 说明 |
|--------|---------------------------------------------------------------------------------------|
Expand All @@ -99,4 +99,4 @@ TiDB 支持 `str_to_date()` 函数,但是无法解析所有的日期和时间

## 相关系统变量

`default_week_format` 变量影响 `WEEK()` 函数。
[`default_week_format`](/system-variables.md#default_week_format) 变量影响 `WEEK()` 函数。
12 changes: 9 additions & 3 deletions functions-and-operators/encryption-and-compression-functions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: 加密和压缩函数
aliases: ['/docs-cn/dev/functions-and-operators/encryption-and-compression-functions/','/docs-cn/dev/reference/sql/functions-and-operators/encryption-and-compression-functions/']
summary: TiDB 支持大部分 MySQL 5.7 中提供的加密和压缩函数,包括MD5、PASSWORD、RANDOM_BYTES、SHA1、SHA2、AES_DECRYPT、AES_ENCRYPT、COMPRESS、UNCOMPRESS、UNCOMPRESSED_LENGTH 和 VALIDATE_PASSWORD_STRENGTH。相关系统变量 block_encryption_mode 用于设置 AES_ENCRYPT 和 AES_DECRYPT 的加密模式。不支持的函数包括 DES_DECRYPT、DES_ENCRYPT、OLD_PASSWORD 和 ENCRYPT,以及仅在 MySQL 企业版中支持的函数
summary: TiDB 支持 MySQL 8.0 中提供的大部分加密和压缩函数
---

# 加密和压缩函数

TiDB 支持使用 MySQL 5.7 中提供的大部分[加密和压缩函数](https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html)
TiDB 支持使用 MySQL 8.0 中提供的大部分[加密和压缩函数](https://dev.mysql.com/doc/refman/8.0/en/encryption-functions.html)

## 支持的函数

Expand All @@ -27,9 +27,15 @@ TiDB 支持使用 MySQL 5.7 中提供的大部分[加密和压缩函数](https:/

## 相关系统变量

`block_encryption_mode` 变量设置 `AES_ENCRYPT()``AES_DECRYPT()` 所使用的加密模式。
* [`block_encryption_mode`](/system-variables.md#block_encryption_mode) 变量设置 `AES_ENCRYPT()``AES_DECRYPT()` 所使用的加密模式。

* [`validate_password.*`](/system-variables.md) 变量影响 `VALIDATE_PASSWORD_STRENGTH()` 函数的行为。

## 不支持的函数

* `DES_DECRYPT()``DES_ENCRYPT()``OLD_PASSWORD()``ENCRYPT()`:这些函数在 MySQL 5.7 中被废弃,并且已在 MySQL 8.0 中移除。
* 只在 MySQL 企业版中支持的函数。见 [Issue #2632](https://github.com/pingcap/tidb/issues/2632)

## MySQL 兼容性

* TiDB 不支持 `STATEMENT_DIGEST()``STATEMENT_DIGEST_TEXT()` 函数。
21 changes: 14 additions & 7 deletions functions-and-operators/json-functions.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: JSON 函数
aliases: ['/docs-cn/dev/functions-and-operators/json-functions/','/docs-cn/dev/reference/sql/functions-and-operators/json-functions/']
summary: TiDB 支持 MySQL 5.7 GA 版本发布的大多数 JSON 函数,包括创建、搜索、修改、返回属性和效用函数。这些函数可用于处理 JSON 值,如创建 JSON 文档、搜索 JSON 文档中的值、修改 JSON 文档、返回 JSON 值属性和聚合函数。此外,还有其他相关函数可供参考
summary: TiDB 支持 MySQL 8.0 中提供的大部分 JSON 函数。
---

# JSON 函数

TiDB 支持 MySQL 5.7 GA 版本发布的大多数 JSON 函数。
TiDB 支持 MySQL 8.0 中提供的大部分 [JSON 函数](https://dev.mysql.com/doc/refman/8.0/en/json-functions.html)

## 创建 JSON 值的函数

Expand Down Expand Up @@ -35,18 +35,16 @@ TiDB 支持 MySQL 5.7 GA 版本发布的大多数 JSON 函数。
| 函数 | 功能描述 |
| --------------------------------- | ----------- |
| [JSON_APPEND(json_doc, path, value)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-append) | `JSON_ARRAY_APPEND` 的别名 |
| [JSON_ARRAY_APPEND(json_doc, path, value)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-append) | 将值追加到指定路径的 JSON 数组的末尾 |
| [JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-insert) | 将数组插入 JSON 文档,并返回修改后的文档 |
| [JSON_ARRAY_APPEND(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-append) | 将值添加到 JSON 文档指定数组的末尾,并返回添加结果 |
| [JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-insert) | 将值插入到 JSON 文档中的指定位置并返回结果 |
| [JSON_INSERT(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-insert) | 在 JSON 文档中在某一路径下插入子文档 |
| [JSON_MERGE(json_doc, json_doc[, json_doc] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge) | 已废弃的 `JSON_MERGE_PRESERVE` 别名 |
| [JSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge-patch) | 合并 JSON 文档 |
| [JSON_MERGE_PRESERVE(json_doc, json_doc[, json_doc] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge-preserve) | 将两个或多个 JSON 文档合并成一个文档,并返回合并结果 |
| [JSON_MERGE(json_doc, json_doc[, json_doc] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-merge) | 已废弃,`JSON_MERGE_PRESERVE` 的别名 |
| [JSON_REMOVE(json_doc, path[, path] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-remove) | 移除 JSON 文档中某一路径下的子文档 |
| [JSON_REPLACE(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-replace) | 替换 JSON 文档中的某一路径下的子文档 |
| [JSON_SET(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-set) | 在 JSON 文档中为某一路径设置子文档 |
| [JSON_UNQUOTE(json_val)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-unquote) | 去掉 JSON 值外面的引号,返回结果为字符串 |
| [JSON_ARRAY_APPEND(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-append) | 将值添加到 JSON 文档指定数组的末尾,并返回添加结果 |
| [JSON_ARRAY_INSERT(json_doc, path, val[, path, val] ...)](https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html#function_json-array-insert) | 将值插入到 JSON 文档的指定位置,并返回插入结果 |

## 返回 JSON 值属性的函数

Expand Down Expand Up @@ -76,3 +74,12 @@ TiDB 支持 MySQL 5.7 GA 版本发布的大多数 JSON 函数。

* [JSON Function Reference](https://dev.mysql.com/doc/refman/8.0/en/json-function-reference.html)
* [JSON Data Type](/data-type-json.md)

## 不支持的函数

- `JSON_SCHEMA_VALID()`
- `JSON_SCHEMA_VALIDATION_REPORT()`
- `JSON_TABLE()`
- `JSON_VALUE()`

更多信息,请参考 [#14486](https://github.com/pingcap/tidb/issues/14486)
4 changes: 2 additions & 2 deletions functions-and-operators/locking-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ summary: 了解 TiDB 中的用户级锁函数。

# 锁函数

TiDB 支持 MySQL 5.7 中的大部分用户级[锁函数](https://dev.mysql.com/doc/refman/5.7/en/locking-functions.html)
TiDB 支持 MySQL 8.0 中的大部分用户级[锁函数](https://dev.mysql.com/doc/refman/8.0/en/locking-functions.html)

## 支持的函数

Expand All @@ -20,6 +20,6 @@ TiDB 支持 MySQL 5.7 中的大部分用户级[锁函数](https://dev.mysql.com/
## MySQL 兼容性

* TiDB 允许的最短超时时间为 1 秒,最长超时时间为 1 小时(即 3600 秒)。而 MySQL 允许最短 0 秒和最长无限超时(`timeout=-1`)。TiDB 会自动将超出范围的值转换为最接近的允许值,`timeout=-1` 会被转换为 3600 秒。
* TiDB 不会自动检测用户级锁导致的死锁。死锁会话将在 1 小时内超时,但你也可以在任一受影响的会话上使用 `KILL` 语句手动终止死锁。你还可以通过始终用相同顺序获取用户级锁的方法来防止死锁。
* TiDB 不会自动检测用户级锁导致的死锁。死锁会话将在 1 小时内超时,但你也可以在任一受影响的会话上使用 [`KILL`](/sql-statements/sql-statement-kill.md) 语句手动终止死锁。你还可以通过始终用相同顺序获取用户级锁的方法来防止死锁。
* 在 TiDB 中,锁对集群中所有 TiDB 服务器生效。而在 MySQL Cluster 和 Group Replication 中,锁只对本地单个服务器生效。
* 如果从另一个会话调用 `IS_USED_LOCK()` 并且无法返回持有锁的进程 ID,则返回 `1`
Loading

0 comments on commit 4d28f9a

Please sign in to comment.