You can also schedule tenant major compactions by specifying the daily trigger time.
Prerequisites
Before triggering a major compaction, ensure the global major freeze switch is enabled. This switch is controlled by the cluster-level parameter enable_major_freeze, with a default value of
True, indicating the compaction switch is on.If the global major freeze switch is not enabled for the current cluster, refer to the following steps to enable it.
Log in to the
systenant of the cluster as therootuser.Check whether the global major freeze switch is enabled.
obclient(root@sys)[(none)]> SHOW PARAMETERS LIKE 'enable_major_freeze';If it is not enabled, execute the following statement to turn on the compaction switch.
obclient(root@sys)[(none)]> ALTER SYSTEM SET enable_major_freeze='True';
To trigger daily tenant major compactions, ensure the tenant-level parameter enable_window_compaction is set to
False, which disables window-based compaction.Procedure:
Log in to the user tenant of the cluster as the tenant administrator.
Check the value of the tenant-level parameter
enable_window_compaction.obclient> SHOW PARAMETERS LIKE 'enable_window_compaction';If the value is
True, execute the following statement to disable window-based compaction.obclient> ALTER SYSTEM SET enable_window_compaction = False;In the sys tenant, you can set this by specifying the tenant name, for example:
ALTER SYSTEM SET enable_window_compaction = False TENANT = tenant_name;.
Trigger conditions for daily tenant major compactions
After the global major freeze switch is enabled and window-based compaction is disabled, daily tenant major compactions are triggered automatically at the specified time. The trigger time is controlled by the major_freeze_duty_time parameter. You can also modify this time in OCP. By default, the compaction is triggered at 02:00 every day.
For descriptions and settings of major_freeze_duty_time and other major compaction-related parameters, see Modify major compaction configuration.
Specify the daily tenant major compaction trigger time
Log in to the
systenant of the cluster as therootuser.Execute the following statement to modify the daily compaction trigger time.
Modify the daily major compaction trigger time for this tenant.
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00';Modify the daily major compaction trigger time for all user tenants.
In scenarios with many tenants, when the trigger time for each major compaction is the same across all user tenants, a sudden spike in CPU utilization may occur. If such a spike happens, it is recommended to set different daily major compaction times for each user tenant.
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = all_user;or
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = all;Note
TENANT = all_userandTENANT = allhave the same semantics. When you need to specify all user tenants, we recommend that you useTENANT = all_user. TheTENANT = alloption will be deprecated in the future.Modify the daily major compaction trigger time for all Meta tenants.
In scenarios with many tenants, when the trigger time for each major compaction is the same across all Meta tenants, a sudden spike in CPU utilization may occur. If such a spike happens, it is recommended to set different daily major compaction times for each Meta tenant.
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = all_meta;Modify the daily major compaction trigger time for a specified tenant.
The following statement only supports specifying one tenant at a time. To modify multiple tenants, you need to repeat the statement.
obclient> ALTER SYSTEM SET major_freeze_duty_time='01:00' TENANT = tenant1;