This topic describes basic concepts about replicas and the replica types supported by OceanBase Database.
Basic information about replicas
To understand what a replica is, read the following points:
Log: in this topic, log refers to the Clog related to transactions.
MemTable: data modified by a read or write operation and stored in the memory.
SSTable: the baseline data stored on the disk. When a transaction reads or modifies data, the data is temporarily stored in MemTable. In a major compaction, data in the MemTable is compacted with data in the SSTable to form a new SSTable.
Each log stream is stored as multiple physical copies to ensure data security and high availability of data services. Each copy is called a replica of the log stream. Each replica may contain three major types of data: tablet static data stored in the SSTable on the disk, incremental tablet data stored in the MemTable in the memory, and logs that record transactions. OceanBase provides several types of replicas that contain different data categories to offer more choices in terms of data security, performance, elasticity, availability, and costs.
Replica types
At present, OceanBase Database supports only full-featured replicas.
Full-featured replicas
A general-purpose replica that has a full set of data types and features, including transaction logs, a MemTable, and an SSTable. A full-featured replica can switch to the leader role efficiently to provide services.
The following table describes the features of a full-featured replica.
| Features | Description |
|---|---|
| LOG | It has logs and participates in voting (SYNC_CLOG). |
| MemTables | It has MemTables (WITH_MEMSTORE). |
| SSTable | It has SSTables (WITH_SSSTORE). |
| Data security | High |
| Time to become the leader | Short |
| Resource cost | High |
| Services | Provides data read and write services as the leader and non-consistent read services as a follower. |
| Name (abbreviation) | FULL (F) |
| Replica type value | 0 |
Note
The value of replica_type is the ID of a replica type. Different types of replicas are identified based on this ID in the internal code. If the value of replica_type is a varchar, the name of the replica type is returned. If the value is an int, the value of the replica type is returned.