From cda55bb7b90d6a52767321c0843adb5f61cafeec Mon Sep 17 00:00:00 2001 From: imtbkcat Date: Sun, 28 Jun 2020 13:22:07 +0800 Subject: [PATCH 01/23] update tidb-ctl doc --- tidb-control.md | 89 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/tidb-control.md b/tidb-control.md index a0aa13e87ee1b..32dd102e428bc 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -9,9 +9,17 @@ aliases: ['/docs/dev/tidb-control/','/docs/dev/reference/tools/tidb-control/'] TiDB Control is a command line tool of TiDB, usually used to obtain the status information of TiDB for debugging. -## Compile from source code +## Get TiDB Control -- Compilation environment requirement: [Go](https://golang.org/) Version 1.7 or later +This section describes tow method to get TiDB Control. + +### Install TiDB Control by TiUP + +After installing TiUP, you can use `tiup ctl tidb` command to get and execute TiDB Control. + +### Compile from source code + +- Compilation environment requirement: [Go](https://golang.org/) Version 1.13 or later - Compilation procedures: Go to the root directory of the [TiDB Control project](https://github.com/pingcap/tidb-ctl), use the `make` command to compile, and generate `tidb-ctl`. - Compilation documentation: you can find the help files in the `doc` directory; if the help files are lost or you want to update them, use the `make doc` command to generate the help files. @@ -32,15 +40,33 @@ Usage example: `tidb-ctl schema in mysql -n db` - `-n`: the option - `db`: the flag of `-n` +Currently, TiDB Control contains following commands: + +- `tidb-ctl base64decode`: BASE64 decode +- `tidb-ctl decoder`: for KEY decode +- `tidb-ctl etcd`: for operating etcd +- `tidb-ctl log`: format the log file to expand the single-line stack information +- `tidb-ctl mvcc`: MVCC information +- `tidb-ctl region`: Region information +- `tidb-ctl schema`: Schema information +- `tidb-ctl table`: Table information + ### Get help Use `tidb-ctl -h/--help` to get usage information. TiDB Control consists of multiple layers of commands. You can use `-h/--help` after each command/subcommand to get its respective usage information. -### Connect +The following example shows how to obtain the schema information: -`tidb-ctl` has 4 connection related options: +Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has two subcommands: `in` and `tid`. + +- `in` is used to obtain the table schema of all tables in the database through the database name. +- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. + +### Global options + +`tidb-ctl` has 7 connection related global options: - `--host`: TiDB Service address (default 127.0.0.1) - `--port`: TiDB Service port (default 10080) @@ -58,31 +84,20 @@ TiDB Control consists of multiple layers of commands. You can use `-h/--help` af **Connection options are global options that apply to all the following commands:** -- `tidb-ctl base64decode`: BASE64 decode -- `tidb-ctl decoder`: for KEY decode -- `tidb-ctl etcd`: for operating etcd -- `tidb-ctl log`: format the log file to expand the single-line stack information -- `tidb-ctl mvcc`: MVCC information -- `tidb-ctl region`: Region information -- `tidb-ctl schema`: Schema information -- `tidb-ctl table`: Table information - -For details about how to use the above `tidb-ctl` commands, use `tidb-ctl SUBCOMMAND --help` to get the help information. - -### Usage examples - -The following example shows how to obtain the schema information: - -Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has two subcommands: `in` and `tid`. - -- `in` is used to obtain the table schema of all tables in the database through the database name. -- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. +- `tidb-ctl base64decode` +- `tidb-ctl decoder` +- `tidb-ctl etcd` +- `tidb-ctl log` +- `tidb-ctl mvcc` +- `tidb-ctl region` +- `tidb-ctl schema` +- `tidb-ctl table` -#### The `in` command +### The `schema` connand. -You can use `tidb-ctl schema in -h/--help` to get the help information of the `in` subcommand. +#### The `in` subcommand -##### Basic usage +The `in` subcommand is used to get table information from target database. ```bash tidb-ctl schema in @@ -128,6 +143,28 @@ The result is displayed in the JSON format. (The above output is truncated.) If you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. For example, `tidb-ctl --host 172.16.55.88 --port 8898 schema in mysql -n db`. +#### The `tid` subcommand + +The `tid` subcommand is used to get table information and structure by table id. + +For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. + + +```json +{ + "id": 21, + "name": { + "O": "stats_meta", + "L": "stats_meta" + }, + "charset": "utf8mb4", + "collate": "utf8mb4_bin", + ... +} +``` +Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. + + #### The `base64decode` subcommand `base64decode` is used to decode `base64` data. From 5f132a5ea09947b5be5538fe29deb89bb3755436 Mon Sep 17 00:00:00 2001 From: imtbkcat Date: Sun, 28 Jun 2020 13:27:12 +0800 Subject: [PATCH 02/23] fix lint --- tidb-control.md | 1 - 1 file changed, 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 32dd102e428bc..e9756f75babfe 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -149,7 +149,6 @@ The `tid` subcommand is used to get table information and structure by table id. For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. - ```json { "id": 21, From 16aa5a5c53f266ec4c583266126939760781c5f8 Mon Sep 17 00:00:00 2001 From: imtbkcat Date: Sun, 28 Jun 2020 14:04:32 +0800 Subject: [PATCH 03/23] fix ci --- tidb-control.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tidb-control.md b/tidb-control.md index e9756f75babfe..e4147fbd554a8 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -93,7 +93,7 @@ Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has t - `tidb-ctl schema` - `tidb-ctl table` -### The `schema` connand. +### The `schema` connand #### The `in` subcommand @@ -161,8 +161,8 @@ For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl sche ... } ``` -Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. +Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. #### The `base64decode` subcommand From 34bbbb9e1ac66779f9488ea483dc37800a97102c Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:34:27 +0800 Subject: [PATCH 04/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index e4147fbd554a8..65928f90f9617 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -7,7 +7,7 @@ aliases: ['/docs/dev/tidb-control/','/docs/dev/reference/tools/tidb-control/'] # TiDB Control User Guide -TiDB Control is a command line tool of TiDB, usually used to obtain the status information of TiDB for debugging. +TiDB Control is a command-line tool of TiDB, usually used to obtain the status information of TiDB for debugging. This document introduces the features of TiDB Control and how to use these features. ## Get TiDB Control From 83f39b6e25bd12a8c0d903b0094771dd0b140e4b Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:34:55 +0800 Subject: [PATCH 05/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 65928f90f9617..a834c11ec66c6 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -11,7 +11,7 @@ TiDB Control is a command-line tool of TiDB, usually used to obtain the status i ## Get TiDB Control -This section describes tow method to get TiDB Control. +You can get TiDB Control using the following two methods. ### Install TiDB Control by TiUP From 242dd3b11a2379c35412d2e57f8ba4321f48a8ef Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:35:03 +0800 Subject: [PATCH 06/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index a834c11ec66c6..909a9ecfb66e5 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -13,7 +13,7 @@ TiDB Control is a command-line tool of TiDB, usually used to obtain the status i You can get TiDB Control using the following two methods. -### Install TiDB Control by TiUP +### Install TiDB Control using TiUP After installing TiUP, you can use `tiup ctl tidb` command to get and execute TiDB Control. From 0600ef887b7facf239cb55d36eaff09f82270d7f Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:35:11 +0800 Subject: [PATCH 07/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 909a9ecfb66e5..93ba7498ddbb9 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -40,7 +40,7 @@ Usage example: `tidb-ctl schema in mysql -n db` - `-n`: the option - `db`: the flag of `-n` -Currently, TiDB Control contains following commands: +Currently, TiDB Control has the following subcommands: - `tidb-ctl base64decode`: BASE64 decode - `tidb-ctl decoder`: for KEY decode From 5f1084eaf70cf3934ec6e44d08df5001eaff37b0 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:35:36 +0800 Subject: [PATCH 08/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 93ba7498ddbb9..4569657ad0cb2 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -42,7 +42,7 @@ Usage example: `tidb-ctl schema in mysql -n db` Currently, TiDB Control has the following subcommands: -- `tidb-ctl base64decode`: BASE64 decode +- `tidb-ctl base64decode`: used for `BASE64` decoding - `tidb-ctl decoder`: for KEY decode - `tidb-ctl etcd`: for operating etcd - `tidb-ctl log`: format the log file to expand the single-line stack information From a5f829210d96461540027dd7dfc94a98afcf0202 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:36:33 +0800 Subject: [PATCH 09/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 4569657ad0cb2..d487a86b4972c 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -164,7 +164,7 @@ For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl sche Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. -#### The `base64decode` subcommand +#### The `base64decode` command `base64decode` is used to decode `base64` data. From 2f7b81a3c9b835012d3acc7c549abd4dc831d321 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:36:44 +0800 Subject: [PATCH 10/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index d487a86b4972c..4ec9d2139fd9c 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -162,7 +162,7 @@ For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl sche } ``` -Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to configure. +Like the `in` subcommand, if you do not want to use the default TiDB service address and port, use the `--host` and `--port` options to specify the host and port. #### The `base64decode` command From 70fd16e31fc6b83b7993f1834ef7c3d91b6bda5e Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:36:53 +0800 Subject: [PATCH 11/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 4ec9d2139fd9c..5c0e37b26cc22 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -147,7 +147,7 @@ The result is displayed in the JSON format. (The above output is truncated.) The `tid` subcommand is used to get table information and structure by table id. -For example, the table id of `mysql.stat_meta` is 21, you can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. +For example, the table ID of `mysql.stat_meta` is `21`. You can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. ```json { From b20126b527e305bf736de125aebff42a059a3147 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:36:59 +0800 Subject: [PATCH 12/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 5c0e37b26cc22..914b710d0a2b9 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -145,7 +145,7 @@ The result is displayed in the JSON format. (The above output is truncated.) #### The `tid` subcommand -The `tid` subcommand is used to get table information and structure by table id. +- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. For example, the table ID of `mysql.stat_meta` is `21`. You can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. From b1a3a101036a7f72b1ae91378bf93904c99424f7 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:37:11 +0800 Subject: [PATCH 13/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 914b710d0a2b9..2e6e5f2c3c19d 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -45,7 +45,7 @@ Currently, TiDB Control has the following subcommands: - `tidb-ctl base64decode`: used for `BASE64` decoding - `tidb-ctl decoder`: for KEY decode - `tidb-ctl etcd`: for operating etcd -- `tidb-ctl log`: format the log file to expand the single-line stack information +- `tidb-ctl log`: used to format the log file to expand the single-line stack information - `tidb-ctl mvcc`: MVCC information - `tidb-ctl region`: Region information - `tidb-ctl schema`: Schema information From c0b3cac84107760890cb8e6509e9763326e9f8d9 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:37:22 +0800 Subject: [PATCH 14/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 2e6e5f2c3c19d..8bcec7e1d9618 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -66,7 +66,7 @@ Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has t ### Global options -`tidb-ctl` has 7 connection related global options: +`tidb-ctl` has the following connection-related global options: - `--host`: TiDB Service address (default 127.0.0.1) - `--port`: TiDB Service port (default 10080) From c6dc028549de0dd241afb62e8032975ed77012e1 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:37:43 +0800 Subject: [PATCH 15/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 8bcec7e1d9618..cc71a6da9a3bf 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -97,7 +97,7 @@ Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has t #### The `in` subcommand -The `in` subcommand is used to get table information from target database. +`in` is used to obtain the table schema of all tables in the database through the database name. ```bash tidb-ctl schema in From 0e90f45d06332592092b1d3cbaf4ff8021ccc7cb Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Mon, 6 Jul 2020 14:37:58 +0800 Subject: [PATCH 16/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index cc71a6da9a3bf..e7187575d9a16 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -93,7 +93,7 @@ Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has t - `tidb-ctl schema` - `tidb-ctl table` -### The `schema` connand +### The `schema` command #### The `in` subcommand From dd477c0803713610d7921b82cf9421ce9508f219 Mon Sep 17 00:00:00 2001 From: imtbkcat Date: Mon, 6 Jul 2020 15:05:40 +0800 Subject: [PATCH 17/23] address comment --- tidb-control.md | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/tidb-control.md b/tidb-control.md index e7187575d9a16..dea42efca6b3e 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -43,13 +43,13 @@ Usage example: `tidb-ctl schema in mysql -n db` Currently, TiDB Control has the following subcommands: - `tidb-ctl base64decode`: used for `BASE64` decoding -- `tidb-ctl decoder`: for KEY decode +- `tidb-ctl decoder`: used for `KEY` decoding - `tidb-ctl etcd`: for operating etcd - `tidb-ctl log`: used to format the log file to expand the single-line stack information -- `tidb-ctl mvcc`: MVCC information -- `tidb-ctl region`: Region information -- `tidb-ctl schema`: Schema information -- `tidb-ctl table`: Table information +- `tidb-ctl mvcc`: used to get the mvcc information +- `tidb-ctl region`: used to get the region information +- `tidb-ctl schema`: used to get the schema information +- `tidb-ctl table`: used to get the table information ### Get help @@ -82,17 +82,6 @@ Use `tidb-ctl schema -h` to get usage details. The `schema` command itself has t - The default service port of TiDB: `10080`. - The default service port of PD: `2379`. -**Connection options are global options that apply to all the following commands:** - -- `tidb-ctl base64decode` -- `tidb-ctl decoder` -- `tidb-ctl etcd` -- `tidb-ctl log` -- `tidb-ctl mvcc` -- `tidb-ctl region` -- `tidb-ctl schema` -- `tidb-ctl table` - ### The `schema` command #### The `in` subcommand @@ -145,7 +134,7 @@ The result is displayed in the JSON format. (The above output is truncated.) #### The `tid` subcommand -- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. +- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. you can use `in` subcommand to get all table id of certain schema and use `tid` subcommand to get detail table information. For example, the table ID of `mysql.stat_meta` is `21`. You can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. From 4afd63ad3186eebc1ceb03f80a5f0f945fdcbd18 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Fri, 10 Jul 2020 16:16:49 +0800 Subject: [PATCH 18/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index dea42efca6b3e..2f9dd5981a45b 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -11,7 +11,7 @@ TiDB Control is a command-line tool of TiDB, usually used to obtain the status i ## Get TiDB Control -You can get TiDB Control using the following two methods. +You can get TiDB Control by installing it using TiUP or by compiling it from source code. ### Install TiDB Control using TiUP From be4eb4903fa5214cc251c8d4c674887c9ed36d9d Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Fri, 10 Jul 2020 16:17:00 +0800 Subject: [PATCH 19/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 2f9dd5981a45b..8c385ccc3c265 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -46,7 +46,7 @@ Currently, TiDB Control has the following subcommands: - `tidb-ctl decoder`: used for `KEY` decoding - `tidb-ctl etcd`: for operating etcd - `tidb-ctl log`: used to format the log file to expand the single-line stack information -- `tidb-ctl mvcc`: used to get the mvcc information +- `tidb-ctl mvcc`: used to get the MVCC information - `tidb-ctl region`: used to get the region information - `tidb-ctl schema`: used to get the schema information - `tidb-ctl table`: used to get the table information From c986f300a3b80bea270d25951aaa1a53af5c7d23 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Fri, 10 Jul 2020 16:17:11 +0800 Subject: [PATCH 20/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 8c385ccc3c265..2802647e1c7e6 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -47,7 +47,7 @@ Currently, TiDB Control has the following subcommands: - `tidb-ctl etcd`: for operating etcd - `tidb-ctl log`: used to format the log file to expand the single-line stack information - `tidb-ctl mvcc`: used to get the MVCC information -- `tidb-ctl region`: used to get the region information +- `tidb-ctl region`: used to get the Region information - `tidb-ctl schema`: used to get the schema information - `tidb-ctl table`: used to get the table information From 8966cc1632e98599d47e3bfeb726ece6dc17f937 Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Fri, 10 Jul 2020 16:17:28 +0800 Subject: [PATCH 21/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 2802647e1c7e6..07d74d8ca1667 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -44,7 +44,7 @@ Currently, TiDB Control has the following subcommands: - `tidb-ctl base64decode`: used for `BASE64` decoding - `tidb-ctl decoder`: used for `KEY` decoding -- `tidb-ctl etcd`: for operating etcd +- `tidb-ctl etcd`: used for operating etcd - `tidb-ctl log`: used to format the log file to expand the single-line stack information - `tidb-ctl mvcc`: used to get the MVCC information - `tidb-ctl region`: used to get the Region information From d3e21175b4722acb98ec2835cddd1e8b0830881d Mon Sep 17 00:00:00 2001 From: Lingyu Song Date: Fri, 10 Jul 2020 16:17:39 +0800 Subject: [PATCH 22/23] Update tidb-control.md Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- tidb-control.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tidb-control.md b/tidb-control.md index 07d74d8ca1667..da035f674f144 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -134,7 +134,7 @@ The result is displayed in the JSON format. (The above output is truncated.) #### The `tid` subcommand -- `tid` is used to obtain the table schema by using the unique `table_id` in the whole database. you can use `in` subcommand to get all table id of certain schema and use `tid` subcommand to get detail table information. +`tid` is used to obtain the table schema by using the unique `table_id` in the whole database. You can use the `in` subcommand to get all table IDs of certain schema and use the `tid` subcommand to get the detailed table information. For example, the table ID of `mysql.stat_meta` is `21`. You can use `tidb-ctl schema tid -i 21` to obtain the detail of `mysql.stat_meta`. From b57ba7f945e0c2139ec95ab8812c3ed77e468314 Mon Sep 17 00:00:00 2001 From: imtbkcat Date: Fri, 10 Jul 2020 16:36:36 +0800 Subject: [PATCH 23/23] address comment --- tidb-control.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tidb-control.md b/tidb-control.md index da035f674f144..2b3d408f3b54e 100644 --- a/tidb-control.md +++ b/tidb-control.md @@ -229,25 +229,27 @@ tidb-ctl base64decode [table_id] [base64_data] e not found in data ``` -#### The `decoder` subcommand +### The `decoder` command - The following example shows how to decode the row key, similar to decoding the index key. ```shell - $ ./tidb-ctl decoder -f table_row -k "t\x00\x00\x00\x00\x00\x00\x00\x1c_r\x00\x00\x00\x00\x00\x00\x00\xfa" - table_id: -9223372036854775780 - row_id: -9223372036854775558 + $ ./tidb-ctl decoder "t\x00\x00\x00\x00\x00\x00\x00\x1c_r\x00\x00\x00\x00\x00\x00\x00\xfa" + format: table_row + table_id: -9223372036854775780 table_id: -9223372036854775780 + row_id: -9223372036854775558 row_id: -9223372036854775558 ``` - The following example shows how to decode `value`. ```shell - $ ./tidb-ctl decoder -f value -k AhZoZWxsbyB3b3JsZAiAEA== - type: bytes, value: hello world - type: bigint, value: 1024 + $ ./tidb-ctl decoder AhZoZWxsbyB3b3JsZAiAEA== + format: index_value + type: bigint, value: 1024 index_value[0]: {type: bytes, value: hello world} + index_value[1]: {type: bigint, value: 1024} ``` -#### The `etcd` subcommand +### The `etcd` command - `tidb-ctl etcd ddlinfo` is used to obtain DDL information. - `tidb-ctl etcd putkey KEY VALUE` is used to add KEY VALUE to etcd (All the KEYs are added to the `/tidb/ddl/all_schema_versions/` directory). @@ -265,11 +267,11 @@ tidb-ctl base64decode [table_id] [base64_data] tidb-ctl etcd delkey "/tidb/ddl/all_schema_versions/bar" ``` -#### The `log` subcommand +### The `log` command The stack information for the TiDB error log is in one line format. You could use `tidb-ctl log` to change its format to multiple lines. -#### The `keyrange` subcommand +### The `keyrange` command The `keyrange` subcommand is used to query the global or table-related key range information, which is output in the hexadecimal form.