Description
This statement is used to cancel the currently running partition transfer task.
Limitations and considerations
When canceling a partition transfer task for a specific partition, if the task is in the
DOINGstate, the cancellation cannot be performed. If the task is in other states (WAITINGorINIT), it can be canceled.When canceling all partition transfer tasks under a tenant, although this command supports canceling all ongoing tasks, the operation is not atomic. That is, if some tasks are in the
DOINGstate, those tasks cannot be canceled.This statement can only be executed on the primary database.
Privilege requirements
The current user has the ALTER SYSTEM privilege.
Syntax
Syntax 1: Cancel the transfer partition task for a specific partition
ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID [=] table_id, OBJECT_ID [=] object_id [TENANT = 'tenant_name'];
Syntax 2: Cancel all transfer partition tasks for a tenant
ALTER SYSTEM CANCEL TRANSFER PARTITION ALL [TENANT = 'tenant_name'];
Parameters
Parameter |
Description |
|---|---|
| table_id | Table ID. |
| object_id | The unique identifier of the partition. |
| tenant_name | Optional. The name of the tenant for which you want to cancel tasks. This parameter is required when the command is executed by the system tenant. |
Examples
Cancel a transfer partition task for a specific partition.
Use the following statement to query the transfer partition tasks under a tenant.
SELECT T.TENANT_NAME, S.TENANT_ID, S.TABLE_ID, S.OBJECT_ID, S.TASK_ID, S.STATUS FROM oceanbase.CDB_OB_TRANSFER_PARTITION_TASKS S, oceanbase.DBA_OB_TENANTS T WHERE S.TENANT_ID = T.TENANT_ID;The return result is as follows:
+-------------+-----------+----------+-----------+---------+---------+ | TENANT_NAME | TENANT_ID | TABLE_ID | OBJECT_ID | TASK_ID | STATUS | +-------------+-----------+----------+-----------+---------+---------+ | mysql001 | 1004 | 500061 | 500064 | 9 | WAITING | +-------------+-----------+----------+-----------+---------+---------+ 1 row in setExecute the following statement to cancel the transfer partition task for a specific partition under tenant
mysql001.ALTER SYSTEM CANCEL TRANSFER PARTITION TABLE_ID = 500061, OBJECT_ID = 500064 TENANT = 'mysql001';
Cancel all partition transfer tasks under tenant
mysql001.ALTER SYSTEM CANCEL TRANSFER PARTITION ALL TENANT = 'mysql001';