ExESDB.ConsistencyChecker (ex_esdb v0.1.7)

Provides tools for verifying consistency across ExESDB cluster stores.

This module leverages Khepri and Ra APIs to verify that stores are consistent across cluster nodes, detect split-brain scenarios, and ensure data integrity.

Summary

Functions

Checks Raft log consistency across cluster members. This is a more intensive check that examines log indices and terms.

Quick health check to verify if a store is accessible and responsive across nodes.

Monitors consistency over time and reports any deviations.

Performs a comprehensive consistency check across all cluster nodes for a given store.

Verifies that all nodes agree on cluster membership.

Types

check_result()

@type check_result() :: {:ok, map()} | {:error, term()}

consistency_result()

@type consistency_result() :: :consistent | :inconsistent | :error

node_name()

@type node_name() :: atom()

store_id()

@type store_id() :: atom()

Functions

check_raft_log_consistency(store_id)

@spec check_raft_log_consistency(store_id()) :: check_result()

Checks Raft log consistency across cluster members. This is a more intensive check that examines log indices and terms.

quick_health_check(store_id)

@spec quick_health_check(store_id()) :: check_result()

Quick health check to verify if a store is accessible and responsive across nodes.

start_consistency_monitoring(store_id, interval_ms \\ 30000)

@spec start_consistency_monitoring(store_id(), pos_integer()) :: {:ok, pid()}

Monitors consistency over time and reports any deviations.

verify_cluster_consistency(store_id)

@spec verify_cluster_consistency(store_id()) :: check_result()

Performs a comprehensive consistency check across all cluster nodes for a given store.

Returns

  • {:ok, report} - Detailed consistency report
  • {:error, reason} - Error occurred during check

Example

iex> ExESDB.ConsistencyChecker.verify_cluster_consistency(:my_store)
{:ok, %{
  status: :consistent,
  nodes_checked: 3,
  leader: :"node1@host",
  members: [:"node1@host", :"node2@host", :"node3@host"],
  raft_status: :healthy,
  potential_issues: []
}}

verify_membership_consensus(store_id)

@spec verify_membership_consensus(store_id()) :: check_result()

Verifies that all nodes agree on cluster membership.