Purpose
This statement is used to change the type of a log stream replica.
Limitations and considerations
After modifying the replica type, ensure that the log stream can still form a majority. Otherwise, an error will occur during maintenance commands.
This statement can only modify the type of one replica at a time.
For the same log stream in a tenant, only one disaster recovery task can be executed at a time, except for replica migration tasks, which can be executed in parallel.
Note
The sys tenant can check the
CDB_OB_LS_REPLICA_TASKSview to confirm if there are ongoing disaster recovery tasks. User tenants can check theDBA_OB_LS_REPLICA_TASKSview for the same information.
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 REPLICA
LS [=] ls_id
SERVER [=] 'svr_ip:svr_port'
REPLICA_TYPE [=] 'replica_type'
[PAXOS_REPLICA_NUM [=] paxos_replica_num]
[TENANT [=] 'tenant_name'];
Parameters
| Parameter | Description |
|---|---|
| ls_id | The ID of the log stream whose replica type is to be changed. |
| svr_ip:svr_port | The IP address and port of the target server for the replica type change. For example, xxx.xx.xxx.001:2882. |
| replica_type | The target replica type after the change. Currently, the following two replica types can be converted to each other (case-insensitive):
NoteA |
| paxos_replica_num | Optional. The number of required members for the leader of the log stream. If not specified, the system will use the current default value of paxos_replica_num. Additionally, the maximum number of full-featured replicas (F replicas) in a log stream is 7.
NoticeWhen specifying the value of this parameter, note the following:
|
| tenant_name | Optional. The name of the tenant to operate on. If not specified, the current tenant is used as the default.
NoticeThe sys tenant can specify other tenants, while user tenants can only specify their own tenant. This statement does not support using |
Examples
Execute the following command in the sys tenant to convert a log stream replica of type F to type R in the mysql001 tenant.
ALTER SYSTEM MODIFY REPLICA
LS = 1001
SERVER = 'xxx.xxx.xxx.001:2882'
REPLICA_TYPE = 'R'
PAXOS_REPLICA_NUM = 2
TENANT = 'mysql001';
For more examples of changing the replica type of a log stream, see Change the replica type.
References
- For information about manually adding a log stream replica, see ADD REPLICA.
- For information about removing a log stream replica, see REMOVE REPLICA.
- For information about migrating a log stream replica, see MIGRATE REPLICA.
- For information about modifying the
PAXOS_REPLICA_NUMof a log stream, see MODIFY PAXOS_REPLICA_NUM. - For information about canceling a log stream replica task, see CANCEL REPLICA TASK.
