Skip to content

Commit

Permalink
tidb: Refine the doc for global kill (#4729) (#4730)
Browse files Browse the repository at this point in the history
* cherry pick #4729 to release-5.0

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

* Apply suggestions from code review

Co-authored-by: JoyinQ <56883733+Joyinqin@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 27, 2021
1 parent 3c98c0c commit 19447c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions sql-statements/sql-statement-kill.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mysql> SHOW PROCESSLIST;
+------+------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)

mysql> KILL TIDB 2;
KILL TIDB 2;
Query OK, 0 rows affected (0.00 sec)
```

Expand All @@ -38,24 +38,24 @@ Query OK, 0 rows affected (0.00 sec)
* By design, this statement is not compatible with MySQL by default. This helps prevent against a case of a connection being terminated on the wrong TiDB server, because it is common to place multiple TiDB servers behind a load balancer.
* The `KILL TIDB` statement is a TiDB extension. If you are certain that the session you are attempting to kill is on the same TiDB server, set [`compatible-kill-query = true`](/tidb-configuration-file.md#compatible-kill-query) in your configuration file.

## Global kill <span class="version-mark">New in v5.0.0</span>
## Global kill <span class="version-mark">New in v5.0.0-rc</span>

Since v5.0, TiDB provides experimental support for [global kill](https://github.com/pingcap/tidb/blob/master/docs/design/2020-06-01-global-kill.md). When this feature is enabled, each TiDB server will ensure that Connection IDs are globally unique. A `KILL` statement can be issued to any TiDB server, which will internally route the request to the correct TiDB instance. This ensures that `KILL` is safe even when TiDB servers are behind a load balancer.
Since v5.0, TiDB provides experimental support for [Global kill](https://github.com/pingcap/tidb/blob/master/docs/design/2020-06-01-global-kill.md). This feature is used to safely terminate any connection between the client and the TiDB server. When this feature is enabled, each TiDB server ensures that each connection ID is globally unique. The client can issue a `KILL` statement to any TiDB server, and the server internally routes the request to the corresponding TiDB instance. This ensures that `KILL` is safe to execute even when the TiDB server is behind a load balancer.

To enable "global kill", set `enable-global-kill = true` in `experimental` section of your configuration file.
To enable Global Kill, set `enable-global-kill = true` in the `experimental` section of the [TiDB configuration file](/tidb-configuration-file.md#enable-global-kill-new-in-v500-rc).

## Global kill example

On TiDB instance `127.0.0.1:10180`:
Execute the following statement on the TiDB instance `127.0.0.1:10180`:

```sql
mysql> SELECT SLEEP(60);
SELECT SLEEP(60);
```

On TiDB instance `127.0.0.1:10080`:
Execute the following statements on the TiDB instance `127.0.0.1:10080`:

```sql
mysql> SELECT * FROM INFORMATION_SCHEMA.CLUSTER_PROCESSLIST;
SELECT * FROM INFORMATION_SCHEMA.CLUSTER_PROCESSLIST;
+-----------------+---------------------+------+-----------+--------------------+---------+------+------------+------------------------------------------------------+------------------------------------------------------------------+------+----------------------------------------+
| INSTANCE | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | DIGEST | MEM | TxnStart |
+-----------------+---------------------+------+-----------+--------------------+---------+------+------------+------------------------------------------------------+------------------------------------------------------------------+------+----------------------------------------+
Expand All @@ -64,7 +64,7 @@ mysql> SELECT * FROM INFORMATION_SCHEMA.CLUSTER_PROCESSLIST;
+-----------------+---------------------+------+-----------+--------------------+---------+------+------------+------------------------------------------------------+------------------------------------------------------------------+------+----------------------------------------+
2 rows in set (0.07 sec)

mysql> KILL 8824324082762776581;
KILL 8824324082762776581;
Query OK, 0 rows affected (0.00 sec)
```

Expand Down
4 changes: 2 additions & 2 deletions tidb-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ The `experimental` section, introduced in v3.1.0, describes configurations relat
- Determines whether to create the expression index.
- Default value: false

### `enable-global-kill` <span class="version-mark">New in v5.0.0</span>
### `enable-global-kill` <span class="version-mark">New in v5.0.0-rc</span>

- Enables the "global kill" feature to safely kill any connection even when TiDB servers are behind a load balancer.
- Determines whether to enable the Global Kill feature. To enable this feature, set the value of this configuration item to `true`. When enabled, this feature can safely kill any connection even when the TiDB server is behind a load balancer.
- Default value: false

0 comments on commit 19447c4

Please sign in to comment.