Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into rn-v6.5.9-16980
Browse files Browse the repository at this point in the history
  • Loading branch information
qiancai committed Apr 12, 2024
2 parents e36235f + 45ac1f0 commit 580e2a1
Show file tree
Hide file tree
Showing 36 changed files with 379 additions and 165 deletions.
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ For details, see [tips for choosing the affected versions](https://github.com/pi
- [ ] v5.3 (TiDB 5.3 versions)
- [ ] v5.2 (TiDB 5.2 versions)
- [ ] v5.1 (TiDB 5.1 versions)
- [ ] v5.0 (TiDB 5.0 versions)

### What is the related PR or file link(s)?

Expand Down
1 change: 1 addition & 0 deletions br/backup-and-restore-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This section describes the prerequisites for using TiDB backup and restore, incl
- PITR only supports cluster-level restore and does not support database-level or table-level restore.
- PITR does not support restoring the data of user tables or privilege tables from system tables.
- BR does not support running multiple backup tasks on a cluster **at the same time**.
- BR does not support running snapshot backup tasks and data restore tasks on a cluster **at the same time**.
- When a PITR is running, you cannot run a log backup task or use TiCDC to replicate data to a downstream cluster.

### Some tips
Expand Down
4 changes: 2 additions & 2 deletions br/backup-and-restore-storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ When storing backup data in a cloud storage system, you need to configure authen

Before backup, configure the following privileges to access the backup directory on S3.

- Minimum privileges for TiKV and Backup & Restore (BR) to access the backup directories during backup: `s3:ListBucket`, `s3:PutObject`, and `s3:AbortMultipartUpload`
- Minimum privileges for TiKV and BR to access the backup directories during restore: `s3:ListBucket`, `s3:GetObject`, and `s3:PutObject`. BR writes checkpoint information to the `./checkpoints` subdirectory under the backup directory. When restoring log backup data, BR writes the table ID mapping relationship of the restored cluster to the `./pitr_id_maps` subdirectory under the backup directory.
- Minimum privileges for TiKV and Backup & Restore (BR) to access the backup directories during backup: `s3:ListBucket`, `s3:GetObject`, `s3:DeleteObject`, `s3:PutObject`, and `s3:AbortMultipartUpload`
- Minimum privileges for TiKV and BR to access the backup directories during restore: `s3:ListBucket`, `s3:GetObject`, `s3:DeleteObject`, and `s3:PutObject`. BR writes checkpoint information to the `./checkpoints` subdirectory under the backup directory. When restoring log backup data, BR writes the table ID mapping relationship of the restored cluster to the `./pitr_id_maps` subdirectory under the backup directory.

If you have not yet created a backup directory, refer to [Create a bucket](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket-overview.html) to create an S3 bucket in the specified region. If necessary, you can also create a folder in the bucket by referring to [Create a folder](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html).

Expand Down
4 changes: 2 additions & 2 deletions br/backup-and-restore-use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ The detailed steps are as follows:

2. Configure permissions for BR and TiKV to access the S3 directory. It is recommended to grant permissions using the IAM method, which is the most secure way to access the S3 bucket. For detailed steps, refer to [AWS documentation: Controlling access to a bucket with user policies](https://docs.aws.amazon.com/AmazonS3/latest/userguide/walkthrough1.html). The required permissions are as follows:

- TiKV and BR in the backup cluster need `s3:ListBucket`, `s3:PutObject`, and `s3:AbortMultipartUpload` permissions of the `s3://tidb-pitr-bucket/backup-data` directory.
- TiKV and BR in the restore cluster need `s3:ListBucket`, `s3:GetObject`, and `s3:PutObject` permissions of the `s3://tidb-pitr-bucket/backup-data` directory.
- TiKV and BR in the backup cluster need `s3:ListBucket`, `s3:GetObject`, `s3:DeleteObject`, `s3:PutObject`, and `s3:AbortMultipartUpload` permissions of the `s3://tidb-pitr-bucket/backup-data` directory.
- TiKV and BR in the restore cluster need `s3:ListBucket`, `s3:GetObject`, `s3:DeleteObject`, and `s3:PutObject` permissions of the `s3://tidb-pitr-bucket/backup-data` directory.

3. Plan the directory structure that stores the backup data, including the snapshot (full) backup and the log backup.

Expand Down
2 changes: 2 additions & 0 deletions dashboard/dashboard-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ The following performance data are currently supported:
- Heap: The memory consumption of each internal function on TiDB, TiKV, and PD instances

> Starting from v7.5, TiDB supports the TiKV Heap Profile. The Perl dependency is required in the running environment of TiDB Dashboard. Otherwise an error will occur.
- Mutex: The mutex contention states on TiDB and PD instances

- Goroutine: The running state and call stack of all goroutines on TiDB and PD instances
Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-sample-application-aws-lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ For more information, refer to [Delete data](/develop/dev-guide-delete-data.md).
## Next steps

- For more details on how to use TiDB in AWS Lambda Function, see our [TiDB-Lambda-integration/aws-lambda-bookstore Demo](https://github.com/pingcap/TiDB-Lambda-integration/blob/main/aws-lambda-bookstore/README.md). You can also use AWS API Gateway to build a RESTful API for your application.
- Learn more usage of `mysql2` from [the documentation of `mysql2`](https://github.com/sidorares/node-mysql2/tree/master/documentation/en).
- Learn more usage of `mysql2` from [the documentation of `mysql2`](https://sidorares.github.io/node-mysql2/docs/documentation).
- Learn more usage of AWS Lambda from [the AWS developer guide of `Lambda`](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html).
- Learn the best practices for TiDB application development with the chapters in the [Developer guide](/develop/dev-guide-overview.md), such as [Insert data](/develop/dev-guide-insert-data.md), [Update data](/develop/dev-guide-update-data.md), [Delete data](/develop/dev-guide-delete-data.md), [Single table reading](/develop/dev-guide-get-data-from-single-table.md), [Transactions](/develop/dev-guide-transaction-overview.md), and [SQL performance optimization](/develop/dev-guide-optimize-sql-overview.md).
- Learn through the professional [TiDB developer courses](https://www.pingcap.com/education/) and earn [TiDB certifications](https://www.pingcap.com/education/certification/) after passing the exam.
Expand Down
1 change: 1 addition & 0 deletions develop/dev-guide-sample-application-java-jdbc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Connect to TiDB with JDBC
summary: Learn how to connect to TiDB using JDBC. This tutorial gives Java sample code snippets that work with TiDB using JDBC.
aliases: ['/tidb/dev/sample-application-java','/tidb/dev/dev-guide-sample-application-java']
---

# Connect to TiDB with JDBC
Expand Down
2 changes: 1 addition & 1 deletion develop/dev-guide-sample-application-nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ For more information, refer to [Delete data](/develop/dev-guide-delete-data.md).
## Next steps

- For more details on how to build a complex application with ORM and Next.js, see [our Bookshop Demo](https://github.com/pingcap/tidb-prisma-vercel-demo).
- Learn more usage of node-mysql2 driver from [the documentation of node-mysql2](https://github.com/sidorares/node-mysql2/tree/master/documentation/en).
- Learn more usage of node-mysql2 driver from [the documentation of node-mysql2](https://sidorares.github.io/node-mysql2/docs/documentation).
- Learn the best practices for TiDB application development with the chapters in the [Developer guide](/develop/dev-guide-overview.md), such as [Insert data](/develop/dev-guide-insert-data.md), [Update data](/develop/dev-guide-update-data.md), [Delete data](/develop/dev-guide-delete-data.md), [Single table reading](/develop/dev-guide-get-data-from-single-table.md), [Transactions](/develop/dev-guide-transaction-overview.md), and [SQL performance optimization](/develop/dev-guide-optimize-sql-overview.md).
- Learn through the professional [TiDB developer courses](https://www.pingcap.com/education/) and earn [TiDB certifications](https://www.pingcap.com/education/certification/) after passing the exam.

Expand Down
102 changes: 100 additions & 2 deletions functions-and-operators/string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1242,11 +1242,53 @@ Negation of simple pattern matching.

### [`NOT REGEXP`](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_not-regexp)

Negation of `REGEXP`.
Negation of [`REGEXP`](#regexp).

### [`OCT()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_oct)

Return a string containing octal representation of a number.
Return a string containing [octal](https://en.wikipedia.org/wiki/Octal) (base 8) representation of a number.

Examples:

The following example generates a sequence of numbers from 0 to 20 using a [recursive common table expression (CTE)](/develop/dev-guide-use-common-table-expression.md#recursive-cte) and then uses the `OCT()` function to convert each number to its octal representation. Decimal values from 0 to 7 have identical representations in octal. Decimal numbers from 8 to 15 correspond to octal numbers from 10 to 17.

```sql
WITH RECURSIVE nr(n) AS (
SELECT 0 AS n
UNION ALL
SELECT n+1 FROM nr WHERE n<20
)
SELECT n, OCT(n) FROM nr;
```

```
+------+--------+
| n | OCT(n) |
+------+--------+
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 10 |
| 9 | 11 |
| 10 | 12 |
| 11 | 13 |
| 12 | 14 |
| 13 | 15 |
| 14 | 16 |
| 15 | 17 |
| 16 | 20 |
| 17 | 21 |
| 18 | 22 |
| 19 | 23 |
| 20 | 24 |
+------+--------+
20 rows in set (0.00 sec)
```

### [`OCTET_LENGTH()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_octet-length)

Expand Down Expand Up @@ -1288,6 +1330,62 @@ Return the substring that matches the regular expression (Partly compatible with

Repeat a string the specified number of times.

Examples:

The following example generates a sequence of numbers from 1 to 20 using a [recursive common table expression (CTE)](/develop/dev-guide-use-common-table-expression.md#recursive-cte). For each number in the sequence, the character `x` is repeated the number of times equal to the number itself.

```sql
WITH RECURSIVE nr(n) AS (
SELECT 1 AS n
UNION ALL
SELECT n+1 FROM nr WHERE n<20
)
SELECT n, REPEAT('x',n) FROM nr;
```

```
+------+----------------------+
| n | REPEAT('x',n) |
+------+----------------------+
| 1 | x |
| 2 | xx |
| 3 | xxx |
| 4 | xxxx |
| 5 | xxxxx |
| 6 | xxxxxx |
| 7 | xxxxxxx |
| 8 | xxxxxxxx |
| 9 | xxxxxxxxx |
| 10 | xxxxxxxxxx |
| 11 | xxxxxxxxxxx |
| 12 | xxxxxxxxxxxx |
| 13 | xxxxxxxxxxxxx |
| 14 | xxxxxxxxxxxxxx |
| 15 | xxxxxxxxxxxxxxx |
| 16 | xxxxxxxxxxxxxxxx |
| 17 | xxxxxxxxxxxxxxxxx |
| 18 | xxxxxxxxxxxxxxxxxx |
| 19 | xxxxxxxxxxxxxxxxxxx |
| 20 | xxxxxxxxxxxxxxxxxxxx |
+------+----------------------+
20 rows in set (0.01 sec)
```

The following example demonstrates that `REPEAT()` can operate on strings consisting of multiple characters.

```sql
SELECT REPEAT('ha',3);
```

```
+----------------+
| REPEAT('ha',3) |
+----------------+
| hahaha |
+----------------+
1 row in set (0.00 sec)
```

### [`REPLACE()`](https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_replace)

Replace occurrences of a specified string.
Expand Down
4 changes: 2 additions & 2 deletions releases/release-6.5.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Quick access: [Quick start](https://docs.pingcap.com/tidb/v6.5/quick-start-with-
- Fix the issue that TiDB server might consume a significant amount of resources when the enterprise plugin for audit logging is used [#49273](https://github.com/pingcap/tidb/issues/49273) @[lcwangchao](https://github.com/lcwangchao)
- Fix the incorrect error message for `ErrLoadDataInvalidURI` (invalid S3 URI error) [#48164](https://github.com/pingcap/tidb/issues/48164) @[lance6716](https://github.com/lance6716)
- Fix the issue that high CPU usage of TiDB occurs due to long-term memory pressure caused by `tidb_server_memory_limit` [#48741](https://github.com/pingcap/tidb/issues/48741) @[XuHuaiyu](https://github.com/XuHuaiyu)
- Fix the issue that queries containing common table expressions (CTEs) unexpectedly get stuck when the memory limit is exceeded [#49096](https://github.com/pingcap/tidb/issues/49096) @[AilinKid](https://github.com/AilinKid})
- Fix the issue that queries containing common table expressions (CTEs) unexpectedly get stuck when the memory limit is exceeded [#49096](https://github.com/pingcap/tidb/issues/49096) @[AilinKid](https://github.com/AilinKid)
- Fix the issue that the same query plan has different `PLAN_DIGEST` values in some cases [#47634](https://github.com/pingcap/tidb/issues/47634) @[King-Dylan](https://github.com/King-Dylan)
- Fix the issue that queries containing CTEs report `runtime error: index out of range [32] with length 32` when `tidb_max_chunk_size` is set to a small value [#48808](https://github.com/pingcap/tidb/issues/48808) @[guo-shaoge](https://github.com/guo-shaoge)
- Fix the issue that TiDB server might panic during graceful shutdown [#36793](https://github.com/pingcap/tidb/issues/36793) @[bb7133](https://github.com/bb7133)
Expand Down Expand Up @@ -92,5 +92,5 @@ Quick access: [Quick start](https://docs.pingcap.com/tidb/v6.5/quick-start-with-

+ TiCDC

- Fix the issue that `checkpoint-ts` might get stuck when TiCDC replicates data to downstream MySQL [#10334](https://github.com/pingcap/tiflow/issues/10334) @[zhangjinpeng1987](https://github.com/zhangjinpeng1987)
- Fix the issue that `checkpoint-ts` might get stuck when TiCDC replicates data to downstream MySQL [#10334](https://github.com/pingcap/tiflow/issues/10334) @[zhangjinpeng87](https://github.com/zhangjinpeng87)
- Fix the potential data race issue during `kv-client` initialization [#10095](https://github.com/pingcap/tiflow/issues/10095) @[3AceShowHand](https://github.com/3AceShowHand)
2 changes: 1 addition & 1 deletion releases/release-7.1.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Quick access: [Quick start](https://docs.pingcap.com/tidb/v7.1/quick-start-with-

+ TiDB

- Fix the issue that queries containing common table expressions (CTEs) unexpectedly get stuck when the memory limit is exceeded [#49096](https://github.com/pingcap/tidb/issues/49096) @[AilinKid](https://github.com/AilinKid})
- Fix the issue that queries containing common table expressions (CTEs) unexpectedly get stuck when the memory limit is exceeded [#49096](https://github.com/pingcap/tidb/issues/49096) @[AilinKid](https://github.com/AilinKid)
- Fix the issue that high CPU usage of TiDB occurs due to long-term memory pressure caused by `tidb_server_memory_limit` [#48741](https://github.com/pingcap/tidb/issues/48741) @[XuHuaiyu](https://github.com/XuHuaiyu)
- Fix the issue that queries containing CTEs report `runtime error: index out of range [32] with length 32` when `tidb_max_chunk_size` is set to a small value [#48808](https://github.com/pingcap/tidb/issues/48808) @[guo-shaoge](https://github.com/guo-shaoge)
- Fix the issue that the query result is incorrect when an `ENUM` type column is used as the join key [#48991](https://github.com/pingcap/tidb/issues/48991) @[winoros](https://github.com/winoros)
Expand Down
2 changes: 1 addition & 1 deletion releases/release-timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This document shows all the released TiDB versions in reverse chronological orde
| Version | Release Date |
| :--- | :--- |
| [6.5.9](/releases/release-6.5.9.md) | 2024-04-12 |
| [8.0.0](/releases/release-8.0.0.md) | 2024-03-29 |
| [8.0.0-DMR](/releases/release-8.0.0.md) | 2024-03-29 |
| [7.1.4](/releases/release-7.1.4.md) | 2024-03-11 |
| [7.5.1](/releases/release-7.5.1.md) | 2024-02-29 |
| [6.5.8](/releases/release-6.5.8.md) | 2024-02-02 |
Expand Down
19 changes: 4 additions & 15 deletions sql-statements/sql-statement-set-default-role.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,10 @@ This statement sets a specific role to be applied to a user by default. Thus, th

## Synopsis

**SetDefaultRoleStmt:**

![SetDefaultRoleStmt](/media/sqlgram/SetDefaultRoleStmt.png)

**SetDefaultRoleOpt:**

![SetDefaultRoleOpt](/media/sqlgram/SetDefaultRoleOpt.png)

**RolenameList:**

![RolenameList](/media/sqlgram/RolenameList.png)

**UsernameList:**

![UsernameList](/media/sqlgram/UsernameList.png)
```ebnf+diagram
SetDefaultRoleStmt ::=
"SET" "DEFAULT" "ROLE" ( "NONE" | "ALL" | Rolename ("," Rolename)* ) "TO" Username ("," Username)*
```

## Examples

Expand Down
7 changes: 4 additions & 3 deletions sql-statements/sql-statement-set-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ This statement changes the user password for a user account in the TiDB system d

## Synopsis

**SetStmt:**

![SetStmt](/media/sqlgram/SetStmt.png)
```enbf+diagram
SetPasswordStmt ::=
"SET" "PASSWORD" ( "FOR" Username )? "=" ( stringLit | "PASSWORD" "(" stringLit ")" )
```

## Examples

Expand Down
29 changes: 7 additions & 22 deletions sql-statements/sql-statement-show-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,17 @@ The `SHOW BINDINGS` statement is used to display information about created SQL b

## Synopsis

**ShowStmt:**
```ebnf+diagram
ShowBindingsStmt ::=
"SHOW" ("GLOBAL" | "SESSION")? "BINDINGS" ShowLikeOrWhere?
![ShowStmt](/media/sqlgram/ShowStmt.png)

**ShowTargetFilterable:**

![ShowTargetFilterable](/media/sqlgram/ShowTargetFilterable.png)

**GlobalScope:**

![GlobalScope](/media/sqlgram/GlobalScope.png)

**ShowLikeOrWhereOpt**

![ShowLikeOrWhereOpt](/media/sqlgram/ShowLikeOrWhereOpt.png)
ShowLikeOrWhere ::=
"LIKE" SimpleExpr
| "WHERE" Expression
```

## Syntax description

{{< copyable "sql" >}}

```sql
SHOW [GLOBAL | SESSION] BINDINGS [ShowLikeOrWhereOpt];
```

This statement outputs the execution plan bindings at the GLOBAL or SESSION level. The default scope is SESSION. Currently `SHOW BINDINGS` outputs eight columns, as shown below:

| Column Name | Description |
Expand All @@ -50,8 +37,6 @@ This statement outputs the execution plan bindings at the GLOBAL or SESSION leve

## Examples

{{< copyable "sql" >}}

```sql
mysql> CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY auto_increment,
Expand Down
9 changes: 4 additions & 5 deletions sql-statements/sql-statement-show-builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ aliases: ['/docs/dev/sql-statements/sql-statement-show-builtins/']

## Synopsis

**ShowBuiltinsStmt:**

![ShowBuiltinsStmt](/media/sqlgram/ShowBuiltinsStmt.png)
```ebnf+diagram
ShowBuiltinsStmt ::=
"SHOW" "BUILTINS"
```

## Examples

{{< copyable "sql" >}}

```sql
SHOW BUILTINS;
```
Expand Down
46 changes: 39 additions & 7 deletions sql-statements/sql-statement-show-character-set.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ This statement provides a static list of available character sets in TiDB. The o

## Synopsis

**ShowCharsetStmt:**
```ebnf+diagram
ShowCharsetStmt ::=
"SHOW" ( ("CHARACTER" | "CHAR") "SET" | "CHARSET" ) ShowLikeOrWhere?
![ShowCharsetStmt](/media/sqlgram/ShowCharsetStmt.png)

**CharsetKw:**

![CharsetKw](/media/sqlgram/CharsetKw.png)
ShowLikeOrWhere ::=
"LIKE" SimpleExpr
| "WHERE" Expression
```

## Examples

```sql
mysql> SHOW CHARACTER SET;
SHOW CHARACTER SET;
```

```
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
Expand All @@ -34,6 +38,34 @@ mysql> SHOW CHARACTER SET;
5 rows in set (0.00 sec)
```

```sql
SHOW CHARACTER SET LIKE 'utf8%';
```

```
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_bin | 3 |
| utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
+---------+---------------+-------------------+--------+
2 rows in set (0.00 sec)
```

```sql
SHOW CHARACTER SET WHERE Description='UTF-8 Unicode';
```

```
+---------+---------------+-------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+---------------+-------------------+--------+
| utf8 | UTF-8 Unicode | utf8_bin | 3 |
| utf8mb4 | UTF-8 Unicode | utf8mb4_bin | 4 |
+---------+---------------+-------------------+--------+
2 rows in set (0.00 sec)
```

## MySQL compatibility

The usage of `SHOW CHARACTER SET` statement in TiDB is fully compatible with MySQL. However, charsets in TiDB might have different default collations compared with MySQL. For details, refer to [Compatibility with MySQL](/mysql-compatibility.md). If you find any compatibility differences, [report a bug](https://docs.pingcap.com/tidb/stable/support).
Expand Down

0 comments on commit 580e2a1

Please sign in to comment.