OceanBase stores user data in log streams, independently replicated shards that each maintain their own Paxos log. Unlike traditional primary-replica pairs, every log stream has a leader elected from its replica set.

Key concepts

  • Log stream (LS): A unit of replication; holds a slice of tablet data.
  • Tablet: User-visible partition mapped to one log stream.
  • Paxos quorum: Typically 3 or 5 replicas for production HA.

Leader election

When a leader fails, followers run an election. The new leader must have the highest committed log sequence. Client connections route through OBProxy, which caches leader locations and refreshes on redirect.

SELECT ls_id, role, zone FROM oceanbase.__all_virtual_log_stat;

Monitor ROLE transitions during failover tests. Flapping indicates network partition or clock skew.

Sizing guidance

Start with one log stream per tenant for small workloads. Scale out log streams when single-stream CPU exceeds 70% sustained or Paxos append latency grows past your SLA.