Each tenant can have only one running load balancing job at a time. You can cancel an ongoing load balancing job if it does not meet your business needs or if you want to schedule a manually initiated partition transfer task as soon as possible.
Limitations
You can cancel load balancing jobs only in primary databases or tenants.
Background information
Each tenant can have only one running load balancing job at a time, such as a scale-out, scale-in, migration, or partition balancing job. A load balancing job generates multiple load balancing tasks for specific load balancing operations. Canceling a load balancing job will cancel all ongoing tasks in the job.
Cancel a load balancing job in the sys tenant
Log in 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;