Purpose
This statement is used to initiate a major freeze (storage layer compaction) or minor freeze (storage layer compaction) in the system tenant. Manual compactions are supported at the tenant level only, while manual minor freezes are supported at the tenant, zone, server, log stream, and partition levels.
Syntax
ALTER SYSTEM merge_action;
merge_action:
MAJOR FREEZE [tenant_list]
| MAJOR FREEZE [tenant_list]
| MINOR FREEZE [tenant_list | server_list | zone_list | {TENANT [=] tenant_name LS [=] ls_id} | {TENANT [=] tenant_name TABLET_ID = tablet_id}]
| {SUSPEND | RESUME} MERGE [tenant_list]
| CLEAR MERGE ERROR [tenant_list]
tenant_list:
TENANT [=] { all | all_user | all_meta } | tenant_name [, tenant_name ...]
server_list:
SERVER [=] ('ip:port' [, 'ip:port'...])
zone_list:
ZONE [=] ('zone_name' [, 'zone_name' ...]);
Parameters
| Parameter | Description |
|---|---|
| MAJOR FREEZE | Initiates a daily major freeze. Use TENANT=all or TENANT=all_user to initiate a major freeze for all user tenants (excluding the system tenant and Meta tenant). We recommend that you use all_user, because all will be deprecated in the future. You can also use TENANT=all_meta to initiate a major freeze for all Meta tenants. You can also use TENANT=tenant_name [, tenant_name ...] to initiate a major freeze for only the specified tenant. |
| MINOR FREEZE | Initiates a minor freeze. |
| {SUSPEND | RESUME} MERGE | Suspends or resumes a daily major freeze. Use TENANT=all or TENANT=all_user to suspend or resume a daily major freeze for all user tenants (excluding the system tenant and Meta tenant). We recommend that you use all_user, because all will be deprecated in the future. You can also use TENANT=all_meta to suspend or resume a daily major freeze for all Meta tenants. You can also use TENANT=tenant_name [, tenant_name ...] to suspend or resume a daily major freeze for only the specified tenant. |
| CLEAR MERGE ERROR | Clears the error flag of a major freeze. Use TENANT=all or TENANT=all_user to clear the error flag of a major freeze for all user tenants (excluding the system tenant and Meta tenant). We recommend that you use all_user, because all will be deprecated in the future. You can also use TENANT=all_meta to clear the error flag of a major freeze for all Meta tenants. You can also use TENANT=tenant_name [, tenant_name ...] to clear the error flag of a major freeze for only the specified tenant. |
| MAJOR FREEZE TENANT [=] tenant_name | Initiates a major freeze for a specified tenant.
NoteThis statement can be executed only in the system (sys) tenant. |
| tenant_name | Specifies the tenant for which to initiate a major freeze or minor freeze. |
| TABLET_ID | Specifies the partition for which to initiate a minor freeze. |
| SERVER | Specifies the server for which to initiate a minor freeze. |
| ZONE | Specifies the zone for which to initiate a minor freeze. |
| LS | Specifies the log stream for which to initiate a minor freeze. |
Examples
Example of major compactions
The system tenant initiates a major compaction for the system tenant.
obclient> ALTER SYSTEM MAJOR FREEZE; Query OK, 0 rows affectedThe system tenant initiates a major compaction for all user tenants (excluding the system tenant and Meta tenant).
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = all_user; Query OK, 0 rows affectedThe system tenant initiates a major compaction for all Meta tenants.
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = all_meta; Query OK, 0 rows affectedThe system tenant initiates a major compaction for the specified tenants
tenant1andtenant2.obclient> ALTER SYSTEM MAJOR FREEZE TENANT = tenant1,tenant2; Query OK, 0 rows affected
Example of major dumps
The system tenant initiates a major dump for the system tenant.
obclient> ALTER SYSTEM MINOR FREEZE; Query OK, 0 rows affectedThe system tenant initiates a major dump for all user tenants (excluding the system tenant and Meta tenant).
obclient> ALTER SYSTEM MINOR FREEZE TENANT = all_user; Query OK, 0 rows affectedThe system tenant initiates a major dump for all Meta tenants.
obclient> ALTER SYSTEM MINOR FREEZE TENANT = all_meta; Query OK, 0 rows affectedThe system tenant initiates a major dump for the specified tenants
tenant1andtenant2.obclient> ALTER SYSTEM MINOR FREEZE TENANT = tenant1,tenant2; Query OK, 0 rows affectedThe system tenant initiates a major dump for the specified partition under the specified tenant
tenant1.obclient> ALTER SYSTEM MINOR FREEZE tenant = tenant1 tablet_id = 1100611139453887; Query OK, 0 rows affectedThe system tenant initiates a major dump for the specified OBServer node.
obclient> ALTER SYSTEM MINOR FREEZE SERVER = ('10.XXX.XXX.XXX:2882'); Query OK, 0 rows affectedThe system tenant initiates a major dump for the specified log stream under the specified tenant
tenant1.obclient> ALTER SYSTEM MINOR FREEZE tenant = t1 LS 1; Query OK, 0 rows affectedThe system tenant initiates a major dump for the specified partition under the specified log stream in the specified tenant
tenant1.obclient> ALTER SYSTEM MINOR FREEZE tenant = t1 ls 1 tablet_id = 60000; Query OK, 0 rows affected
Example of pausing or resuming major compactions
The system tenant pauses major compactions for all user tenants (excluding the system tenant and Meta tenant).
obclient> ALTER SYSTEM SUSPEND MERGE TENANT = all_user; Query OK, 0 rows affectedThe system tenant pauses major compactions for the specified tenants
tenant1andtenant2.obclient> ALTER SYSTEM SUSPEND MERGE TENANT = tenant1,tenant2; Query OK, 0 rows affectedThe system tenant pauses major compactions for all Meta tenants.
obclient> ALTER SYSTEM SUSPEND MERGE TENANT = all_meta; Query OK, 0 rows affectedThe system tenant resumes major compactions for all user tenants (excluding the system tenant and Meta tenant).
obclient> ALTER SYSTEM RESUME MERGE TENANT = all_user; Query OK, 0 rows affectedThe system tenant resumes major compactions for the specified tenants
tenant1andtenant2.obclient> ALTER SYSTEM RESUME MERGE TENANT = tenant1,tenant2; Query OK, 0 rows affectedThe system tenant resumes major compactions for all Meta tenants.
obclient> ALTER SYSTEM RESUME MERGE TENANT = all_meta; Query OK, 0 rows affected
Example of clearing the major compaction error flag
The system tenant clears the major compaction error flag for all user tenants (excluding the system tenant and Meta tenant).
obclient> ALTER SYSTEM CLEAR MERGE ERROR TENANT = all_user; Query OK, 0 rows affectedThe system tenant clears the major compaction error flag for the specified tenants
tenant1andtenant2.obclient> ALTER SYSTEM CLEAR MERGE ERROR TENANT = tenant1,tenant2; Query OK, 0 rows affectedThe system tenant clears the major compaction error flag for all Meta tenants.
obclient> ALTER SYSTEM CLEAR MERGE ERROR TENANT = all_meta; Query OK, 0 rows affected
Example of initiating a major dump at the partition level
Query the tablet ID of the table.
Here is an example:
SELECT t1.tenant_id, t2.tenant_name, t1.database_name, t1.table_id, t1.table_name, t1.tablet_id, t1.PARTITION_NAME, t1.SUBPARTITION_NAME FROM oceanbase.CDB_OB_TABLE_LOCATIONS t1, oceanbase.DBA_OB_TENANTS t2 WHERE t1.tenant_id=t2.tenant_id AND t1.table_name = 'test_tbl1' AND t2.tenant_name = 'oracle001';The returned result is as follows:
+-----------+-------------+---------------+----------+------------+-----------+----------------+-------------------+ | tenant_id | tenant_name | database_name | table_id | table_name | tablet_id | PARTITION_NAME | SUBPARTITION_NAME | +-----------+-------------+---------------+----------+------------+-----------+----------------+-------------------+ | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200008 | P1 | SP0 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200009 | P1 | SP1 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200010 | P1 | SP2 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200011 | P1 | SP3 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200012 | P2 | SP4 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200013 | P2 | SP5 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200014 | P2 | SP6 | | 1004 | oracle001 | SYS | 500011 | TEST_TBL1 | 200015 | P2 | SP7 | +-----------+-------------+---------------+----------+------------+-----------+----------------+-------------------+ 8 rows in setFor more information about the view fields, see oceanbase.CDB_OB_TABLE_LOCATIONS.
Initiate a major dump.
Here is an example:
ALTER SYSTEM MINOR FREEZE TENANT = oracle001 TABLET_ID = 200008;