Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 2.47 KB

sql-statement-change-pump.md

File metadata and controls

71 lines (53 loc) · 2.47 KB
title summary aliases
CHANGE PUMP
An overview of the usage of CHANGE PUMP for the TiDB database.
/docs/dev/sql-statements/sql-statement-change-pump/

CHANGE PUMP

The CHANGE PUMP statement modifies the status information for Pump in the cluster.

Tip:

Pump's state is automatically reported to PD while running. Only when Pump is under abnormal circumstances and its state is inconsistent with the state information stored in PD, you can use the CHANGE PUMP statement to modify the state information stored in PD.

Examples

{{< copyable "sql" >}}

SHOW PUMP STATUS;
+--------|----------------|--------|--------------------|---------------------|
| NodeID |     Address    | State  |   Max_Commit_Ts    |    Update_Time      |
+--------|----------------|--------|--------------------|---------------------|
| pump1  | 127.0.0.1:8250 | Online | 408553768673342237 | 2019-04-30 00:00:01 |
+--------|----------------|--------|--------------------|---------------------|
| pump2  | 127.0.0.2:8250 | Online | 408553768673342335 | 2019-05-01 00:00:02 |
+--------|----------------|--------|--------------------|---------------------|
2 rows in set (0.00 sec)

It can be seen that pump1's state has not been updated for more than a day, the Pump is in an abnormal state, but the State remains Online. After using CHANGE PUMP, the Pump's State is changed to 'paused' :

{{< copyable "sql" >}}

CHANGE PUMP TO NODE_STATE ='paused' FOR NODE_ID 'pump1';
Query OK, 0 rows affected (0.01 sec)

{{< copyable "sql" >}}

SHOW PUMP STATUS;
+--------|----------------|--------|--------------------|---------------------|
| NodeID |     Address    | State  |   Max_Commit_Ts    |    Update_Time      |
+--------|----------------|--------|--------------------|---------------------|
| pump1  | 127.0.0.1:8250 | Paused | 408553768673342237 | 2019-04-30 00:00:01 |
+--------|----------------|--------|--------------------|---------------------|
| pump2  | 127.0.0.2:8250 | Online | 408553768673342335 | 2019-05-01 00:00:02 |
+--------|----------------|--------|--------------------|---------------------|
2 rows in set (0.00 sec)

MySQL compatibility

This statement is a TiDB extension to MySQL syntax.

See also