Each tenant can only have one balance job running at a time. If the current balance job does not meet business needs, you can cancel the task. 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.
Limitations
You can cancel load balancing jobs only in primary databases or tenants.
Background information
Each tenant can only have one balance job running at a time. These 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 load balancing job in the sys tenant
Log on to the
systenant of the cluster as therootuser.Note that you must specify the corresponding parameters 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 [oceanbase]> SELECT * FROM oceanbase.CDB_OB_BALANCE_JOBS WHERE TENANT_ID = 1002;A sample query result is as follows:
+-----------+--------+----------------------------+----------------------------+----------------------+------------+-----------------+-------------------------+--------+---------+ | TENANT_ID | JOB_ID | CREATE_TIME | MODIFY_TIME | BALANCE_STRATEGY | JOB_TYPE | TARGET_UNIT_NUM | TARGET_PRIMARY_ZONE_NUM | STATUS | COMMENT | +-----------+--------+----------------------------+----------------------------+----------------------+------------+-----------------+-------------------------+--------+---------+ | 1002 | 520683 | 2023-11-01 14:56:28.552867 | 2023-11-01 14:56:28.552867 | LS balance by shrink | LS_BALANCE | 1 | 1 | DOING | NULL | +-----------+--------+----------------------------+----------------------------+----------------------+------------+-----------------+-------------------------+--------+---------+ 1 row in setIf the query result shows that the job does not meet your expectation, execute the following statement to cancel it:
ALTER SYSTEM CANCEL BALANCE JOB TENANT = 'tenant_name';Here is an example:
obclient [oceanbase]> ALTER SYSTEM CANCEL BALANCE JOB TENANT ='mysql_tenant';
Cancel a load balancing job in a user tenant
Connect to the database as the tenant administrator of a MySQL or Oracle tenant.
Note that you must specify the corresponding parameters 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.MySQL modeOracle modeThe query statement in MySQL mode is as follows:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_BALANCE_JOBS;The query statement in Oracle mode is as follows:
obclient [SYS]> SELECT * FROM SYS.DBA_OB_BALANCE_JOBS;If the query result shows that the job does not meet your expectation, execute the following statement to cancel it:
obclient> ALTER SYSTEM CANCEL BALANCE JOB;