You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replicate ColumnInfo stats via Raft for multi-node ANALYZE consistency #76
PR #75 introduced per-column statistics (ndv, min_int, max_int, min_double, max_double, min_str_len, max_str_len, null_count) stored in ColumnInfo. When a catalog change (CREATE TABLE) is replicated via the Catalog Raft Group, only name/type/position are serialized.
Problem
On multi-node deployments, a table created on the leader has its DDL replicated via Raft, but the deserialization in Catalog::apply() does not include the new stats fields. This means replicas will have tables with empty stats even after ANALYZE TABLE is run on the leader, creating an inconsistency.
Proposed Solution
Extend the CREATE TABLE serialization in Catalog::create_table() to emit the full ColumnInfo after the existing [CNameLen][CName][Type][Pos] fields:
Write has_stats as a byte (0/1)
Write null_count as uint64
For each optional stat (min_int, max_int, min_double, etc.): write a presence byte followed by the value if present
Use a stable, deterministic field order
Extend Catalog::apply() deserialization to read the new fields and construct ColumnInfo with full stats (or call a new constructor).
Maintain backward compatibility: handle older log entries that lack the extra bytes by treating missing fields as absent/default.
Files Affected
src/catalog/catalog.cpp — create_table() serialization path and apply() deserialization path
include/catalog/catalog.hpp — possibly a new ColumnInfo constructor
Activity