OceanBase Physical Standby & GoldenDB DRSP: Distributed Database Disaster Recovery Architectures Compared
This article analyzes OceanBase's tenant-level physical standby architecture with async log replication, Paxos-based log storage, and switchover/failover mechanics, alongside GoldenDB's DRSP three-mode disaster recovery cluster supporting delayed replication, point-in-time recovery, and failback procedures for distributed database high availability.
Reading font
Two Core Approaches for Data Recovery
When production databases undergo DML/DDL changes that risk data corruption or irreversible schema changes, two main mechanisms exist to restore to a pre-change point:
Flashback : Restore data to the exact timestamp of the erroneous operation. Many domestic databases (TiDB, GaussDB, OpenGauss, OceanBase) support this. For example, GaussDB's Ustore engine uses enable_recyclebin to control recycle bin and recyclebin_retention_time to set object retention; expired objects are auto-purged.
Delayed Replication : Standby nodes lag behind the primary by a configured interval. If the primary suffers a logical error, the standby's delayed state provides a clean recovery point. Single-instance databases like MySQL ( MASTER_DELAY) and OpenGauss (replay delay) implement this natively.
The challenge in distributed databases is ensuring cross-shard consistency during failover. This article details two mature solutions: OceanBase's physical standby tenant and GoldenDB's DRSP disaster recovery cluster.
1. OceanBase Physical Standby Solution (since v4.1.0)
OceanBase introduces tenant-level physical standby: primary tenant serves read/write workloads; standby tenant provides disaster recovery and read-only service. Three services coordinate:
Log Transport Service : Async-only real-time Redo log sync between primary and standby tenants.
Log Storage Service : HA log storage using Paxos; primary uses APPEND mode (accepts writes, replicates via Paxos), standby uses RAW_WRITE mode (rejects direct writes, only applies logs shipped from primary preserving original LSN/SCN).
Log Replay Service : Applies logs to standby's MemStore in real-time or delayed fashion to guarantee data identity.
1.1 Deployment Topologies
Separate clusters : Primary tenant in one cluster, standby in another; async replication across data centers for geo-DR.
Multi-active clusters : Each cluster hosts both primary and standby tenants for different workloads; clusters act as mutual standbys.
Same cluster : Primary and standby tenants co-located; useful for upgrade/change windows — pause sync, keep snapshot, promote standby if change fails.
1.2 Log Transport Modes
Archive-based : Primary archives logs to OSS/NFS; standby restores from archive. Both sides must enable archive mode.
Network-direct : Standby pulls logs (online or archived) directly from primary over network, similar to MySQL replication. Supports cluster-level throttling.
1.3 Key Operational Commands
Pause/Resume log sync (run on standby tenant or sys tenant):
# Pause log sync for a tenant
ALTER SYSTEM RECOVER STANDBY [TENANT = tenant_name] CANCEL;
# Resume log sync
ALTER SYSTEM RECOVER STANDBY [TENANT = tenant_name] UNTIL UNLIMITED;Check sync progress :
SELECT TENANT_NAME, TENANT_ID, TENANT_ROLE, SCN_TO_TIMESTAMP(SYNC_SCN)
FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = 'standby_tenant';Output example shows standby tenant synced to 2023-04-14 16:38:53.938774.
Throttling parameters : standby_fetch_log_bandwidth_limit: total bandwidth for all standby tenants in the cluster. _server_standby_fetch_log_bandwidth_limit: per-OBServer node bandwidth limit.
1.4 Log Storage Service Details
Both primary and standby use Paxos groups with Leader/Follower roles. On primary, Leader accepts writes and replicates via Paxos. On standby, Leader only receives shipped physical logs (LSN, SCN generated on primary) and replicates to its Followers. LSN locates physical log position; SCN provides global ordering across log streams.
1.5 Switchover vs Failover
Switchover (planned): Roles exchange with RPO = 0 , seconds latency.
# Primary -> Standby
ALTER SYSTEM SWITCHOVER TO STANDBY TENANT = tenant_name;
# Standby -> Primary
ALTER SYSTEM SWITCHOVER TO PRIMARY TENANT = tenant_name;Failover (unplanned, primary unrecoverable): Standby becomes primary; if sync was healthy, ~100ms data loss , seconds latency.
ALTER SYSTEM ACTIVATE STANDBY TENANT = tenant_name;System picks the minimum SCN across all log streams as the failover point; all streams roll back to that point.
2. GoldenDB DRSP Disaster Recovery Cluster
GoldenDB supports both multi-center active-active and a dedicated DRSP (Disaster Recovery Standby Pair) architecture. DRSP comprises a production cluster (serving traffic) and a standby/emergency cluster (normally idle, replicating data). Three operational modes:
Data Sync Mode : Metadata, GTM, and data nodes replicate from production to standby; configurable delay ( delay_time seconds) before applying.
Data Recovery Mode : Validate, repair, and replay synced data to meet distributed consistency requirements.
Service Mode : Standby cluster activated to serve production workload.
Trade-off: Complete isolation simplifies failover and enables rapid geo-failover or island drills, but doubles operational overhead (two independent clusters).
2.1 Mode Transition Commands
Enter Sync Mode (delayed replication) :
sh AllControl.sh -sync 1 -delay_time=<seconds>Set delay_time=0 for no delay.
Exit Sync Mode : sh AllControl.sh -stopsync 1 Specify replay target (timestamp, all relay logs, or GTID):
# Replay to specific timestamp
sh bat_mod_relaytime.sh 1 "RELAY_TIME"
# Replay all relay logs
sh bat_mod_relaytime.sh 1 ""
# Replay to specific GTID
sh bat_mod_relaytime.sh 1 "GTID_SET"The chosen replay point becomes the metadata sync start point for later failback.
Enter Recovery Mode : sh AllControl.sh -recover 1 Enter Service Mode : sh AllControl.sh -service 1 Exit service mode when no longer needed.
2.2 Failback Procedure (Standby → Production)
On production management node, stop service: sh AllControl.sh -stopservice 1 Stop production cluster: sh start_stop_service.sh -stop_dbproxy 1 Roll back production to consistency point and verify shard consistency: sh bat_mod_laststamp.sh 1 "2024-01-01 10:00:00" (Cluster ID 1, timestamp matches the recovery point set during standby activation.)
Purge shards that are now consistent.
Put production into sync mode (no delay): sh AllControl.sh -sync 1 -delay_time=0 Drain standby workload: stop business, wait for proxy transactions to commit, disable standby cluster and its proxies.
Production exits sync mode, enters service mode.
Standby exits service mode, re-enters delayed sync mode.
2.3 Disaster Drill Failback (Island Scenario)
During isolated drills, standby serves traffic while cut off from production. After drill, standby must roll back to pre-drill state. GoldenDB provides a flashback mechanism:
Snapshot persistence : Before opening service connections, persist current standby snapshot to RDB store.
Flashback via reverse SQL : Execute compensating DML to revert drill-era changes. DDL during drill may cause flashback failure; fallback to backup/restore if needed.
Standby replay verification : All standby replicas must finish replaying reverse SQL before proceeding.
Purge GTID set : Since reverse SQL increments GTID, purge to reset GTID set to the snapshot point.
References:
OceanBase official docs: https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000000818706
GoldenDB DRSP dual-cluster sync documentation
For questions about attribution, corrections or content rights, please contactand we will review it promptly.