Principle:4paradigm OpenMLDB Data Recovery
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, High_Availability |
| Last Updated | 2026-10-12 12:00 GMT |
Overview
A data recovery methodology that restores table partitions from binlogs and snapshots after tablet failures, re-establishing leader/follower relationships and ensuring data consistency across replicas.
Description
Data recovery in OpenMLDB is the process of restoring table data when tablets have failed or partitions have become unavailable. The RecoverData operation iterates through all databases and tables, checks each table's health, and for unhealthy tables, recovers each partition by: loading the table from disk via HTTP, updating the alive status of replicas, recovering table partitions from the nameserver, and waiting for recovery operations to complete. The recovery process leverages binlogs (write-ahead logs) and snapshots to restore data to a consistent state.
The key problem solved is data unavailability after failures: when tablets crash or lose data, partitions may become unavailable or inconsistent. Recovery restores them to a healthy, consistent state.
Usage
Use this principle after tablet failures, disk corruption, or cluster restarts where data consistency is uncertain. The RecoverData command automates the full recovery process.
Theoretical Basis
Data recovery follows the log replay pattern:
Where the snapshot provides a base state and binlog entries after the snapshot point are replayed to reach the latest consistent state.
Pseudo-code for data recovery:
# Abstract algorithm (NOT real implementation)
def recover_data(cluster):
for db in all_databases(cluster):
for table in all_tables(db):
if not check_table_healthy(table):
for partition in table.partitions:
leader = find_leader(partition)
if leader not in tablet:
load_table_from_disk(leader) # HTTP LoadTable
if not leader.alive:
update_alive(leader, alive=True)
for follower in partition.followers:
update_alive(follower, alive=False)
recover_table_partition(follower)
wait_all_ops_done(table)
verify_table_healthy(table)
Practical Guide
- Always disable auto-failover before running recovery
- Recovery processes internal databases (
__INTERNAL_DB,__PRE_AGG_DB,INFORMATION_SCHEMA) alongside user databases - The
CheckTablefunction verifies that all partitions are alive and leader/follower roles match - Recovery uses HTTP
LoadTableto restore data from disk, thenRecoverTablePartitionto re-establish followers - After recovery, verify table health with
CheckTable