After a partition balancing task is completed, you can view its execution history by querying a view.
View background partition balancing tasks in the sys tenant
Log in to the sys tenant of the cluster as the
rootuser.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***** -AExecute the following statements to view the history of background partition balancing tasks for a specified tenant.
View the history of partition balancing tasks for a specified tenant.
The
CDB_OB_BALANCE_JOB_HISTORYview displays macro-level balancing tasks for all tenants, including expansion, contraction, migration balancing, and partition balancing tasks.obclient(root@sys)[oceanbase]> SELECT * FROM oceanbase.CDB_OB_BALANCE_JOB_HISTORY WHERE TENANT_ID = 1002 AND JOB_TYPE = 'PARTITION_BALANCE';The query result is as follows:
+-----------+--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ | TENANT_ID | JOB_ID | CREATE_TIME | FINISH_TIME | BALANCE_STRATEGY | JOB_TYPE | TARGET_UNIT_NUM | TARGET_PRIMARY_ZONE_NUM | STATUS | COMMENT | MAX_END_TIME | ZONE_UNIT_NUM_LIST | PARAMETER_LIST | +-----------+--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ | 1002 | 312280 | 2024-06-14 11:00:49.034035 | 2024-06-14 11:01:04.528871 | partition attribution alignment | PARTITION_BALANCE | NULL | 1 | COMPLETED | NULL | NULL | zone1:1 | ls_scale_out_factor:1,enable_rebalance:true,enable_transfer:true,enable_gts_standalone:false | +-----------+--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ 1 row in setFor more information about the fields in the
CDB_OB_BALANCE_JOB_HISTORYview, see CDB_OB_BALANCE_JOB_HISTORY.View the history of partition balancing tasks at the log stream (LS) level for a specified tenant.
The
CDB_OB_BALANCE_TASK_HISTORYview displays log stream-level tasks for all tenants, including log stream split (LS_SPLIT), log stream merge (LS_MERGE), log stream transfer (LS_TRANSFER), and log stream attribute modification (LS_ALTER) tasks.obclient(root@sys)[oceanbase]> SELECT * FROM oceanbase.CDB_OB_BALANCE_TASK_HISTORY WHERE TENANT_ID = 1002 AND BALANCE_STRATEGY LIKE '%partition%';The query result is as follows:
+-----------+---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ | TENANT_ID | TASK_ID | CREATE_TIME | FINISH_TIME | TASK_TYPE | SRC_LS | DEST_LS | PART_LIST | FINISHED_PART_LIST | PART_COUNT | FINISHED_PART_COUNT | LS_GROUP_ID | STATUS | PARENT_LIST | CHILD_LIST | CURRENT_TRANSFER_TASK_ID | JOB_ID | COMMENT | BALANCE_STRATEGY | +-----------+---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ | 1002 | 312281 | 2024-06-14 11:00:49.036806 | 2024-06-14 11:00:50.416084 | LS_ALTER | 1002 | -1 | NULL | NULL | 0 | 0 | 1001 | COMPLETED | NULL | 312282 | -1 | 312280 | NULL | partition attribution alignment | | 1002 | 312282 | 2024-06-14 11:00:49.038509 | 2024-06-14 11:00:54.460059 | LS_TRANSFER | 1002 | 1001 | NULL | 500129:500129 | 0 | 1 | 1001 | COMPLETED | NULL | 312283 | -1 | 312280 | NULL | partition attribution alignment | | 1002 | 312283 | 2024-06-14 11:00:49.038509 | 2024-06-14 11:00:56.470614 | LS_ALTER | 1002 | -1 | NULL | NULL | 0 | 0 | 0 | COMPLETED | NULL | NULL | -1 | 312280 | NULL | partition attribution alignment | +-----------+---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ 3 rows in setFor more information about the fields in the
CDB_OB_BALANCE_TASK_HISTORYview, see CDB_OB_BALANCE_TASK_HISTORY.View the history of partition balancing tasks at the tablet level for a specified tenant.
The
CDB_OB_TRANSFER_TASK_HISTORYview displays tablet-level tasks for all tenants, showing which specific partitions and tablets within the tenant underwent transfer operations.obclient(root@sys)[oceanbase]> SELECT * FROM oceanbase.CDB_OB_TRANSFER_TASK_HISTORY WHERE TENANT_ID = 1002;The query result is as follows:
+-----------+---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ | TENANT_ID | TASK_ID | CREATE_TIME | FINISH_TIME | SRC_LS | DEST_LS | PART_LIST | PART_COUNT | NOT_EXIST_PART_LIST | LOCK_CONFLICT_PART_LIST | TABLE_LOCK_TABLET_LIST | TABLET_LIST | TABLET_COUNT | START_SCN | FINISH_SCN | STATUS | TRACE_ID | RESULT | BALANCE_TASK_ID | TABLE_LOCK_OWNER_ID | COMMENT | +-----------+---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ | 1002 | 1 | 2024-06-14 11:00:52.439818 | 2024-06-14 11:00:53.780044 | 1002 | 1001 | 500129:500129 | 1 | NULL | NULL | NULL | 200070:0,1152921504606847005:0,1152921504606847006:0,1152921504606847007:0,1152921504606847008:0 | 5 | 1718334052840440001 | 1718334053449914002 | COMPLETED | YB42AC1E87DC-00061AC2E771139C-0-0 | 0 | 312282 | 312299 | | +-----------+---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ 1 row in setFor more information about the columns in the
CDB_OB_TRANSFER_TASK_HISTORYview, see CDB_OB_TRANSFER_TASK_HISTORY.
View partition balancing tasks in the background of a user tenant
Log in to the cluster 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***** -AExecute the following statements to view the history of partition balancing tasks in the background of the current tenant.
View the history of partition balancing tasks for the current tenant.
The
DBA_OB_BALANCE_JOB_HISTORYview displays macro-level balancing tasks for the current tenant, including expansion, contraction, migration balancing, and partition balancing tasks.obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BALANCE_JOB_HISTORY WHERE JOB_TYPE = 'PARTITION_BALANCE';The query result is as follows:
+--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ | JOB_ID | CREATE_TIME | FINISH_TIME | BALANCE_STRATEGY | JOB_TYPE | TARGET_UNIT_NUM | TARGET_PRIMARY_ZONE_NUM | STATUS | COMMENT | MAX_END_TIME | ZONE_UNIT_NUM_LIST | PARAMETER_LIST | +--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ | 312280 | 2024-06-14 11:00:49.034035 | 2024-06-14 11:01:04.528871 | partition attribution alignment | PARTITION_BALANCE | NULL | 1 | COMPLETED | NULL | NULL | zone1:1 | ls_scale_out_factor:1,enable_rebalance:true,enable_transfer:true,enable_gts_standalone:false | +--------+----------------------------+----------------------------+---------------------------------+-------------------+-----------------+-------------------------+-----------+---------+--------------+--------------------+----------------------------------------------------------------------------------------------+ 1 row in setFor more information about the columns in the
DBA_OB_BALANCE_JOB_HISTORYview, see DBA_OB_BALANCE_JOB_HISTORY.View the history of partition balancing tasks at the log stream (LS) level for the current tenant.
The
DBA_OB_BALANCE_TASK_HISTORYview displays log stream-level tasks for the current tenant, including log stream split (LS_SPLIT), log stream merge (LS_MERGE), log stream transfer (LS_TRANSFER), and log stream attribute modification (LS_ALTER) tasks.obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_BALANCE_TASK_HISTORY WHERE BALANCE_STRATEGY LIKE '%partition%';The query result is as follows:
+---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ | TASK_ID | CREATE_TIME | FINISH_TIME | TASK_TYPE | SRC_LS | DEST_LS | PART_LIST | FINISHED_PART_LIST | PART_COUNT | FINISHED_PART_COUNT | LS_GROUP_ID | STATUS | PARENT_LIST | CHILD_LIST | CURRENT_TRANSFER_TASK_ID | JOB_ID | COMMENT | BALANCE_STRATEGY | +---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ | 312281 | 2024-06-14 11:00:49.036806 | 2024-06-14 11:00:50.416084 | LS_ALTER | 1002 | -1 | NULL | NULL | 0 | 0 | 1001 | COMPLETED | NULL | 312282 | -1 | 312280 | NULL | partition attribution alignment | | 312282 | 2024-06-14 11:00:49.038509 | 2024-06-14 11:00:54.460059 | LS_TRANSFER | 1002 | 1001 | NULL | 500129:500129 | 0 | 1 | 1001 | COMPLETED | NULL | 312283 | -1 | 312280 | NULL | partition attribution alignment | | 312283 | 2024-06-14 11:00:49.038509 | 2024-06-14 11:00:56.470614 | LS_ALTER | 1002 | -1 | NULL | NULL | 0 | 0 | 0 | COMPLETED | NULL | NULL | -1 | 312280 | NULL | partition attribution alignment | +---------+----------------------------+----------------------------+-------------+--------+---------+-----------+--------------------+------------+---------------------+-------------+-----------+-------------+------------+--------------------------+--------+---------+---------------------------------+ 3 rows in setFor more information about the columns in the
DBA_OB_BALANCE_TASK_HISTORYview, see DBA_OB_BALANCE_TASK_HISTORY.View the history of partition balancing tasks at the tablet level for the current tenant.
The
DBA_OB_TRANSFER_TASK_HISTORYview displays tablet-level tasks for the current tenant, showing which specific partitions and tablets within the tenant have undergone transfer operations.obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_TRANSFER_TASK_HISTORY;The query result is as follows:
+---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ | TASK_ID | CREATE_TIME | FINISH_TIME | SRC_LS | DEST_LS | PART_LIST | PART_COUNT | NOT_EXIST_PART_LIST | LOCK_CONFLICT_PART_LIST | TABLE_LOCK_TABLET_LIST | TABLET_LIST | TABLET_COUNT | START_SCN | FINISH_SCN | STATUS | TRACE_ID | RESULT | BALANCE_TASK_ID | TABLE_LOCK_OWNER_ID | COMMENT | +---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ | 1 | 2024-06-14 11:00:52.439818 | 2024-06-14 11:00:53.780044 | 1002 | 1001 | 500129:500129 | 1 | NULL | NULL | NULL | 200070:0,1152921504606847005:0,1152921504606847006:0,1152921504606847007:0,1152921504606847008:0 | 5 | 1718334052840440001 | 1718334053449914002 | COMPLETED | YB42AC1E87DC-00061AC2E771139C-0-0 | 0 | 312282 | 312299 | | +---------+----------------------------+----------------------------+--------+---------+---------------+------------+---------------------+-------------------------+------------------------+--------------------------------------------------------------------------------------------------+--------------+---------------------+---------------------+-----------+-----------------------------------+--------+-----------------+---------------------+---------+ 1 row in setFor more information about the columns in the
DBA_OB_TRANSFER_TASK_HISTORYview, see DBA_OB_TRANSFER_TASK_HISTORY.