Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into migrate_from_vitess
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Nov 26, 2023
2 parents 64dd90c + 7b67cc8 commit f7b5e08
Show file tree
Hide file tree
Showing 61 changed files with 970 additions and 265 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: cron

on:
# schedule:
# - cron: "30 15 */3 * *"
schedule:
- cron: "0 9 * * 3"
workflow_dispatch:

jobs:
Expand Down
26 changes: 12 additions & 14 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
- [`BEGIN`](/sql-statements/sql-statement-begin.md)
- [`CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md)
- [`COMMIT`](/sql-statements/sql-statement-commit.md)
- [`CREATE [GLOBAL|SESSION] BINDING`](/sql-statements/sql-statement-create-binding.md)
- [`CREATE BINDING`](/sql-statements/sql-statement-create-binding.md)
- [`CREATE DATABASE`](/sql-statements/sql-statement-create-database.md)
- [`CREATE INDEX`](/sql-statements/sql-statement-create-index.md)
- [`CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-create-placement-policy.md)
Expand All @@ -365,7 +365,7 @@
- [`DESC`](/sql-statements/sql-statement-desc.md)
- [`DESCRIBE`](/sql-statements/sql-statement-describe.md)
- [`DO`](/sql-statements/sql-statement-do.md)
- [`DROP [GLOBAL|SESSION] BINDING`](/sql-statements/sql-statement-drop-binding.md)
- [`DROP BINDING`](/sql-statements/sql-statement-drop-binding.md)
- [`DROP COLUMN`](/sql-statements/sql-statement-drop-column.md)
- [`DROP DATABASE`](/sql-statements/sql-statement-drop-database.md)
- [`DROP INDEX`](/sql-statements/sql-statement-drop-index.md)
Expand All @@ -389,11 +389,11 @@
- [`GRANT <privileges>`](/sql-statements/sql-statement-grant-privileges.md)
- [`GRANT <role>`](/sql-statements/sql-statement-grant-role.md)
- [`INSERT`](/sql-statements/sql-statement-insert.md)
- [`KILL [TIDB]`](/sql-statements/sql-statement-kill.md)
- [`KILL`](/sql-statements/sql-statement-kill.md)
- [`LOAD DATA`](/sql-statements/sql-statement-load-data.md)
- [`LOAD STATS`](/sql-statements/sql-statement-load-stats.md)
- [`LOCK STATS`](/sql-statements/sql-statement-lock-stats.md)
- [`LOCK TABLES` and `UNLOCK TABLES`](/sql-statements/sql-statement-lock-tables-and-unlock-tables.md)
- [`[LOCK|UNLOCK] TABLES`](/sql-statements/sql-statement-lock-tables-and-unlock-tables.md)
- [`MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md)
- [`PREPARE`](/sql-statements/sql-statement-prepare.md)
- [`QUERY WATCH`](/sql-statements/sql-statement-query-watch.md)
Expand All @@ -414,14 +414,14 @@
- [`SET RESOURCE GROUP`](/sql-statements/sql-statement-set-resource-group.md)
- [`SET ROLE`](/sql-statements/sql-statement-set-role.md)
- [`SET TRANSACTION`](/sql-statements/sql-statement-set-transaction.md)
- [`SET [GLOBAL|SESSION] <variable>`](/sql-statements/sql-statement-set-variable.md)
- [`SET <variable>`](/sql-statements/sql-statement-set-variable.md)
- [`SHOW ANALYZE STATUS`](/sql-statements/sql-statement-show-analyze-status.md)
- [`SHOW [BACKUPS|RESTORES]`](/sql-statements/sql-statement-show-backups.md)
- [`SHOW [GLOBAL|SESSION] BINDINGS`](/sql-statements/sql-statement-show-bindings.md)
- [`SHOW BINDINGS`](/sql-statements/sql-statement-show-bindings.md)
- [`SHOW BUILTINS`](/sql-statements/sql-statement-show-builtins.md)
- [`SHOW CHARACTER SET`](/sql-statements/sql-statement-show-character-set.md)
- [`SHOW COLLATION`](/sql-statements/sql-statement-show-collation.md)
- [`SHOW [FULL] COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md)
- [`SHOW COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md)
- [`SHOW CREATE DATABASE`](/sql-statements/sql-statement-show-create-database.md)
- [`SHOW CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-show-create-placement-policy.md)
- [`SHOW CREATE RESOURCE GROUP`](/sql-statements/sql-statement-show-create-resource-group.md)
Expand All @@ -431,18 +431,16 @@
- [`SHOW DATABASES`](/sql-statements/sql-statement-show-databases.md)
- [`SHOW ENGINES`](/sql-statements/sql-statement-show-engines.md)
- [`SHOW ERRORS`](/sql-statements/sql-statement-show-errors.md)
- [`SHOW [FULL] FIELDS FROM`](/sql-statements/sql-statement-show-fields-from.md)
- [`SHOW FIELDS FROM`](/sql-statements/sql-statement-show-fields-from.md)
- [`SHOW GRANTS`](/sql-statements/sql-statement-show-grants.md)
- [`SHOW INDEX [FROM|IN]`](/sql-statements/sql-statement-show-index.md)
- [`SHOW INDEXES [FROM|IN]`](/sql-statements/sql-statement-show-indexes.md)
- [`SHOW KEYS [FROM|IN]`](/sql-statements/sql-statement-show-keys.md)
- [`SHOW INDEXES`](/sql-statements/sql-statement-show-indexes.md)
- [`SHOW MASTER STATUS`](/sql-statements/sql-statement-show-master-status.md)
- [`SHOW PLACEMENT`](/sql-statements/sql-statement-show-placement.md)
- [`SHOW PLACEMENT FOR`](/sql-statements/sql-statement-show-placement-for.md)
- [`SHOW PLACEMENT LABELS`](/sql-statements/sql-statement-show-placement-labels.md)
- [`SHOW PLUGINS`](/sql-statements/sql-statement-show-plugins.md)
- [`SHOW PRIVILEGES`](/sql-statements/sql-statement-show-privileges.md)
- [`SHOW [FULL] PROCESSSLIST`](/sql-statements/sql-statement-show-processlist.md)
- [`SHOW PROCESSSLIST`](/sql-statements/sql-statement-show-processlist.md)
- [`SHOW PROFILES`](/sql-statements/sql-statement-show-profiles.md)
- [`SHOW SCHEMAS`](/sql-statements/sql-statement-show-schemas.md)
- [`SHOW STATS_HEALTHY`](/sql-statements/sql-statement-show-stats-healthy.md)
Expand All @@ -453,8 +451,8 @@
- [`SHOW TABLE NEXT_ROW_ID`](/sql-statements/sql-statement-show-table-next-rowid.md)
- [`SHOW TABLE REGIONS`](/sql-statements/sql-statement-show-table-regions.md)
- [`SHOW TABLE STATUS`](/sql-statements/sql-statement-show-table-status.md)
- [`SHOW [FULL] TABLES`](/sql-statements/sql-statement-show-tables.md)
- [`SHOW [GLOBAL|SESSION] VARIABLES`](/sql-statements/sql-statement-show-variables.md)
- [`SHOW TABLES`](/sql-statements/sql-statement-show-tables.md)
- [`SHOW VARIABLES`](/sql-statements/sql-statement-show-variables.md)
- [`SHOW WARNINGS`](/sql-statements/sql-statement-show-warnings.md)
- [`SPLIT REGION`](/sql-statements/sql-statement-split-region.md)
- [`START TRANSACTION`](/sql-statements/sql-statement-start-transaction.md)
Expand Down
26 changes: 12 additions & 14 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
- [`COMMIT`](/sql-statements/sql-statement-commit.md)
- [`CHANGE DRAINER`](/sql-statements/sql-statement-change-drainer.md)
- [`CHANGE PUMP`](/sql-statements/sql-statement-change-pump.md)
- [`CREATE [GLOBAL|SESSION] BINDING`](/sql-statements/sql-statement-create-binding.md)
- [`CREATE BINDING`](/sql-statements/sql-statement-create-binding.md)
- [`CREATE DATABASE`](/sql-statements/sql-statement-create-database.md)
- [`CREATE INDEX`](/sql-statements/sql-statement-create-index.md)
- [`CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-create-placement-policy.md)
Expand All @@ -741,7 +741,7 @@
- [`DESC`](/sql-statements/sql-statement-desc.md)
- [`DESCRIBE`](/sql-statements/sql-statement-describe.md)
- [`DO`](/sql-statements/sql-statement-do.md)
- [`DROP [GLOBAL|SESSION] BINDING`](/sql-statements/sql-statement-drop-binding.md)
- [`DROP BINDING`](/sql-statements/sql-statement-drop-binding.md)
- [`DROP COLUMN`](/sql-statements/sql-statement-drop-column.md)
- [`DROP DATABASE`](/sql-statements/sql-statement-drop-database.md)
- [`DROP INDEX`](/sql-statements/sql-statement-drop-index.md)
Expand All @@ -766,11 +766,11 @@
- [`GRANT <role>`](/sql-statements/sql-statement-grant-role.md)
- [`IMPORT INTO`](/sql-statements/sql-statement-import-into.md)
- [`INSERT`](/sql-statements/sql-statement-insert.md)
- [`KILL [TIDB]`](/sql-statements/sql-statement-kill.md)
- [`KILL`](/sql-statements/sql-statement-kill.md)
- [`LOAD DATA`](/sql-statements/sql-statement-load-data.md)
- [`LOAD STATS`](/sql-statements/sql-statement-load-stats.md)
- [`LOCK STATS`](/sql-statements/sql-statement-lock-stats.md)
- [`LOCK TABLES` and `UNLOCK TABLES`](/sql-statements/sql-statement-lock-tables-and-unlock-tables.md)
- [`[LOCK|UNLOCK] TABLES`](/sql-statements/sql-statement-lock-tables-and-unlock-tables.md)
- [`MODIFY COLUMN`](/sql-statements/sql-statement-modify-column.md)
- [`PREPARE`](/sql-statements/sql-statement-prepare.md)
- [`QUERY WATCH`](/sql-statements/sql-statement-query-watch.md)
Expand All @@ -791,14 +791,14 @@
- [`SET RESOURCE GROUP`](/sql-statements/sql-statement-set-resource-group.md)
- [`SET ROLE`](/sql-statements/sql-statement-set-role.md)
- [`SET TRANSACTION`](/sql-statements/sql-statement-set-transaction.md)
- [`SET [GLOBAL|SESSION] <variable>`](/sql-statements/sql-statement-set-variable.md)
- [`SET <variable>`](/sql-statements/sql-statement-set-variable.md)
- [`SHOW ANALYZE STATUS`](/sql-statements/sql-statement-show-analyze-status.md)
- [`SHOW [BACKUPS|RESTORES]`](/sql-statements/sql-statement-show-backups.md)
- [`SHOW [GLOBAL|SESSION] BINDINGS`](/sql-statements/sql-statement-show-bindings.md)
- [`SHOW BINDINGS`](/sql-statements/sql-statement-show-bindings.md)
- [`SHOW BUILTINS`](/sql-statements/sql-statement-show-builtins.md)
- [`SHOW CHARACTER SET`](/sql-statements/sql-statement-show-character-set.md)
- [`SHOW COLLATION`](/sql-statements/sql-statement-show-collation.md)
- [`SHOW [FULL] COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md)
- [`SHOW COLUMNS FROM`](/sql-statements/sql-statement-show-columns-from.md)
- [`SHOW CONFIG`](/sql-statements/sql-statement-show-config.md)
- [`SHOW CREATE DATABASE`](/sql-statements/sql-statement-show-create-database.md)
- [`SHOW CREATE PLACEMENT POLICY`](/sql-statements/sql-statement-show-create-placement-policy.md)
Expand All @@ -810,19 +810,17 @@
- [`SHOW DRAINER STATUS`](/sql-statements/sql-statement-show-drainer-status.md)
- [`SHOW ENGINES`](/sql-statements/sql-statement-show-engines.md)
- [`SHOW ERRORS`](/sql-statements/sql-statement-show-errors.md)
- [`SHOW [FULL] FIELDS FROM`](/sql-statements/sql-statement-show-fields-from.md)
- [`SHOW FIELDS FROM`](/sql-statements/sql-statement-show-fields-from.md)
- [`SHOW GRANTS`](/sql-statements/sql-statement-show-grants.md)
- [`SHOW IMPORT JOB`](/sql-statements/sql-statement-show-import-job.md)
- [`SHOW INDEX [FROM|IN]`](/sql-statements/sql-statement-show-index.md)
- [`SHOW INDEXES [FROM|IN]`](/sql-statements/sql-statement-show-indexes.md)
- [`SHOW KEYS [FROM|IN]`](/sql-statements/sql-statement-show-keys.md)
- [`SHOW INDEXES`](/sql-statements/sql-statement-show-indexes.md)
- [`SHOW MASTER STATUS`](/sql-statements/sql-statement-show-master-status.md)
- [`SHOW PLACEMENT`](/sql-statements/sql-statement-show-placement.md)
- [`SHOW PLACEMENT FOR`](/sql-statements/sql-statement-show-placement-for.md)
- [`SHOW PLACEMENT LABELS`](/sql-statements/sql-statement-show-placement-labels.md)
- [`SHOW PLUGINS`](/sql-statements/sql-statement-show-plugins.md)
- [`SHOW PRIVILEGES`](/sql-statements/sql-statement-show-privileges.md)
- [`SHOW [FULL] PROCESSSLIST`](/sql-statements/sql-statement-show-processlist.md)
- [`SHOW PROCESSSLIST`](/sql-statements/sql-statement-show-processlist.md)
- [`SHOW PROFILES`](/sql-statements/sql-statement-show-profiles.md)
- [`SHOW PUMP STATUS`](/sql-statements/sql-statement-show-pump-status.md)
- [`SHOW SCHEMAS`](/sql-statements/sql-statement-show-schemas.md)
Expand All @@ -834,8 +832,8 @@
- [`SHOW TABLE NEXT_ROW_ID`](/sql-statements/sql-statement-show-table-next-rowid.md)
- [`SHOW TABLE REGIONS`](/sql-statements/sql-statement-show-table-regions.md)
- [`SHOW TABLE STATUS`](/sql-statements/sql-statement-show-table-status.md)
- [`SHOW [FULL] TABLES`](/sql-statements/sql-statement-show-tables.md)
- [`SHOW [GLOBAL|SESSION] VARIABLES`](/sql-statements/sql-statement-show-variables.md)
- [`SHOW TABLES`](/sql-statements/sql-statement-show-tables.md)
- [`SHOW VARIABLES`](/sql-statements/sql-statement-show-variables.md)
- [`SHOW WARNINGS`](/sql-statements/sql-statement-show-warnings.md)
- [`SHUTDOWN`](/sql-statements/sql-statement-shutdown.md)
- [`SPLIT REGION`](/sql-statements/sql-statement-split-region.md)
Expand Down
45 changes: 34 additions & 11 deletions backup-and-restore-using-dumpling-lightning.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ summary: Learn how to use Dumpling and TiDB Lightning to back up and restore ful

This document introduces how to use Dumpling and TiDB Lightning to back up and restore full data of TiDB.

If you need to back up a small amount of data (for example, less than 50 GB) and do not require high backup speed, you can use [Dumpling](/dumpling-overview.md) to export data from the TiDB database and then use [TiDB Lightning](/tidb-lightning/tidb-lightning-overview.md) to import the data into another TiDB database. For more information about backup and restore, see [TiDB Backup & Restore Overview](/br/backup-and-restore-overview.md).
If you need to back up a small amount of data (for example, less than 50 GiB) and do not require high backup speed, you can use [Dumpling](/dumpling-overview.md) to export data from the TiDB database and then use [TiDB Lightning](/tidb-lightning/tidb-lightning-overview.md) to restore the data into another TiDB database.

If you need to back up larger databases, the recommended method is to use [BR](/br/backup-and-restore-overview.md). Note that Dumpling can be used to export large databases, but BR is a better tool for that.

## Requirements

- Install and start Dumpling:
- Install Dumpling:

```shell
tiup install dumpling && tiup dumpling
tiup install dumpling
```

- Install and start TiDB Lightning:
- Install TiDB Lightning:

```shell
tiup install tidb lightning && tiup tidb lightning
tiup install tidb-lightning
```

- [Grant the source database privileges required for Dumpling](/dumpling-overview.md#export-data-from-tidb-or-mysql)
Expand All @@ -41,14 +43,35 @@ If you need to save data of one backup task to the local disk, note the followin
- Dumpling requires a disk space that can store the whole data source (or to store all upstream tables to be exported). To calculate the required space, see [Downstream storage space requirements](/tidb-lightning/tidb-lightning-requirements.md#storage-space-of-the-target-database).
- During the import, TiDB Lightning needs temporary space to store the sorted key-value pairs. The disk space should be enough to hold the largest single table from the data source.

**Note**: It is difficult to calculate the exact data volume exported by Dumpling from MySQL, but you can estimate the data volume by using the following SQL statement to summarize the `data-length` field in the `information_schema.tables` table:
**Note**: It is difficult to calculate the exact data volume exported by Dumpling from MySQL, but you can estimate the data volume by using the following SQL statement to summarize the `DATA_LENGTH` field in the `information_schema.tables` table:

```sql
/* Calculate the size of all schemas, in MiB. Replace ${schema_name} with your schema name. */
SELECT table_schema,SUM(data_length)/1024/1024 AS data_length,SUM(index_length)/1024/1024 AS index_length,SUM(data_length+index_length)/1024/1024 AS SUM FROM information_schema.tables WHERE table_schema = "${schema_name}" GROUP BY table_schema;
/* Calculate the size of the largest table, in MiB. Replace ${schema_name} with your schema name. */
SELECT table_name,table_schema,SUM(data_length)/1024/1024 AS data_length,SUM(index_length)/1024/1024 AS index_length,SUM(data_length+index_length)/1024/1024 AS SUM from information_schema.tables WHERE table_schema = "${schema_name}" GROUP BY table_name,table_schema ORDER BY SUM DESC LIMIT 5;
-- Calculate the size of all schemas
SELECT
TABLE_SCHEMA,
FORMAT_BYTES(SUM(DATA_LENGTH)) AS 'Data Size',
FORMAT_BYTES(SUM(INDEX_LENGTH)) 'Index Size'
FROM
information_schema.tables
GROUP BY
TABLE_SCHEMA;
-- Calculate the 5 largest tables
SELECT
TABLE_NAME,
TABLE_SCHEMA,
FORMAT_BYTES(SUM(data_length)) AS 'Data Size',
FORMAT_BYTES(SUM(index_length)) AS 'Index Size',
FORMAT_BYTES(SUM(data_length+index_length)) AS 'Total Size'
FROM
information_schema.tables
GROUP BY
TABLE_NAME,
TABLE_SCHEMA
ORDER BY
SUM(DATA_LENGTH+INDEX_LENGTH) DESC
LIMIT
5;
```

### Disk space for the target TiKV cluster
Expand Down
2 changes: 1 addition & 1 deletion best-practices/massive-regions-best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ By default, `raftstore.store-pool-size` is configured to `2` in TiKV. If a bottl

### Method 2: Enable Hibernate Region

In the actual situation, read and write requests are not evenly distributed on every Region. Instead, they are concentrated on a few Regions. Then you can minimize the number of messages between the Raft leader and the followers for the temporarily idle Regions, which is the feature of Hibernate Region. In this feature, Raftstore does sent tick messages to the Raft state machines of idle Regions if not necessary. Then these Raft state machines will not be triggered to generate heartbeat messages, which can greatly reduce the workload of Raftstore.
In the actual situation, read and write requests are not evenly distributed on every Region. Instead, they are concentrated on a few Regions. Then you can minimize the number of messages between the Raft leader and the followers for the temporarily idle Regions, which is the feature of Hibernate Region. In this feature, Raftstore doesn't send tick messages to the Raft state machines of idle Regions if not necessary. Then these Raft state machines will not be triggered to generate heartbeat messages, which can greatly reduce the workload of Raftstore.

Hibernate Region is enabled by default in [TiKV master](https://github.com/tikv/tikv/tree/master). You can configure this feature according to your needs. For details, refer to [Configure Hibernate Region](/tikv-configuration-file.md).

Expand Down
2 changes: 1 addition & 1 deletion dashboard/continuous-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ All performance data in [Manual Profiling](/dashboard/dashboard-profiling.md#sup

- CPU: The CPU overhead of each internal function on TiDB, TiKV, TiFlash, and PD instances

- Heap: The memory consumption of each internal function on TiDB and PD instances
- Heap: The memory consumption of each internal function on TiDB, TiKV, and PD instances

- Mutex: The mutex contention states on TiDB and PD instances

Expand Down
2 changes: 1 addition & 1 deletion dashboard/dashboard-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following performance data are currently supported:

> The CPU overhead of TiKV and TiFlash instances is currently not supported in ARM architecture.
- Heap: The memory consumption of each internal function on TiDB and PD instances
- Heap: The memory consumption of each internal function on TiDB, TiKV, and PD instances

- Mutex: The mutex contention states on TiDB and PD instances

Expand Down
12 changes: 11 additions & 1 deletion develop/dev-guide-gui-datagrip.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,14 @@ Connect to your TiDB cluster depending on the TiDB deployment option you've sele

## Need help?

Ask questions on the [Discord](https://discord.gg/vYU9h56kAX), or [create a support ticket](https://support.pingcap.com/).
<CustomContent platform="tidb">

Ask questions on the [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc), or [create a support ticket](/support.md).

</CustomContent>

<CustomContent platform="tidb-cloud">

Ask questions on the [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc), or [create a support ticket](https://support.pingcap.com/).

</CustomContent>
12 changes: 11 additions & 1 deletion develop/dev-guide-gui-dbeaver.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,14 @@ Connect to your TiDB cluster depending on the TiDB deployment option you've sele

## Need help?

Ask questions on the [Discord](https://discord.gg/vYU9h56kAX), or [create a support ticket](https://support.pingcap.com/).
<CustomContent platform="tidb">

Ask questions on the [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc), or [create a support ticket](/support.md).

</CustomContent>

<CustomContent platform="tidb-cloud">

Ask questions on the [Discord](https://discord.gg/DQZ2dy3cuc?utm_source=doc), or [create a support ticket](https://support.pingcap.com/).

</CustomContent>
Loading

0 comments on commit f7b5e08

Please sign in to comment.