Purpose
This statement is used to modify the distribution of a log stream, including the UNIT_GROUP (in homogeneous zone mode) or UNIT_LIST (in heterogeneous zone mode) of the log stream, and the PRIMARY_ZONE of the log stream.
Limitations and considerations
OceanBase Database supports both homogeneous and heterogeneous zone modes for tenants in the current version. Specifically:
In homogeneous zone mode, you can modify the
UNIT_GROUPof the log stream distribution and thePRIMARY_ZONEof the log stream.In heterogeneous zone mode, you can modify the
UNIT_LISTof the log stream distribution and thePRIMARY_ZONEof the log stream.
When modifying a log stream, the log stream must exist and its status must be
NORMAL.When modifying a log stream, the tenant to which the log stream belongs must have a status of
NORMAL.When modifying the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of the log stream distribution on the primary tenant, all log streams of the tenant must not have ongoing load balancing tasks.It is not recommended to modify the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of the log stream distribution on a standby tenant. This is because the standby tenant automatically adjusts theUNIT_GROUPorUNIT_LISTof the log stream. Manual modifications may not take effect.When modifying the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of the log stream distribution, the targetUNIT_GROUPorUNIT_LISTmust be in theACTIVEstate.When modifying the
PRIMARY_ZONEof a log stream, the modified zone must be present in theZONE_LISTof the tenant. For a log stream, you can only set one zone as thePRIMARY_ZONE, such asz1orz2. You cannot set multiple zones likez1,z2,z1; z2, orRANDOMas thePRIMARY_ZONEfor a log stream, unlike for a tenant.When modifying a log stream, the tenant-level configuration item
enable_rebalancemust be set toFalse. Ifenable_rebalanceis set toTrue, the load balancing module of the tenant may automatically adjust thePRIMARY_ZONEandUNIT_GROUP/UNIT_LISTof the log stream.In homogeneous zone mode, only broadcast log streams and system log streams (log stream 1) support setting
UNIT_GROUPto 0.In heterogeneous zone mode, the
UNIT_LISTspecified for user log streams must not be empty.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege types in MySQL mode and Privilege types in Oracle mode.
Syntax
ALTER SYSTEM MODIFY LS
LS [=] ls_id
[UNIT_GROUP [=] unit_group_id] | [UNIT_LIST [=] (unit_id_list)]
[,PRIMARY_ZONE [=] 'zone_name']
[TENANT [=] 'tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| ls_id | The ID of the log stream to be modified. |
| unit_group_id | The ID of the target unit group for the log stream to be modified. This parameter is applicable only in homogeneous zone mode. When executing this statement, you must modify at least one of the following attributes of the log stream: UNIT_GROUP or PRIMARY_ZONE. |
| unit_id_list | The list of units for the log stream distribution to be modified. Multiple unit IDs are separated by commas (,). This parameter is applicable only in heterogeneous zone mode. |
| zone_name | The target primary zone for the log stream to be modified. When executing this statement, you must modify at least one of the following attributes of the log stream: UNIT_GROUP or PRIMARY_ZONE. |
| tenant_name | Optional. The name of the tenant to be operated on.
NoticeOnly the sys tenant can specify other tenants. This statement does not support specifying all tenants, user tenants, or all meta tenants using |
Examples
In the sys tenant
Change the
UNIT_GROUPof the log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_GROUPof 1002.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002 TENANT = obtenant;Change the
PRIMARY_ZONEof the log streamIn the sys tenant, change the first priority of the leader of the 1002 log stream of the
obtenanttenant toz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Change the
UNIT_GROUPandPRIMARY_ZONEof the log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_GROUPof 1002 and change the first priority of the leader of the log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1' TENANT = obtenant;
In a user tenant
Change the
UNIT_GROUPof the log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_GROUPof 1002.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002;Change the
PRIMARY_ZONEof the log streamIn the user tenant, change the first priority of the leader of the 1002 log stream to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Change the
UNIT_GROUPandPRIMARY_ZONEof the log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_GROUPof 1002 and change the first priority of the leader of the log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1';
In the sys tenant
Change the
UNIT_LISTof the log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTofunit_id1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003) TENANT = obtenant;Change the
PRIMARY_ZONEof the log streamIn the sys tenant, change the first priority of the leader of the 1002 log stream of the
obtenanttenant toz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Change the
UNIT_LISTandPRIMARY_ZONEof the log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTofunit_id1001, 1002, and 1003 and change the first priority of the leader of the log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1' TENANT = obtenant;
In a user tenant
Change the
UNIT_LISTof the log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_LISTofunit_id1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003);Change the
PRIMARY_ZONEof the log streamIn the user tenant, change the first priority of the leader of the 1002 log stream to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Change the
UNIT_LISTandPRIMARY_ZONEof the log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_LISTofunit_id1001, 1002, and 1003 and change the first priority of the leader of the log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1';
References
For more information about how to change the log stream, see Change a log stream.
