From 96dc0e2c0001ec266f47affb7ebee16d78d6a903 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:06:06 +0800 Subject: [PATCH 1/4] sysvar: add 13 sysvars to docs-cn --- .../aggregate-group-by-functions.md | 4 + .../date-and-time-functions.md | 4 + .../encryption-and-compression-functions.md | 4 + system-variables.md | 108 +++++++++++++++++- 4 files changed, 117 insertions(+), 3 deletions(-) diff --git a/functions-and-operators/aggregate-group-by-functions.md b/functions-and-operators/aggregate-group-by-functions.md index dad7920709b2..4125f9ecde01 100644 --- a/functions-and-operators/aggregate-group-by-functions.md +++ b/functions-and-operators/aggregate-group-by-functions.md @@ -183,3 +183,7 @@ select id, floor(value/100) as val from tbl_name group by id, val; ``` + +## Related system variables + +The `group_concat_max_len` variable sets the maximum number of items for the `GROUP_CONCAT()` function. diff --git a/functions-and-operators/date-and-time-functions.md b/functions-and-operators/date-and-time-functions.md index 55fbd139e59e..99c98db0b62e 100644 --- a/functions-and-operators/date-and-time-functions.md +++ b/functions-and-operators/date-and-time-functions.md @@ -70,3 +70,7 @@ TiDB 支持使用 MySQL 5.7 中提供的所有[日期和时间函数](https://de | [`WEEKOFYEAR()`](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_weekofyear) | 返回参数在日历中对应的一年中的星期数 | | [`YEAR()`](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_year) | 返回参数对应的年数| | [`YEARWEEK()`](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_yearweek) | 返回年数和星期数 | + +## Related system variables + +The `default_week_format` variable affects the `WEEK()` function. diff --git a/functions-and-operators/encryption-and-compression-functions.md b/functions-and-operators/encryption-and-compression-functions.md index 0ccae04cd009..80ec727f379f 100644 --- a/functions-and-operators/encryption-and-compression-functions.md +++ b/functions-and-operators/encryption-and-compression-functions.md @@ -31,6 +31,10 @@ TiDB 支持使用 MySQL 5.7 中提供的大部分[加密和压缩函数](https:/ | [`ASYMMETRIC_SIGN()`](https://dev.mysql.com/doc/refman/5.7/en/enterprise-encryption-functions.html#function_asymmetric-sign) | 从摘要创建签名 | | [`ASYMMETRIC_VERIFY()`](https://dev.mysql.com/doc/refman/5.7/en/enterprise-encryption-functions.html#function_asymmetric-verify) | 验证签名字符串是否匹配摘要字符串 | +## Related system variables + +The `block_encryption_mode` variable sets the encryption mode that is used for `AES_ENCRYPT()` and `AES_DECRYPT()`. + ## 不支持的函数 * `DES_DECRYPT()`、`DES_ENCRYPT()`、`OLD_PASSWORD()` 和 `ENCRYPT()`:这些函数在 MySQL 5.7 中被废弃,并且已在 MySQL 8.0 中移除。 diff --git a/system-variables.md b/system-variables.md index 15d7a4355df7..e18cfd17a217 100644 --- a/system-variables.md +++ b/system-variables.md @@ -99,6 +99,13 @@ mysql> SELECT * FROM t1; - 默认值:`ON` - 用于设置在非显式事务时是否自动提交事务。更多信息,请参见[事务概述](/transaction-overview.md#自动提交)。 +### `block_encryption_mode` + +- 作用域:SESSION | GLOBAL +- 是否持久化到集群:是 +- 默认值:`aes-128-ecb` +- 用于设置 `AES_ENCRYPT()` 和 `AES_DECRYPT()` 函数的加密模式。 + ### character_set_client - 作用域:SESSION | GLOBAL @@ -187,6 +194,21 @@ mysql> SELECT * FROM t1; - 服务器和客户端建立连接时,这个变量用于设置服务器对外通告的默认身份验证方式。如要了解该变量的其他可选值,参见[可用的身份验证插件](/security-compatibility-with-mysql.md#可用的身份验证插件)。 - 若要在用户登录时使用 `tidb_sm3_password` 插件,需要使用 [TiDB-JDBC](https://github.com/pingcap/mysql-connector-j/tree/release/8.0-sm3) 进行连接。 +### `default_week_format` + +- 作用域:SESSION | GLOBAL +- 是否持久化到集群:是 +- 类型:整数 +- 默认值:`0` +- 取值范围:`[0, 7]` +- 设置 `WEEK()` 函数使用的周格式。 + +### `error_count` + +- 作用域:NONE +- 类型:整数 +- 表示上一条生成消息的 SQL 语句中的错误数。该变量为只读变量。 + ### `foreign_key_checks` - 作用域:SESSION | GLOBAL @@ -194,6 +216,27 @@ mysql> SELECT * FROM t1; - 默认值:`OFF` - 为保持兼容,TiDB 对外键检查返回 `OFF`。 +### `group_concat_max_len` + +- 作用域:SESSION | GLOBAL +- 是否持久化到集群:是 +- 类型:整数 +- 默认值:`1024` +- 取值范围:`[4, 18446744073709551615]` +- 表示 `GROUP_CONCAT()` 函数中,项目的最大缓冲区大小。 + +### `have_openssl` + +- 作用域:NONE +- 默认值:`DISABLED` +- 用于 MySQL 兼容性的只读变量。当服务器启用 TLS 时,服务器将其设置为 `YES`。 + +### `have_ssl` + +- 作用域:NONE +- 默认值:`DISABLED` +- 用于 MySQL 兼容性的只读变量。当服务器启用 TLS 时,服务器将其设置为 `YES`。 + ### `hostname` - 作用域:NONE @@ -253,6 +296,33 @@ mysql> SELECT * FROM t1; - 默认值:`Apache License 2.0` - 这个变量表示 TiDB 服务器的安装许可证。 +### `log_bin` + +- 作用域:NONE +- 类型:布尔型 +- 默认值:`OFF` +- 该变量表示是否使用 [TiDB Binlog](/tidb-binlog/tidb-binlog-overview.md)。 + +### `max_allowed_packet` + +- 作用域:SESSION | GLOBAL +- 是否持久化到集群:是 +- 类型:整数 +- 默认值:`67108864` +- 取值范围:`[1024, 1073741824]` +- 单位:字节 +- 该变量表示 MySQL 协议的最大包大小。 + +### `max_connections` + +- 作用域:GLOBAL +- 是否持久化到集群:否 +- 类型:整数 +- 默认值:`0` +- 取值范围:`[0, 100000]` +- 该变量表示 TiDB 实例允许的最大连接数。 +- 该变量值为 `0` 时表示无限制。 + ### `max_execution_time` - 作用域:SESSION | GLOBAL @@ -336,7 +406,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 该变量用于为 SQL 函数 `RAND()` 中使用的随机值生成器添加种子。 - 该变量的行为与 MySQL 兼容。 -### rand_seed2 +### `rand_seed2` - 作用域:SESSION - 默认值:`0` @@ -344,7 +414,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 该变量用于为 SQL 函数 `RAND()` 中使用的随机值生成器添加种子。 - 该变量的行为与 MySQL 兼容。 -### require_secure_transport 从 v6.1.0 版本开始引入 +### `require_secure_transport` 从 v6.1.0 版本开始引入 - 作用域:GLOBAL - 是否持久化到集群:是 @@ -353,7 +423,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 该变量设置为 `ON` 时,必须使用开启 TLS 的会话连接到 TiDB,防止在 TLS 配置不正确时出现锁定的情况。 - 在 v6.1.0 之前这个开关通过 TiDB 配置文件 (`security.require-secure-transport`) 进行配置,升级到 v6.1.0 时会自动继承原有设置。 -### skip_name_resolve 从 v5.2.0 版本开始引入 +### `skip_name_resolve` 从 v5.2.0 版本开始引入 - 作用域:GLOBAL - 是否持久化到集群:是 @@ -377,6 +447,18 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 默认值:"" - 使用 MySQL 协议时,tidb-server 所监听的本地 unix 套接字文件。 +### `sql_log_bin` + +- 作用域:SESSION | GLOBAL +- 是否持久化到集群:是 +- 类型:布尔型 +- 默认值:`ON` +- 表示是否将更改写入 TiDB Binlog。 + +> **注意:** +> +> 不建议将 `sql_log_bin` 设置为全局变量,因为 TiDB 的未来版本可能只允许将其设置为会话变量。 + ### `sql_mode` - 作用域:SESSION | GLOBAL @@ -402,6 +484,24 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 范围:`[0, 18446744073709551615]` - `SELECT` 语句返回的最大行数。 +### `ssl_ca` + +- 作用域:NONE +- 默认值:"" +- 证书颁发机构 (CA) 文件的位置(如果有)。该变量的值由 TiDB 配置项 [`ssl-ca`](/tidb-configuration-file.md#ssl-ca) 定义。 + +### `ssl_cert` + +- 作用域:NONE +- 默认值:"" +- 用于 SSL/TLS 连接的证书文件(如果有文件)的位置。该变量的值由 TiDB 配置项 [`ssl-cert`](/tidb-configuration-file.md#ssl-cert) 定义。 + +### `ssl_key` + +- 作用域:NONE +- 默认值:"" +- 用于 SSL/TLS 连接的私钥文件(如果有)的位置。该变量的值由 TiDB 配置项 [`ssl-key`](/tidb-configuration-file.md#ssl-cert) 定义。 + ### `system_time_zone` - 作用域:NONE @@ -2737,7 +2837,9 @@ Query OK, 0 rows affected, 1 warning (0.00 sec) ### `timestamp` - 作用域:SESSION +- 类型:浮点数 - 默认值:`0` +- 取值范围:`[0, 2147483647]` - 一个 Unix 时间戳。变量值非空时,表示 `CURRENT_TIMESTAMP()`、`NOW()` 等函数的时间戳。该变量通常用于数据恢复或数据复制。 ### `transaction_isolation` From 2d1f86302d20631abbba41a989d3569391434230 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:17:04 +0800 Subject: [PATCH 2/4] trans --- functions-and-operators/aggregate-group-by-functions.md | 4 ++-- functions-and-operators/date-and-time-functions.md | 4 ++-- .../encryption-and-compression-functions.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/functions-and-operators/aggregate-group-by-functions.md b/functions-and-operators/aggregate-group-by-functions.md index 4125f9ecde01..ef95c29e7495 100644 --- a/functions-and-operators/aggregate-group-by-functions.md +++ b/functions-and-operators/aggregate-group-by-functions.md @@ -184,6 +184,6 @@ from tbl_name group by id, val; ``` -## Related system variables +## 相关系统变量 -The `group_concat_max_len` variable sets the maximum number of items for the `GROUP_CONCAT()` function. +`group_concat_max_len` 变量设置 `GROUP_CONCAT()` 函数中的最大项目数。 diff --git a/functions-and-operators/date-and-time-functions.md b/functions-and-operators/date-and-time-functions.md index 99c98db0b62e..1d3fd0fcc7a8 100644 --- a/functions-and-operators/date-and-time-functions.md +++ b/functions-and-operators/date-and-time-functions.md @@ -71,6 +71,6 @@ TiDB 支持使用 MySQL 5.7 中提供的所有[日期和时间函数](https://de | [`YEAR()`](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_year) | 返回参数对应的年数| | [`YEARWEEK()`](https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_yearweek) | 返回年数和星期数 | -## Related system variables +## 相关系统变量 -The `default_week_format` variable affects the `WEEK()` function. +`default_week_format` 变量影响 `WEEK()` 函数。 diff --git a/functions-and-operators/encryption-and-compression-functions.md b/functions-and-operators/encryption-and-compression-functions.md index 80ec727f379f..bad0422231c9 100644 --- a/functions-and-operators/encryption-and-compression-functions.md +++ b/functions-and-operators/encryption-and-compression-functions.md @@ -31,9 +31,9 @@ TiDB 支持使用 MySQL 5.7 中提供的大部分[加密和压缩函数](https:/ | [`ASYMMETRIC_SIGN()`](https://dev.mysql.com/doc/refman/5.7/en/enterprise-encryption-functions.html#function_asymmetric-sign) | 从摘要创建签名 | | [`ASYMMETRIC_VERIFY()`](https://dev.mysql.com/doc/refman/5.7/en/enterprise-encryption-functions.html#function_asymmetric-verify) | 验证签名字符串是否匹配摘要字符串 | -## Related system variables +## 相关系统变量 -The `block_encryption_mode` variable sets the encryption mode that is used for `AES_ENCRYPT()` and `AES_DECRYPT()`. +`block_encryption_mode` 变量设置 `AES_ENCRYPT()` 和 `AES_DECRYPT()` 所使用的加密模式。 ## 不支持的函数 From f07441b7ea639c49b10d3f7627cd5a84c6d13154 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:33:12 +0800 Subject: [PATCH 3/4] Update system-variables.md --- system-variables.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/system-variables.md b/system-variables.md index e18cfd17a217..5568a9fddb04 100644 --- a/system-variables.md +++ b/system-variables.md @@ -303,16 +303,6 @@ mysql> SELECT * FROM t1; - 默认值:`OFF` - 该变量表示是否使用 [TiDB Binlog](/tidb-binlog/tidb-binlog-overview.md)。 -### `max_allowed_packet` - -- 作用域:SESSION | GLOBAL -- 是否持久化到集群:是 -- 类型:整数 -- 默认值:`67108864` -- 取值范围:`[1024, 1073741824]` -- 单位:字节 -- 该变量表示 MySQL 协议的最大包大小。 - ### `max_connections` - 作用域:GLOBAL From 82f4cb62d016b07c318ae3d85df6cc390d618ab8 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Thu, 13 Oct 2022 11:34:57 +0800 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Ran --- system-variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index 5568a9fddb04..09532b1fc4da 100644 --- a/system-variables.md +++ b/system-variables.md @@ -478,19 +478,19 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count'; - 作用域:NONE - 默认值:"" -- 证书颁发机构 (CA) 文件的位置(如果有)。该变量的值由 TiDB 配置项 [`ssl-ca`](/tidb-configuration-file.md#ssl-ca) 定义。 +- 证书颁发机构 (CA) 文件的位置。若文件不存在,则变量值为空。该变量的值由 TiDB 配置项 [`ssl-ca`](/tidb-configuration-file.md#ssl-ca) 定义。 ### `ssl_cert` - 作用域:NONE - 默认值:"" -- 用于 SSL/TLS 连接的证书文件(如果有文件)的位置。该变量的值由 TiDB 配置项 [`ssl-cert`](/tidb-configuration-file.md#ssl-cert) 定义。 +- 用于 SSL/TLS 连接的证书文件的位置。若文件不存在,则变量值为空。该变量的值由 TiDB 配置项 [`ssl-cert`](/tidb-configuration-file.md#ssl-cert) 定义。 ### `ssl_key` - 作用域:NONE - 默认值:"" -- 用于 SSL/TLS 连接的私钥文件(如果有)的位置。该变量的值由 TiDB 配置项 [`ssl-key`](/tidb-configuration-file.md#ssl-cert) 定义。 +- 用于 SSL/TLS 连接的私钥文件的位置。若文件不存在,则变量值为空。该变量的值由 TiDB 配置项 [`ssl-key`](/tidb-configuration-file.md#ssl-cert) 定义。 ### `system_time_zone`