After you use the MAJOR FREEZE statement to initiate a major compaction, the system automatically schedules the major compaction task. Starting from OceanBase Database V4.0.x, a unified major compaction strategy is used to implement the major compaction process. In other words, a major compaction is performed for all zones of the tenant at the same time. When the major compaction is completed for all zones, the major compaction is considered completed for the tenant.
During the major compaction, you do not need to manually control the compaction sequence of the zones and rotating compaction is not involved. If an error occurs during the major compaction, you can manually control the major compaction. For example, if a checksum verification error occurs, the current major compaction for the tenant cannot end. In this case, you can suspend the current major compaction. After the checksum resumes normal as a result of manual intervention, you can clear the checksum error tag and resume the major compaction.
Prerequisites
A major compaction has been initiated by using the MAJOR FREEZE statement. For more information about how to manually initiate a major compaction, see Manually initiate a major compaction.
Considerations
When the major compaction task is suspended, you can initiate a tenant-level major compaction, but not a partition-level major compaction. However, the system does not immediately execute the tenant-level major compaction task, but waits until the major compaction task is resumed.
Manually control a major compaction from the sys tenant
After a major compaction begins, you can control the major compaction for all tenants or specified tenants from the sys tenant. You can control tenant-level and partition-level major compactions.
To do so, perform the following steps:
Log on to the
systenant of the cluster as therootuser.Perform the following steps to control the major compaction based on the actual situation.
Suspend the major compaction for all user tenants, all meta tenants, or specified tenants
You can execute the following statements to suspend the major compaction for all user tenants, all meta tenants, or specified tenants.
Suspend the major compaction for all user tenants
ALTER SYSTEM SUSPEND MERGE TENANT = all_user;or
ALTER SYSTEM SUSPEND MERGE TENANT = all;Note
In OceanBase Database V4.2.1 and later,
TENANT = all_userandTENANT = allexpress the same semantics. If you want an operation to take effect on all user tenants, we recommend that you useTENANT = all_user.TENANT = allwill be deprecated.Suspend the major compaction for all meta tenants
ALTER SYSTEM SUSPEND MERGE TENANT = all_meta;Suspend the major compaction for specified tenants
ALTER SYSTEM SUSPEND MERGE TENANT = tenant1,tenant2;
Note that the equal sign (
=) is optional, and you must replacetenant1andtenant2with the actual tenant names.Resume a major compaction
You can resume a major compaction by execute the following statements:
Resume the major compaction for all user tenants
ALTER SYSTEM RESUME MERGE TENANT = all_user;or
ALTER SYSTEM RESUME MERGE TENANT = all;Note
In OceanBase Database V4.2.1 and later,
TENANT = all_userandTENANT = allexpress the same semantics. If you want an operation to take effect on all user tenants, we recommend that you useTENANT = all_user.TENANT = allwill be deprecated.Resume the major compaction for all meta tenants
ALTER SYSTEM RESUME MERGE TENANT = all_meta;Resume the major compaction for specified tenants
ALTER SYSTEM RESUME MERGE TENANT = tenant1,tenant2;
Note that the equal sign (
=) is optional, and you must replacetenant1andtenant2with the actual tenant names.Clear the checksum error tag
If a checksum verification error occurs during a major compaction and is resolved after manual intervention, you can clear this checksum error tag to resume the major compaction by executing the following statements:
Clear the checksum error tags for all user tenants
ALTER SYSTEM CLEAR MERGE ERROR TENANT = all_user;or
ALTER SYSTEM CLEAR MERGE ERROR TENANT = all;Note
In OceanBase Database V4.2.1 and later,
TENANT = all_userandTENANT = allexpress the same semantics. If you want an operation to take effect on all user tenants, we recommend that you useTENANT = all_user.TENANT = allwill be deprecated.Clear the checksum error tags for all meta tenants
ALTER SYSTEM CLEAR MERGE ERROR TENANT = all_meta;Clear the checksum error tags for specified tenants
ALTER SYSTEM CLEAR MERGE ERROR TENANT = tenant1,tenant2;
Note that the equal sign (
=) is optional, and you must replacetenant1andtenant2with the actual tenant names.
Manually control a major compaction from a user tenant
In a user tenant, you can control the major compaction of only the current tenant. You can control tenant-level and partition-level major compactions.
Log on to the database as an administrator of a user tenant.
Perform the following steps to control the major compaction based on the actual situation.
Suspend the major compaction for the current tenant
To suspend the major compaction for the current tenant, execute the following statement:
obclient> ALTER SYSTEM SUSPEND MERGE;Resume a major compaction
After a major compaction is suspended, you can resume it.
The statement is as follows:
obclient> ALTER SYSTEM RESUME MERGE;Clear the checksum error tag
If a checksum verification error occurs during a major compaction and is resolved after manual intervention, you can clear this checksum error tag and resume the major compaction.
The statement is as follows:
obclient> ALTER SYSTEM CLEAR MERGE ERROR;