Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into pr/16599
Browse files Browse the repository at this point in the history
  • Loading branch information
qiancai committed Mar 27, 2024
2 parents d0e1772 + 5e9a4e3 commit 03d4c4b
Show file tree
Hide file tree
Showing 139 changed files with 3,341 additions and 787 deletions.
62 changes: 54 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ Welcome to [TiDB](https://github.com/pingcap/tidb) documentation! We are excited

## What you can contribute

🚀 To provide you with better TiDB documentation, we sincerely invite you to participate in the [2024 TiDB Docs Dash](https://www.pingcap.com/event/tidb-docs-dash/). In this event, you'll have a chance to work with other members of the community while making a meaningful impact on [TiDB documentation](https://docs.pingcap.com/tidb/stable/) and [TiDB Cloud documentation](https://docs.pingcap.com/tidbcloud/).

- **Dates/Time:** January 9 at 08:00 UTC ([your local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=TiDB+Docs+Dash+2024%3A+Start&iso=20240109T08&p1=1440)) – January 12 at 07:59 UTC ([your local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=TiDB+Docs+Dash+2024%3A+End&iso=20240112T0759&p1=1440))
- **Event details**: <https://www.pingcap.com/event/tidb-docs-dash/>
- **Issue list**: <https://github.com/orgs/pingcap/projects/51/views/3>
- **Participation introduction**: <https://github.com/pingcap/docs/issues/15479>

In addition to the issues and tasks in the event, you can also start from any one of the following items to help improve [TiDB Docs at the PingCAP website](https://docs.pingcap.com/tidb/stable):
You can start from any one of the following items to help improve [TiDB documentation at the PingCAP website](https://docs.pingcap.com/tidb/stable):

- Fix typos or format (punctuation, space, indentation, code block, etc.)
- Fix or update inappropriate or outdated descriptions
Expand Down Expand Up @@ -161,6 +154,59 @@ If your change fits one of the following situations, **CHOOSE THE AFFECTED RELEA
- Fixes format to resolve a display error
- Fixes broken links
## Guideline for contributing to TiDB Cloud documentation
Currently, the [TiDB Cloud documentation](https://docs.pingcap.com/tidbcloud/) is available only in English, and it is stored in the [release-7.5](https://github.com/pingcap/docs/tree/release-7.5/tidb-cloud) branch of this repository for reusing SQL documents and development documents of TiDB v7.5. Hence, to create a pull request for TiDB Cloud documentation, make sure that your PR is based on the [release-7.5](https://github.com/pingcap/docs/tree/release-7.5) branch.
> **Tip:**
>
> To learn which TiDB document is reused by TiDB Cloud, check the [TOC file of TiDB Cloud documentation](https://github.com/pingcap/docs/blob/release-7.5/TOC-tidb-cloud.md?plain=1).
>
> - If the path of a document in this file starts with `/tidb-cloud/`, it means that this document is only for TiDB Cloud.
> - If the path of a document in this file does not start with `/tidb-cloud/`, it means that this TiDB document is reused by TiDB Cloud.
In some TiDB documents that are reused by TiDB Cloud, you might notice `CustomContent` tags. These `CustomContent` tags are used to show the dedicated content of TiDB or TiDB Cloud.
For example:
```Markdown
## Restrictions
<CustomContent platform="tidb">
* The TiDB memory limit on the `INSERT INTO SELECT` statement can be adjusted using the system variable [`tidb_mem_quota_query`](/system-variables.md#tidb_mem_quota_query). Starting from v6.5.0, it is not recommended to use [`txn-total-size-limit`](/tidb-configuration-file.md#txn-total-size-limit) to control transaction memory size.
For more information, see [TiDB memory control](/configure-memory-usage.md).
</CustomContent>
<CustomContent platform="tidb-cloud">
* The TiDB memory limit on the `INSERT INTO SELECT` statement can be adjusted using the system variable [`tidb_mem_quota_query`](/system-variables.md#tidb_mem_quota_query). Starting from v6.5.0, it is not recommended to use [`txn-total-size-limit`](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#txn-total-size-limit) to control transaction memory size.
For more information, see [TiDB memory control](https://docs.pingcap.com/tidb/stable/configure-memory-usage).
</CustomContent>
* TiDB has no hard limit on the concurrency of the `INSERT INTO SELECT` statement, but it is recommended to consider the following practices:
* When a "write transaction" is large, such as close to 1 GiB, it is recommended to control concurrency to no more than 10.
* When a "write transaction" is small, such as less than 100 MiB, it is recommended to control concurrency to no more than 30.
* Determine the concurrency based on testing results and specific circumstances.
```

In the example:

- The content within the `<CustomContent platform="tidb">` tag is only applicable to TiDB and will not be displayed on the [TiDB Cloud documentation](https://docs.pingcap.com/tidbcloud/) website.
- The content within the `<CustomContent platform="tidb-cloud">`tag is only applicable to TiDB Cloud and will not be displayed on the [TiDB documentation](https://docs.pingcap.com/tidb/stable) website.
- The content that are not wrapped by `<CustomContent>` tag are applicable to both TiDB and TiDB Cloud and will be displayed on both documentation websites.

## Guideline for previewing EBNF diagrams

[TiDB documentation](https://docs.pingcap.com/tidb/stable) provides a lot of SQL synopsis diagrams to help users understand the SQL syntax. For example, you can find the synopsis diagrams for the `ALTER INDEX` statement [here](https://docs.pingcap.com/tidb/stable/sql-statement-alter-index#synopsis).

The source of these synopsis diagrams is written using [extended Backus–Naur form (EBNF)](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form). When preparing the EBNF code for a SQL statement, you can easily preview the EBNF diagram by copying the code to <https://kennytm.github.io/website-docs/dist/> and clicking **Render**.

## Contact

Join [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc) for discussion.
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ approvers:
- dragonly
- en-jin19
- hfxsd
- Icemap
- jackysp
- kissmydb
- lance6716
Expand Down Expand Up @@ -40,7 +41,6 @@ reviewers:
- ericsyh
- glkappe
- GMHDBJD
- Icemap
- Joyinqin
- junlan-zhang
- KanShiori
Expand Down
3 changes: 2 additions & 1 deletion TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@
- [`TABLE_STORAGE_STATS`](/information-schema/information-schema-table-storage-stats.md)
- [`TIDB_HOT_REGIONS_HISTORY`](/information-schema/information-schema-tidb-hot-regions-history.md)
- [`TIDB_INDEXES`](/information-schema/information-schema-tidb-indexes.md)
- [`TIDB_INDEX_USAGE`](/information-schema/information-schema-tidb-index-usage.md)
- [`TIDB_SERVERS_INFO`](/information-schema/information-schema-tidb-servers-info.md)
- [`TIDB_TRX`](/information-schema/information-schema-tidb-trx.md)
- [`TIFLASH_REPLICA`](/information-schema/information-schema-tiflash-replica.md)
Expand All @@ -602,7 +603,7 @@
- [`SESSION_CONNECT_ATTRS`](/performance-schema/performance-schema-session-connect-attrs.md)
- [Metadata Lock](/metadata-lock.md)
- [Use UUIDs](/best-practices/uuid.md)
- [TiDB DDL V2](/ddl-v2.md)
- [TiDB Accelerated Table Creation](/accelerated-table-creation.md)
- [System Variables](/system-variables.md)
- [Server Status Variables](/status-variables.md)
- Storage Engines
Expand Down
12 changes: 10 additions & 2 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
- [Use Load Base Split](/configure-load-base-split.md)
- [Use Store Limit](/configure-store-limit.md)
- [DDL Execution Principles and Best Practices](/ddl-introduction.md)
- [Use PD Microservices](/pd-microservices.md)
- TiDB Tools
- [Overview](/ecosystem-tool-user-guide.md)
- [Use Cases](/ecosystem-tool-user-case.md)
Expand Down Expand Up @@ -446,6 +447,7 @@
- [Binlog Event Filter](/dm/dm-binlog-event-filter.md)
- [Filter DMLs Using SQL Expressions](/dm/feature-expression-filter.md)
- [Online DDL Tool Support](/dm/dm-online-ddl-tool-support.md)
- [Customize a Secret Key for Encryption and Decryption](/dm/dm-customized-secret-key.md)
- Manage a Data Migration Task
- [Precheck a Task](/dm/dm-precheck.md)
- [Create a Task](/dm/dm-create-task.md)
Expand Down Expand Up @@ -575,8 +577,10 @@
- Output Protocols
- [TiCDC Avro Protocol](/ticdc/ticdc-avro-protocol.md)
- [TiCDC Canal-JSON Protocol](/ticdc/ticdc-canal-json.md)
- [TiCDC Open Protocol](/ticdc/ticdc-open-protocol.md)
- [TiCDC CSV Protocol](/ticdc/ticdc-csv.md)
- [TiCDC Debezium Protocol](/ticdc/ticdc-debezium.md)
- [TiCDC Open Protocol](/ticdc/ticdc-open-protocol.md)
- [TiCDC Simple Protocol](/ticdc/ticdc-simple-protocol.md)
- [TiCDC Open API v2](/ticdc/ticdc-open-api-v2.md)
- [TiCDC Open API v1](/ticdc/ticdc-open-api.md)
- TiCDC Data Consumption
Expand Down Expand Up @@ -960,6 +964,7 @@
- [`TIDB_HOT_REGIONS`](/information-schema/information-schema-tidb-hot-regions.md)
- [`TIDB_HOT_REGIONS_HISTORY`](/information-schema/information-schema-tidb-hot-regions-history.md)
- [`TIDB_INDEXES`](/information-schema/information-schema-tidb-indexes.md)
- [`TIDB_INDEX_USAGE`](/information-schema/information-schema-tidb-index-usage.md)
- [`TIDB_SERVERS_INFO`](/information-schema/information-schema-tidb-servers-info.md)
- [`TIDB_TRX`](/information-schema/information-schema-tidb-trx.md)
- [`TIFLASH_REPLICA`](/information-schema/information-schema-tiflash-replica.md)
Expand All @@ -976,8 +981,9 @@
- PERFORMANCE_SCHEMA
- [Overview](/performance-schema/performance-schema.md)
- [`SESSION_CONNECT_ATTRS`](/performance-schema/performance-schema-session-connect-attrs.md)
- [`SYS`](/sys-schema.md)
- [Metadata Lock](/metadata-lock.md)
- [TiDB DDL V2](/ddl-v2.md)
- [TiDB Accelerated Table Creation](/accelerated-table-creation.md)
- UI
- TiDB Dashboard
- [Overview](/dashboard/dashboard-intro.md)
Expand Down Expand Up @@ -1035,6 +1041,7 @@
- v7.6
- [7.6.0](/releases/release-7.6.0.md)
- v7.5
- [7.5.1](/releases/release-7.5.1.md)
- [7.5.0](/releases/release-7.5.0.md)
- v7.4
- [7.4.0-DMR](/releases/release-7.4.0.md)
Expand All @@ -1043,6 +1050,7 @@
- v7.2
- [7.2.0-DMR](/releases/release-7.2.0.md)
- v7.1
- [7.1.4](/releases/release-7.1.4.md)
- [7.1.3](/releases/release-7.1.3.md)
- [7.1.2](/releases/release-7.1.2.md)
- [7.1.1](/releases/release-7.1.1.md)
Expand Down
57 changes: 57 additions & 0 deletions accelerated-table-creation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: TiDB Accelerated Table Creation
summary: Learn the concept, principles, and implementation details of performance optimization for creating tables in TiDB.
aliases: ['/tidb/dev/ddl-v2/']
---

# TiDB Accelerated Table Creation

TiDB v7.6.0 introduces the system variable [`tidb_ddl_version`](https://docs.pingcap.com/tidb/v7.6/system-variables#tidb_enable_fast_create_table-new-in-v800) to support accelerating table creation, which improves the efficiency of bulk table creation. Starting from v8.0.0, this system variable is renamed to [`tidb_enable_fast_create_table`](/system-variables.md#tidb_enable_fast_create_table-new-in-v800).

TiDB uses the online asynchronous schema change algorithm to change the metadata. All DDL jobs are submitted to the `mysql.tidb_ddl_job` table, and the owner node pulls the DDL job to execute. After executing each phase of the online DDL algorithm, the DDL job is marked as completed and moved to the `mysql.tidb_ddl_history` table. Therefore, DDL statements can only be executed on the owner node and cannot be linearly extended.

However, for some DDL statements, it is not necessary to strictly follow the online DDL algorithm. For example, the `CREATE TABLE` statement only has two states for the job: `none` and `public`. Therefore, TiDB can simplify the execution process of DDL, and executes the `CREATE TABLE` statement on a non-owner node to accelerate table creation.

> **Warning:**
>
> This feature is currently an experimental feature and it is not recommended to use in a production environment. This feature might change or be removed without prior notice. If you find a bug, please give feedback by raising an [issue](https://github.com/pingcap/tidb/issues) on GitHub.
## Compatibility with TiDB tools

- [TiCDC](https://docs.pingcap.com/tidb/stable/ticdc-overview) does not support replicating the tables that are created by `tidb_enable_fast_create_table`.

## Limitation

You can now use performance optimization for table creation only in the [`CREATE TABLE`](/sql-statements/sql-statement-create-table.md) statement, and this statement must not include any foreign key constraints.

## Use `tidb_enable_fast_create_table` to accelerate table creation

You can enable or disable performance optimization for creating tables by specifying the value of the system variable [`tidb_enable_fast_create_table`](/system-variables.md#tidb_enable_fast_create_table-new-in-v800).

To enable performance optimization for creating tables, set the value of this variable to `ON`:

```sql
SET GLOBAL tidb_enable_fast_create_table = ON;
```

To disable performance optimization for creating tables, set the value of this variable to `OFF`:

```sql
SET GLOBAL tidb_enable_fast_create_table = OFF;
```

## Implementation principle

The detailed implementation principle of performance optimization for table creation is as follows:

1. Create a `CREATE TABLE` Job.

The corresponding DDL Job is generated by parsing the `CREATE TABLE` statement.

2. Execute the `CREATE TABLE` job.

The TiDB node that receives the `CREATE TABLE` statement executes it directly, and then persists the table structure to TiKV. At the same time, the `CREATE TABLE` job is marked as completed and inserted into the `mysql.tidb_ddl_history` table.

3. Synchronize the table information.

TiDB notifies other nodes to synchronize the newly created table structure.
6 changes: 3 additions & 3 deletions basic-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ You can try out TiDB features on [TiDB Playground](https://play.tidbcloud.com/?u
| [Metadata lock](/metadata-lock.md) | Y | Y | Y | Y | N | N | N | N | N | N | N |
| [`FLASHBACK CLUSTER`](/sql-statements/sql-statement-flashback-cluster.md) | Y | Y | Y | Y | N | N | N | N | N | N | N |
| [Pause](/sql-statements/sql-statement-admin-pause-ddl.md)/[Resume](/sql-statements/sql-statement-admin-resume-ddl.md) DDL | Y | Y | N | N | N | N | N | N | N | N | N |
| [TiDB DDL V2](/ddl-v2.md) | E | N | N | N | N | N | N | N | N | N | N |
| [TiDB Accelerated Table Creation](/accelerated-table-creation.md) | N | N | N | N | N | N | N | N | N | N | N |

## Transactions

Expand Down Expand Up @@ -180,7 +180,7 @@ You can try out TiDB features on [TiDB Playground](https://play.tidbcloud.com/?u
| [Collect statistics for `PREDICATE COLUMNS`](/statistics.md#collect-statistics-on-some-columns) | E | E | E | E | E | E | E | N | N | N | N |
| [Control the memory quota for collecting statistics](/statistics.md#the-memory-quota-for-collecting-statistics) | E | E | E | E | E | N | N | N | N | N | N |
| [Randomly sample about 10000 rows of data to quickly build statistics](/system-variables.md#tidb_enable_fast_analyze) | Deprecated | Deprecated | E | E | E | E | E | E | E | E | E |
| [Lock statistics](/statistics.md#lock-statistics) | E | E | E | E | N | N | N | N | N | N | N |
| [Lock statistics](/statistics.md#lock-statistics) | Y | Y | E | E | N | N | N | N | N | N | N |
| [Lightweight statistics initialization](/statistics.md#load-statistics) | Y | Y | E | N | N | N | N | N | N | N | N |
| [Show the progress of collecting statistics](/sql-statements/sql-statement-show-analyze-status.md) | Y | Y | N | N | N | N | N | N | N | N | N |

Expand All @@ -194,7 +194,7 @@ You can try out TiDB features on [TiDB Playground](https://play.tidbcloud.com/?u
| [Certificate-based authentication](/certificate-authentication.md) | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y |
| [`caching_sha2_password` authentication](/system-variables.md#default_authentication_plugin) | Y | Y | Y | Y | Y | Y | Y | Y | N | N | N |
| [`tidb_sm3_password` authentication](/system-variables.md#default_authentication_plugin) | Y | Y | Y | Y | N | N | N | N | N | N | N |
| [`tidb_auth_token` authentication](/system-variables.md#default_authentication_plugin) | Y | Y | Y | Y | N | N | N | N | N | N | N |
| [`tidb_auth_token` authentication](/security-compatibility-with-mysql.md#tidb_auth_token) | Y | Y | Y | Y | N | N | N | N | N | N | N |
| [`authentication_ldap_sasl` authentication](/system-variables.md#default_authentication_plugin) | Y | Y | N | N | N | N | N | N | N | N |
| [`authentication_ldap_simple` authentication](/system-variables.md#default_authentication_plugin) | Y | Y | Y | N | N | N | N | N | N | N | N |
| [Password management](/password-management.md) | Y | Y | Y | Y | N | N | N | N | N | N | N |
Expand Down
4 changes: 2 additions & 2 deletions best-practices/haproxy-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ Before you deploy HAProxy, make sure that you meet the hardware and software req

### Hardware requirements

For your server, it is recommended to meet the following hardware requirements. You can also improve server specifications according to the load balancing environment.
According to the [HAProxy documentation](https://www.haproxy.com/documentation/haproxy-enterprise/getting-started/installation/linux/), the minimum hardware configuration for HAProxy is shown in the following table. Under the Sysbench `oltp_read_write` workload, the maximum QPS for this configuration is about 50K. You can increase the server configuration according to your load balancing environment.

| Hardware resource | Minimum specification |
| :--------------------- | :-------------------- |
| CPU | 2 cores, 3.5 GHz |
| Memory | 16 GB |
| Memory | 4 GB |
| Storage | 50 GB (SATA) |
| Network Interface Card | 10G Network Card |

Expand Down
8 changes: 7 additions & 1 deletion br/backup-and-restore-storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,10 @@ BR supports specifying the Azure server-side encryption scope or providing the e

## Other features supported by the storage service

BR v6.3.0 supports AWS [S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html). You can enable this feature to prevent backup data from being tampered with or deleted.
Amazon [S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) can help prevent backup data from accidental or intentional deletion during a specified retention period, enhancing the security and integrity of data. Starting from v6.3.0, BR supports Amazon S3 Object Lock for snapshot backups, adding an additional layer of security for full backups. Starting from v8.0.0, PITR also supports Amazon S3 Object Lock. Whether for full backups or log data backups, the Object Lock feature ensures more reliable data protection, further strengthening the security of data backup and recovery and meeting regulatory requirements.

BR and PITR automatically detect whether the Amazon S3 Object Lock feature is enabled or disabled. You do not need to perform any additional operations.

> **Warning:**
>
> If the Object Lock feature is enabled during the snapshot backup or PITR log backup process, the snapshot backup or log backup might fail. You need to restart the snapshot backup or PITR log backup task to continue the backup.
Loading

0 comments on commit 03d4c4b

Please sign in to comment.