Purpose
This statement is used to modify the distribution of a log stream. It can be used to change the UNIT_GROUP (in homogeneous zone mode) or UNIT_LIST (in heterogeneous zone mode) of a log stream, as well as the PRIMARY_ZONE of the log stream.
Limitations and considerations
OceanBase Database supports homogeneous zone mode and heterogeneous zone mode for tenants in the current version. Specifically:
In homogeneous zone mode, you can modify the
UNIT_GROUPandPRIMARY_ZONEof a log stream.In heterogeneous zone mode, you can modify the
UNIT_LISTandPRIMARY_ZONEof a log stream.
When you modify a log stream, the log stream must exist and be in the
NORMALstate.When you modify a log stream, the tenant to which the log stream belongs must be in the
NORMALstate.When you modify the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of a log stream in the primary tenant, all log streams of the tenant must not have load balancing tasks.We recommend that you do not modify the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of a log stream in a standby tenant. This is because the system automatically adjusts theUNIT_GROUPorUNIT_LISTof a log stream in a standby tenant. Manual modification may not take effect.When you modify the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) of a log stream, the targetUNIT_GROUPorUNIT_LISTmust be in theACTIVEstate.When you modify the
PRIMARY_ZONEof a log stream, the new zone must be specified in theZONE_LISTof the tenant. For a log stream, you can specify only one zone as thePRIMARY_ZONE, such asz1orz2, but not multiple zones likez1,z2,z1; z2, orRANDOMas you can for a tenant.When you modify a log stream, the tenant-level parameter
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 specifying
UNIT_GROUPas 0.In heterogeneous zone mode, the
UNIT_LISTspecified for user log streams must not be empty.
Privilege requirements
The user who executes this statement must have the ALTER SYSTEM privilege. For more information about the privileges of OceanBase Database, see Privilege types in MySQL-compatible mode and Privilege types in Oracle-compatible 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 applies only to homogeneous zone mode. When you execute this statement, you must modify at least one of the UNIT_GROUP or PRIMARY_ZONE attributes of the log stream. |
| unit_id_list | The list of unit IDs for the log stream to be modified. Separate multiple unit IDs with commas (,). This parameter applies only to heterogeneous zone mode. |
| zone_name | The target primary zone for the log stream to be modified. When you execute this statement, you must modify at least one of the UNIT_GROUP or PRIMARY_ZONE attributes of the log stream. |
| 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 by using |
Examples
In the sys tenant
Change the
UNIT_GROUPof a 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 a 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 a 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 a 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 a 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 a 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 a log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTthat containsunit_id1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003) TENANT = obtenant;Change the
PRIMARY_ZONEof a 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 a log streamIn the sys tenant, change the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTthat containsunit_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 a log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_LISTthat containsunit_id1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003);Change the
PRIMARY_ZONEof a 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 a log streamIn the user tenant, change the location of the 1002 log stream to the
UNIT_LISTthat containsunit_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 a log stream, see Change a log stream.