This topic describes the protection modes and protection levels of the primary and standby clusters.
A protection mode defines whether the primary cluster synchronously or asynchronously transfers logs to different standby clusters, how the standby clusters receive the logs, and whether the data is lossless.
OceanBase Database provides two fields to specify a protection mode and the status of the primary and standby clusters: PROTECTION_MODE and PROTECTION_LEVEL. This topic describes the values of the fields in two scenarios.
Switch from the MAXIMUM PERFORMANCE mode to the MAXIMUM PROTECTION mode
By default, the primary and standby clusters are in MAXIMUM PERFORMANCE mode. In this mode, the primary cluster asynchronously transfers logs to all standby clusters. The data of the standby clusters is out-of-sync with that of the primary cluster and is lossy. Both the protection mode and protection level of a primary cluster and its standby clusters are displayed as MAXIMUM PERFORMANCE.
In MAXIMUM PROTECTION mode, the primary cluster synchronously transfers logs to the standby cluster that is in SYNC mode. This way, the data of the standby clusters in SYNC mode is lossless. The entire process of this mode is not atomic, and intermediate states exist. The following figure shows the state transition process of the <PROTECTION_MODE, PROTECTION_LEVEL> tuple when the protection mode switches from MAXIMUM PERFORMANCE to MAXIMUM PROTECTION.

The state transitions are described as follows:
Initial status of the primary and standby clusters:
The primary and standby clusters are in MAXIMUM PERFORMANCE mode. Both
PROTECTION_MODEandPROTECTION_LEVELareMAXIMUM PERFORMANCE.Status of the primary cluster after the protection mode switchover:
PROTECTION_MODEof the primary cluster changes toMAXIMUM PROTECTION, andPROTECTION_LEVELof the primary cluster is stillMAXIMUM PERFORMANCE. Then, the primary cluster instructs all OBServer nodes to synchronously transfer logs to the standby cluster that is inSYNCmode.After all OBServer nodes enter the SYNC mode,
PROTECTION_LEVELof the primary cluster changes toMAXIMUM PROTECTION, indicating that the primary cluster enters SYNC mode.Notice
Data writes are not interrupted in this process. Only the logs written after the primary cluster enters SYNC mode are synchronously transferred, and the previously committed logs are not affected.
Status of a standby cluster in
SYNCmode after it perceives the protection mode switchover:PROTECTION_MODEof the standby cluster ``changes toMAXIMUM PROTECTION, andPROTECTION_LEVELof the standby cluster is stillMAXIMUM PERFORMANCE.After the primary cluster enters the SYNC mode,
PROTECTION_LEVELof the standby cluster changes toRESYNCHRONIZATION, indicating that the logs are being synchronized to the standby cluster. In this state, the standby cluster synchronizes logs from the primary cluster.After logs are synchronized,
PROTECTION_LEVELof the standby cluster changes toMAXIMUM PROTECTION, indicating that the data of the standby cluster is consistent with that of the primary cluster and is lossless.
Status of a standby cluster in
ASYNCmode after it perceives the protection mode switchover:PROTECTION_MODEof the standby cluster changes toMAXIMUM PROTECTION. The standby cluster is in ASYNC mode, soPROTECTION_LEVELof the standby cluster remains asMAXIMUM PERFORMANCE.
Switch from the MAXIMUM PERFORMANCE mode to the MAXIMUM AVAILABILITY mode
The MAXIMUM AVAILABILITY mode combines the MAXIMUM PERFORMANCE and MAXIMUM PROTECTION modes. In MAXIMUM AVAILABILITY mode, the primary cluster has two states: synchronously transferring logs to the standby cluster that is in SYNC mode, and asynchronously transferring logs to the standby cluster that is in SYNC mode. The primary cluster dynamically switches between the two states, affecting the status of the standby clusters. The following figure shows the state transition process of the <PROTECTION_MODE, PROTECTION_LEVEL> tuple when the protection mode switches from MAXIMUM PERFORMANCE to MAXIMUM AVAILABILITY.

The state transitions are described as follows:
Initial status of the primary and standby clusters:
The primary and standby clusters are in MAXIMUM PERFORMANCE mode. Both
PROTECTION_MODEandPROTECTION_LEVELareMAXIMUM PERFORMANCE.Status of the primary cluster after the protection mode switchover:
PROTECTION_MODEof the primary cluster changes toMAXIMUM AVAILABILITY, andPROTECTION_LEVELof the primary cluster is stillMAXIMUM PERFORMANCE, indicating that the primary cluster is still in ASYNC mode.Then, the primary cluster constantly checks whether log synchronization to the standby clusters is as expected. If yes, the primary cluster instructs all OBServer nodes to synchronously transfer logs to the standby cluster that is in
SYNCmode.After all OBServer nodes enter the SYNC mode,
PROTECTION_LEVELof the primary cluster changes toMAXIMUM AVAILABILITY, indicating that the primary cluster enters the SYNC mode.The primary cluster remains in SYNC mode. If the primary cluster detects a log synchronization exception in the standby cluster in
SYNCmode, the primary cluster is automatically downgraded to the ASYNC mode, andPROTECTION_LEVELof the primary cluster changes toMAXIMUM PERFORMANCE.
Status of a standby cluster in
SYNCmode after it perceives the protection mode switchover:PROTECTION_MODEof the standby cluster changes toMAXIMUM AVAILABILITY.Same as the case in MAXIMUM PROTECTION mode, after the primary cluster enters the SYNC mode,
PROTECTION_LEVELof the standby cluster changes toRESYNCHRONIZATION, indicating that logs are being synchronized to the standby cluster.After logs are synchronized,
PROTECTION_LEVELof the standby cluster changes toMAXIMUM AVAILABILITY, indicating that the standby cluster is in SYNC mode, and the data of the standby cluster is consistent with that of the primary cluster and is lossless.
Status of a standby cluster in
ASYNCmode after it perceives the protection mode switchover:PROTECTION_MODEof the standby cluster changes toMAXIMUM AVAILABILITY. The standby cluster is in ASYNC mode, soPROTECTION_LEVELof the standby cluster remains asMAXIMUM PERFORMANCE.
As described in the preceding two scenarios, PROTECTION_MODE is shared across the primary and standby clusters, and indicates the data protection capabilities of the primary and standby clusters in the current configurations.
Description of PROTECTION_MODE:
MAXIMUM PERFORMANCE: the maximum performance mode. In this mode, the primary cluster asynchronously transfers logs to all standby clusters.MAXIMUM PROTECTION: the maximum protection mode. In this mode, the primary cluster synchronously transfers logs to the standby cluster that is inSYNCmode.MAXIMUM AVAILABILITY: the maximum availability mode. In this mode, the primary cluster synchronously transfers logs to the standby cluster that is inSYNCmode and can be automatically downgraded to the ASYNC mode as required.
PROTECTION_LEVEL is specific to clusters and has different meanings for the primary cluster and standby clusters. PROTECTION_LEVEL of the primary cluster specifies whether the primary cluster synchronously transfers logs to standby clusters. PROTECTION_LEVEL of a standby cluster indicates whether the standby cluster is in SYNC mode and whether data is lossless.
Description of PROTECTION_LEVEL:
MAXIMUM PERFORMANCE: indicates that the primary and standby clusters are in ASYNC mode.MAXIMUM PROTECTION: indicates that the primary cluster synchronously transfers logs to the standby cluster that is inSYNCmode with maximum protection, or indicates that a standby cluster is in SYNC mode and data is lossless.MAXIMUM AVAILABILITY: indicates that the primary cluster synchronously transfers logs to the standby cluster that is inSYNCmode with maximum availability, or indicates that the standby cluster is in SYNC mode and data is lossless.RESYNCHRONIZATION: indicates that logs are being synchronized to the standby cluster. This state is unavailable for the primary cluster.
The following table describes the protection levels of the primary and standby clusters in different protection modes.
| Protection mode | Primary cluster at the MAXIMUM PERFORMANCE level | Primary cluster at the MAXIMUM PROTECTION level | Primary cluster at the MAXIMUM AVAILABILITY level |
|---|---|---|---|
| MAXIMUM PERFORMANCE |
|
N/A | N/A |
| MAXIMUM PROTECTION | If the primary cluster is temporarily at the MAXIMUM PERFORMANCE level:
|
|
N/A |
| MAXIMUM AVAILABILITY |
|
N/A |
|
Query the protection mode and protection level of a cluster
Log on to the cluster and check the PROTECTION_MODE and PROTECTION_LEVEL columns in the V$OB_CLUSTER view.
obclient> SELECT PROTECTION_MODE, PROTECTION_LEVEL FROM V$OB_CLUSTER;
+--------------------+--------------------+
| PROTECTION_MODE | PROTECTION_LEVEL |
+--------------------+--------------------+
| MAXIMUM PROTECTION | MAXIMUM PROTECTION |
+--------------------+--------------------+
1 row in set