Purpose
This statement is used to convert the type of a log stream replica.
Limitations and considerations
Ensure that the log streams can still form a majority after modifying the replica type; otherwise, the O&M command will report an error.
This statement can only modify the type of one replica at a time.
For the same log stream of a tenant, except that multiple replica migration tasks can be executed in parallel, only one disaster recovery task (including adding replicas, deleting replicas, changing replica types, and modifying the quorum size of the log stream) can be executed at a time.
Note
You can query the
CDB_OB_LS_REPLICA_TASKSview in the sys tenant to check whether any disaster recovery tasks are running. You can also query theDBA_OB_LS_REPLICA_TASKSview in a user tenant to check whether any disaster recovery tasks are running.
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 REPLICA
LS [=] ls_id
SERVER [=] 'svr_ip:svr_port'
REPLICA_TYPE [=] 'replica_type'
[PAXOS_REPLICA_NUM [=] paxos_replica_num]
[TENANT [=] 'tenant_name'];
Parameters
Parameters |
Description |
|---|---|
| ls_id | Specifies the log stream ID whose replica type needs to be converted. |
| svr_ip:svr_port | Specify the IP address and port of the destination server for the replica type to be converted. For example, xxx.xx.xxx.001:2882. |
| replica_type | Specifies the target replica type after conversion. The following two replica types are currently supported for conversion (case-insensitive):
Note
|
| paxos_replica_num | Optional. Specifies the quorum size for the leader of a log stream. If this value is not explicitly specified, the system will use the current default value of paxos_replica_num. The maximum number of F replicas for a log stream is 7.
NoticeWhen specifying the value of this parameter, note the following:
|
| tenant_name | Optional. Specifies the tenant to operate on. If you do not explicitly specify the tenant, the default tenant is the current tenant.
NoticeThe system tenant can specify other tenants, while a user tenant can only specify itself. This statement does not support using |
Examples
Execute the following command in the sys tenant to convert a unidirectional log stream replica of type F to a bidirectional log stream replica of type R for tenant mysql001.
ALTER SYSTEM MODIFY REPLICA
LS = 1001
SERVER = 'xxx.xxx.xxx.001:2882'
REPLICA_TYPE = 'R'
PAXOS_REPLICA_NUM = 2
TENANT = 'mysql001';
References
- For information about manually adding log stream replicas, see ADD REPLICA.
- For information about deleting log stream replicas, see REMOVE REPLICA.
- For information about migrating log stream replicas, see MIGRATE REPLICA.
- For information about modifying the log stream
PAXOS_REPLICA_NUM, see MODIFY PAXOS_REPLICA_NUM. - For information about canceling a log stream replica task, see CANCEL REPLICA TASK.