Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:4paradigm OpenMLDB Data Recovery

From Leeroopedia
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:

Staterecovered=Snapshot+Replay(Binlog,offsetsnapshot)

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 CheckTable function verifies that all partitions are alive and leader/follower roles match
  • Recovery uses HTTP LoadTable to restore data from disk, then RecoverTablePartition to re-establish followers
  • After recovery, verify table health with CheckTable

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment