Purpose
This statement is used to change the log stream, including modifying the log stream's UNIT_GROUP (in homogeneous zone mode) or UNIT_LIST (in heterogeneous zone mode), and the log stream's PRIMARY_ZONE.
Limitations and considerations
The current version of OceanBase AI Database supports both homogeneous zone mode and heterogeneous zone mode for tenants. Specifically:
In homogeneous zone mode, you can modify the
UNIT_GROUPfor log stream distribution and thePRIMARY_ZONEfor log streams.In heterogeneous zone mode, you can modify the
UNIT_LISTfor log stream distribution and thePRIMARY_ZONEof a log stream.
When changing the log stream, the log stream to be changed must exist and its status must be
NORMAL.When changing the log stream, the tenant status of the tenant whose log stream is to be changed must be
NORMAL.When modifying the log stream distribution's
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) for a primary tenant, all current log streams of the tenant must have no load balancing tasks.We recommend that you do not modify the
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode) attribute of a log stream distribution on a standby tenant. This is because the standby tenant automatically adjusts theUNIT_GROUP/UNIT_LISTattributes of log streams, and manual modifications may not take effect.When modifying the log stream distribution for
UNIT_GROUP(in homogeneous zone mode) orUNIT_LIST(in heterogeneous zone mode), the targetUNIT_GROUP/UNIT_LISTmust be in theACTIVEstate.When modifying the
PRIMARY_ZONEof a log stream, ensure that the modified zone is included in the tenant'sZONE_LIST. For a log stream, setting thePRIMARY_ZONEis slightly different from setting it for a tenant. A log stream can only be assigned one zone, such asz1orz2, and cannot be set toz1,z2,z1; z2, orRANDOMas a tenant can.When changing the log stream, ensure that the tenant-level parameter
enable_rebalanceis disabled, meaning its value isFalse. Whenenable_rebalanceis enabled, the tenant's load balancing module may automatically adjust thePRIMARY_ZONEandUNIT_GROUP/UNIT_LISTattributes of the log stream.In homogeneous zone mode, only the broadcast electron stream and system log stream (log stream 1) support specifying
UNIT_GROUPas 0.In heterogeneous zone mode, the
UNIT_LISTspecified for the user log stream must not be empty.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase AI Database privileges, see Permission classification.
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
Parameters |
Description |
|---|---|
| ls_id | Specifies the ID of the log stream to be changed. |
| unit_group_id | Specifies the target unit group ID of the log stream to be changed. This parameter is applicable only in homogeneous zone mode. When executing this statement, you must modify at least one attribute of the log stream. UNIT_GROUP or PRIMARY_ZONE. |
| unit_id_list | Specify the list of units for the log stream distribution to be changed. Separate multiple unit_ids with commas (,). This applies only in heterogeneous zone mode. |
| zone_name | Specifies the target primary zone for the log stream to be changed. When executing this statement, you must modify at least one attribute of the log stream. UNIT_GROUP or PRIMARY_ZONE. |
| tenant_name | Optional. The system tenant specifies the target tenant.
NoteOnly the system tenant can specify other tenants. This statement does not support using |
Examples
System tenant
Only modify the
UNIT_GROUPof the log stream.The system tenant modifies the log stream location of tenant
obtenantfrom 1002 toUNIT_GROUP1002.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002 TENANT = obtenant;Only modify the
PRIMARY_ZONEof the log stream.The system tenant changes the first priority of the leader of log stream 1002 for tenant
obtenanttoz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Simultaneously modify the
UNIT_GROUPandPRIMARY_ZONEof a log stream.The system tenant modifies the log stream location of tenant
obtenantfrom 1002 toUNIT_GROUPof 1002, and changes the first priority of the log stream leader toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1' TENANT = obtenant;
User tenant
Only modify the
UNIT_GROUPof the log stream.The user tenant moves the position of log stream 1002 within this tenant to
UNIT_GROUP1002.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002;Only modify the
PRIMARY_ZONEof the log stream.The user tenant changes the first priority of the leader of log stream 1002 in this tenant to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Simultaneously modify the
UNIT_GROUPandPRIMARY_ZONEof a log stream.The user tenant modifies the location of log stream 1002 within the tenant to
UNIT_GROUPand changes the first priority of the log stream leader toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_GROUP 1002, PRIMARY_ZONE 'z1';
System tenant
Only modify the
UNIT_LISTfor log stream distribution.The system tenant modifies the log stream location of tenant
obtenantto theUNIT_LISTwithunit_id1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003) TENANT = obtenant;Only modify the
PRIMARY_ZONEof the log stream.The system tenant changes the first priority of the leader of log stream 1002 for tenant
obtenanttoz1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1' TENANT = obtenant;Simultaneously modify the
UNIT_LISTandPRIMARY_ZONEof a log stream.The system tenant modifies the log stream location of tenant
obtenantto theUNIT_LISTwithunit_id1001, 1002, and 1003, and changes the first priority of the log stream leader toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1' TENANT = obtenant;
User tenant
Only modify the
UNIT_LISTfor log stream distribution.The user tenant modifies the location of log stream 1002 within itself to the
UNIT_LISTwhereunit_idis 1001, 1002, and 1003.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003);Only modify the
PRIMARY_ZONEof the log stream.The user tenant changes the first priority of the leader of log stream 1002 in this tenant to
z1.obclient> ALTER SYSTEM MODIFY LS 1002 PRIMARY_ZONE 'z1';Simultaneously modify the
UNIT_LISTandPRIMARY_ZONEof a log stream.The user tenant modifies the location of its own log stream 1002 to the
UNIT_LISTwhereunit_idis 1001, 1002, and 1003, and changes the first priority of the log stream leader toz1.obclient> ALTER SYSTEM MODIFY LS 1002 UNIT_LIST (1001, 1002, 1003), PRIMARY_ZONE 'z1';
References
For more information about change log streams, see Change Log Streams.