Skip to main content
Version: V1.4.0

MAJOR and MINOR

Description​

This statement is used to initiate a major compaction or a minor compaction (freezing) at the system level. Manual compactions and freezes are supported at the instance level and the partition level.

Syntax​

ALTER SYSTEM merge_action;

merge_action:
MAJOR FREEZE
| MAJOR FREEZE TABLET_ID = tablet_id
| MINOR FREEZE [TABLET_ID = tablet_id]
| {SUSPEND | RESUME} MERGE
| CLEAR MERGE ERROR

Parameter description​

ParameterDescription
MAJOR FREEZEInitiates a daily major compaction.
MINOR FREEZEInitiates a minor compaction.
{SUSPEND | RESUME} MERGESuspends or resumes a daily major compaction.
CLEAR MERGE ERRORClears the error mark for a major compaction.
MAJOR FREEZE TABLET_ID = tablet_idSpecifies a tablet ID for a major compaction, i.e., a partition-level major compaction.
TABLET_IDSpecifies a partition for a minor compaction or a major compaction.
LSSpecifies a log file for a minor compaction.

Considerations​

Partitions and tablets are one-to-one. When you initiate a partition-level major compaction, note the following:

  • If an instance-level major compaction is being executed for the corresponding partition, you cannot initiate a partition-level major compaction.
  • If an adaptive scheduling major compaction is being executed for the corresponding partition, you cannot initiate a partition-level major compaction.
  • If the major compaction is suspended, you cannot initiate a partition-level major compaction.
  • A partition-level major compaction consumes CPU and disk I/O resources. Before you initiate a partition-level major compaction, you need to evaluate the current resource usage. After a partition-level major compaction is initiated, the CPU and I/O usage will increase.

Examples​

Example of initiating a major compaction​

  • Initiate a daily major compaction.

    ALTER SYSTEM MAJOR FREEZE;

Example of initiating a minor compaction​

  • Initiate a minor compaction.

    ALTER SYSTEM MINOR FREEZE;
  • Initiate a minor compaction for a specified partition.

    ALTER SYSTEM MINOR FREEZE tablet_id = 1100611139453887;

Example of suspending or resuming a daily major compaction​

  • Suspend a daily major compaction.

    ALTER SYSTEM SUSPEND MERGE;

Example of clearing the error mark for a major compaction​

  • Clear the error mark for a major compaction.

    ALTER SYSTEM CLEAR MERGE ERROR;

If you obtained a target tablet ID from diagnostic tooling, specify that tablet by using TABLET_ID. seekdb V1.4.0 does not provide a public view that maps table names to tablet IDs.

References​