Purpose
This statement is used to change a log stream, including modifying the UNIT_GROUP (Homogeneous Zone mode) or UNIT_LIST (Heterogeneous Zone mode) of the log stream distribution, as well as the PRIMARY_ZONE of the log stream.
Limitations and considerations
In OceanBase Database V4.2.5, this statement must be executed in V4.2.5 BP1 or later.
In OceanBase Database of a version earlier than V4.x, only the Homogeneous Zone mode is supported for tenants. In OceanBase Database V4.2.5, the Heterogeneous Zone mode is supported for tenants starting from V4.2.5 BP5. Specifically:
- In the Homogeneous Zone mode, the
UNIT_GROUPof the log stream distribution and thePRIMARY_ZONEof the log stream can be modified. - In the Heterogeneous Zone mode, the
UNIT_LISTof the log stream distribution and thePRIMARY_ZONEof the log stream can be modified.
- In the Homogeneous Zone mode, the
When changing a log stream, the log stream must exist and be in the
NORMALstate.When changing a log stream, the tenant status of the log stream must be
NORMAL.Note
In OceanBase Database V4.2.5 BP1, the tenant status of the log stream cannot be
CREATINGorDROPPING.When modifying the
UNIT_GROUP(Homogeneous Zone mode) orUNIT_LIST(Heterogeneous Zone mode) of the log stream distribution for a primary tenant, no load balancing task is running for all log streams of the tenant.We recommend that you do not modify the
UNIT_GROUP(Homogeneous Zone mode) orUNIT_LIST(Heterogeneous Zone mode) attribute of the log stream distribution for a standby tenant. This is because theUNIT_GROUPorUNIT_LISTattribute of the log stream is automatically adjusted for a standby tenant, and manually modifying the attribute may not take effect.When modifying the
UNIT_GROUP(Homogeneous Zone mode) orUNIT_LIST(Heterogeneous Zone mode) of the log stream distribution, the status of the targetUNIT_GROUPorUNIT_LISTmust beACTIVE.When modifying the
PRIMARY_ZONEof a log stream, make sure that the modified zone is included in theZONE_LISTof the tenant. For a log stream, you can specify only one zone as thePRIMARY_ZONE, such asz1orz2. You cannot specifyz1,z2,z1; z2, orRANDOMfor a log stream.When changing a log stream, the value of the tenant-level parameter
enable_rebalancemust beFalse. Ifenable_rebalanceis set toTrue, the load balancing module of the tenant may automatically adjust thePRIMARY_ZONEandUNIT_GROUPorUNIT_LISTattribute of the log stream.In the Homogeneous Zone mode, only broadcasted log streams and system log streams (Log Stream 1) support setting the
UNIT_GROUPto 0.In the Heterogeneous Zone mode, the
UNIT_LISTspecified for user log streams must not be empty.
Privilege requirements
To execute this statement, you must have the ALTER SYSTEM privilege. For more information about the privileges of OceanBase Database, 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 of the log stream to be modified. This parameter applies only to homogeneous zones. When you execute this statement, you must modify at least one attribute of the log stream: UNIT_GROUP or PRIMARY_ZONE. |
| unit_id_list | The list of units where the log stream to be modified is distributed. Separate multiple unit IDs with commas (,). This parameter applies only to heterogeneous zones.
NoteThis parameter is supported in V4.2.5 BP5 and later. |
| zone_name | The target primary zone of the log stream to be modified. When you execute this statement, you must modify at least one attribute of the log stream: UNIT_GROUP or PRIMARY_ZONE. |
| tenant_name | The name of the tenant to be operated. This parameter is optional.
NoticeOnly the system tenant can specify another tenant. A user tenant can specify only its own tenant. This statement does not support using |
Examples
System tenant
Only modify the
UNIT_GROUPof the log streamThe system tenant changes the location of the 1002 log stream of the
obtenanttenant to theUNIT_GROUPof the 1002 log stream.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002 TENANT = obtenant;Only modify the
PRIMARY_ZONEof the log streamThe system tenant changes the primary zone of the leader of the 1002 log stream of the
obtenanttenant toz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Modify both the
UNIT_GROUPand thePRIMARY_ZONEof the log streamThe system tenant changes the location of the 1002 log stream of the
obtenanttenant to theUNIT_GROUPof the 1002 log stream, and changes the primary zone of the leader of the 1002 log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1' TENANT = obtenant;
User tenant
Only modify the
UNIT_GROUPof the log streamThe user tenant changes the location of the 1002 log stream of the current tenant to the
UNIT_GROUPof the 1002 log stream.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002;Only modify the
PRIMARY_ZONEof the log streamThe user tenant changes the primary zone of the leader of the 1002 log stream of the current tenant to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Modify both the
UNIT_GROUPand thePRIMARY_ZONEof the log streamThe user tenant changes the location of the 1002 log stream of the current tenant to the
UNIT_GROUPof the 1002 log stream, and changes the primary zone of the leader of the 1002 log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1';
System tenant
Only modify the
UNIT_LISTof the log streamThe system tenant changes the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTthat contains theunit_idvalues of 1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003) TENANT = obtenant;Only modify the
PRIMARY_ZONEof the log streamThe system tenant changes the primary zone of the leader of the 1002 log stream of the
obtenanttenant toz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Modify both the
UNIT_LISTand thePRIMARY_ZONEof the log streamThe system tenant changes the location of the 1002 log stream of the
obtenanttenant to theUNIT_LISTthat contains theunit_idvalues of 1001, 1002, and 1003, and changes the primary zone of the leader of the 1002 log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1' TENANT = obtenant;
User tenant
Only modify the
UNIT_LISTof the log streamThe user tenant changes the location of the 1002 log stream of the current tenant to the
UNIT_LISTthat contains theunit_idvalues of 1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003);Only modify the
PRIMARY_ZONEof the log streamThe user tenant changes the primary zone of the leader of the 1002 log stream of the current tenant to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Modify both the
UNIT_LISTand thePRIMARY_ZONEof the log streamThe user tenant changes the location of the 1002 log stream of the current tenant to the
UNIT_LISTthat contains theunit_idvalues of 1001, 1002, and 1003, and changes the primary zone of the leader of the 1002 log stream toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1';