Each tenant can only have one balance job running at a time. If the current balance job does not meet business requirements, you can cancel it. Alternatively, if you have initiated a partition transfer but find that an ongoing balance job is delaying the scheduling of the partition transfer task, you can first cancel the current balance job.
Background information
Each tenant can only have one balance job running at a time. These balance jobs include scaling up, scaling down, migration balancing, and partition balancing. Each balance job generates multiple balancing tasks to perform specific load balancing operations. Canceling a balance job will cancel all running tasks under that job.
Cancel a balance job in the sys tenant
Log in to the
systenant of the cluster as therootuser.Note that you must specify the corresponding options in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AQuery the
CDB_OB_BALANCE_JOBSview for the status of the current job.obclient(root@sys)[oceanbase]> SELECT TENANT_ID, JOB_ID, BALANCE_STRATEGY, JOB_TYPE, STATUS FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;A sample query result is shown below:
+-----------+--------+----------------------+------------+--------+ | TENANT_ID | JOB_ID | BALANCE_STRATEGY | JOB_TYPE | STATUS | +-----------+--------+----------------------+------------+--------+ | 1002 | 520683 | LS balance by shrink | LS_BALANCE | DOING | +-----------+--------+----------------------+------------+--------+ 1 row in setIf the query result shows that the job is not as expected, you can execute the following statement to cancel it.
ALTER SYSTEM CANCEL BALANCE JOB TENANT = 'tenant_name';A sample execution is shown below:
obclient(root@sys)[oceanbase]> ALTER SYSTEM CANCEL BALANCE JOB TENANT ='mysql_tenant';
Cancel a balance job in a user tenant
Connect to the database as the tenant administrator of the user tenant.
Note that you must specify the corresponding options in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql_tenant#obdemo -p***** -AQuery the
DBA_OB_BALANCE_JOBSview for the status of the current job.The query statement is as follows:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_BALANCE_JOBS;If the query result shows that the job is not as expected, you can execute the following statement to cancel it.
obclient> ALTER SYSTEM CANCEL BALANCE JOB;