Note
For V4.2.0, this parameter is available starting with V4.2.0.
Description
ls_gc_delay_time specifies the time for which log streams of a tenant are delayed before being deleted.
OceanBase Database implements a load balancing module based on log stream splitting and merging starting from V4.2.0. This module provides capabilities such as scaling up and scaling down. When you scale down the database, log streams that meet the garbage collection (GC) conditions are deleted immediately, and the system also clears the corresponding log storage of the Palf.
In addition, OceanBase Database implements a physical standby database based on the network starting from V4.2.0. In the physical standby database architecture, if the primary or standby tenant does not enable log archiving and you scale down the database, the log streams are quickly cleared. This can easily cause the log synchronization of the standby tenant to be blocked due to the log recycling of the source tenant. Therefore, you can use this parameter to configure the time for which log streams of the primary or standby tenant are delayed before being deleted.
Privilege requirements
Query the parameter
The
systenant and all user tenants can query this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify the parameter
The
systenant and user tenants can modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Time |
| Default value | 0s, indicating that the log stream delay deletion mechanism is no longer effective.
NoteStarting from V4.2.1 BP1, the default value is changed from 3600s to 0s. |
| Value range | [0s, +∞) |
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
In the physical standby database architecture:
If the primary or standby tenant does not enable log archiving and the default value of the
ls_gc_delay_timeparameter is 3600s (1 hour), the log stream delay deletion mechanism is enabled, and the log streams are delayed for 1 hour before being deleted.If the primary or standby tenant enables log archiving, the log stream data is guaranteed to be complete. Therefore, the GC of the log streams is not affected by this parameter. In this case, regardless of the value of the
ls_gc_delay_timeparameter, the log stream delay deletion mechanism does not take effect.
In the tenant deletion scenario, the log stream delay deletion mechanism does not take effect regardless of the value of the
ls_gc_delay_timeparameter.Notice
The delay deletion in this parameter only retains the log stream entities. Whether the log files of the log streams can be retained depends on the remaining disk space of the current tenant. If the remaining disk space is insufficient, log recycling is still triggered.
Examples
Set the delay deletion time for log streams of a specified tenant in the
systenant.obclient> ALTER SYSTEM SET ls_gc_delay_time='7200s' TENANT = 'mysql_tenant';Set the delay deletion time for log streams of the current user tenant.
obclient> ALTER SYSTEM SET ls_gc_delay_time='7200s';