After you execute the MAJOR FREEZE statement to initiate a major compaction, the system automatically schedules the major compaction task based on the specified strategies by default. For example, if you enable rotating major compaction, the system automatically schedules the major compaction zone by zone. OceanBase Database also allows users to manually control the major compaction process.
The typical scenarios are as follows:
An error, such as a checksum verification error, occurs in one of the zones during the major compaction. To prevent the error from spreading to other zones, you can stop automatic scheduling or pause the major compaction. After the problem is resolved, resume automatic scheduling or manually complete the major compaction process.
You want to manually control the major compaction process to determine the compaction time and compaction sequence of zones.
Prerequisites
Before you manually control a major compaction, make sure that the major compaction is initiated by using the MAJOR FREEZE statement. For more information about how to manually initiate a major compaction, see Manually initiate a major compaction.
Procedure
Log on to the
systenant as therootuser.Execute the following statement to enable manual major compaction control:
obclient> ALTER SYSTEM SET enable_manual_merge='True';The
enable_manual_mergeparameter specifies whether to enable manual major compaction control. The default value isFalse, which specifies to disable the control.For more information about the
enable_manual_mergeparameter, see enable_manual_merge.Start a major compaction.
Execute the following statement to start a major compaction on specified zones:
obclient> ALTER SYSTEM START MERGE ZONE [=] 'zone_name';Here,
[=]indicates that the equal sign (=) is optional. Thezone_nameparameter specifies the name of the zone to be compacted. Separate multiple zone names with commas (,).For example:
obclient> ALTER SYSTEM START MERGE ZONE = 'zone1';Optional. To suspend the major compaction, execute the following statement:
obclient> ALTER SYSTEM SUSPEND MERGE [ZONE [=] 'zone_name'];Here,
[=]indicates that the equal sign (=) is optional.Optional. Resume the major compaction.
The syntax is as follows:
obclient> ALTER SYSTEM RESUME MERGE [ZONE [=] 'zone_name'];Here,
[=]indicates that the equal sign (=) is optional.