After setting table group weights, you can clear the original table group weights as needed.
Considerations
Clearing table group weights deletes the weights of the table group. If tables within the table group have table-level or partition-level weights set, these weights will be retained.
Clear the weight
Log in to the MySQL-compatible tenant of the cluster.
The following is an example of connecting to the database. Please adjust the connection parameters based on your actual environment.
obclient -h10.xx.xx.xx -P2883 -uroot@mysql001#obdemo -p***** -AQuery the table group weight information.
obclient(root@mysql001)[test]> SELECT TABLEGROUP_NAME, WEIGHT, TABLEGROUP_ID, OBJECT_ID FROM oceanbase.DBA_OB_OBJECT_BALANCE_WEIGHT WHERE TABLEGROUP_NAME = 'TG_DB_test';The query result is as follows:
+-----------------+--------+---------------+-----------+ | TABLEGROUP_NAME | WEIGHT | TABLEGROUP_ID | OBJECT_ID | +-----------------+--------+---------------+-----------+ | TG_DB_test | 10 | 500007 | 500007 | +-----------------+--------+---------------+-----------+ 1 row in setClear the table group weight.
The following statement clears the weight of the
TG_DB_testtable group.obclient(root@mysql001)[test]> CALL DBMS_BALANCE.CLEAR_TABLEGROUP_BALANCE_WEIGHT('TG_DB_test');You can also clear the weight as the
systenant for the specified user tenantmysql001. The statement is as follows:obclient(root@sys)[(none)]> CALL DBMS_BALANCE.CLEAR_TABLEGROUP_BALANCE_WEIGHT('TG_DB_test') TENANT = 'mysql001';After clearing the table group weight, you can view the table group weight information again.
obclient(root@mysql001)[test]> SELECT TABLEGROUP_NAME, WEIGHT, TABLEGROUP_ID, OBJECT_ID FROM oceanbase.DBA_OB_OBJECT_BALANCE_WEIGHT WHERE TABLEGROUP_NAME = 'TG_DB_test';If the query result is empty, it indicates that the table group weight has been successfully cleared.
What to do next
After clearing the table group weight, the partition distribution of tables within the table group may be uneven. If you want to perform partition balancing as soon as possible, you can manually trigger a partition balancing task by calling the DBMS_BALANCE.TRIGGER_PARTITION_BALANCE procedure. For more information, see Manually trigger a partition balancing task.
Alternatively, you can wait for the scheduled partition balancing task to be triggered. For more information, see Configure a scheduled partition balancing task.