Principle:4paradigm OpenMLDB Failover Management
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, High_Availability |
| Last Updated | 2026-10-12 12:00 GMT |
Overview
A cluster management mechanism that controls automatic failure detection and recovery, allowing operators to safely perform maintenance by disabling self-healing during operations.
Description
Failover management in OpenMLDB controls whether the cluster automatically detects tablet failures and re-elects partition leaders. When auto_failover is enabled, the nameserver monitors tablet heartbeats and automatically migrates leader partitions away from failed tablets. During maintenance operations (scaling, upgrades, data recovery), auto-failover must be disabled to prevent the cluster from reacting to intentionally stopped tablets. After maintenance completes, auto-failover is re-enabled to restore self-healing.
The key problem solved is safety during maintenance: if auto-failover is active during a rolling upgrade, the cluster would interpret each intentionally stopped tablet as a failure, triggering unnecessary leader migrations and potentially causing data inconsistency.
Usage
Use this principle when performing any cluster maintenance operation. The pattern is: disable auto-failover → perform operation → verify completion → re-enable auto-failover.
Theoretical Basis
Failover management follows the maintenance window pattern:
The auto-failover state machine:
# Abstract algorithm (NOT real implementation)
# Normal operation (auto_failover=True):
if tablet_heartbeat_timeout(tablet):
mark_tablet_offline(tablet)
for partition in tablet.partitions:
if partition.is_leader:
elect_new_leader(partition) # automatic
# Maintenance operation (auto_failover=False):
if tablet_heartbeat_timeout(tablet):
log_warning("tablet offline, auto_failover disabled")
# No automatic action — operator controls the process
Practical Guide
- Always disable auto-failover before any maintenance operation
- Save the original auto-failover state — only re-enable if it was originally enabled
- The
Executor.GetAutofailover()method returns the current state - The
Executor.SetAutofailover("true"/"false")method changes the state - Heartbeat timeout and check interval flags control how quickly failures are detected