forked from lei.chen/myxce
fix(waldump): decode WAL_CONFIG_MARKER, distinguish trimmed gaps from real loss
wal_type_name() never had a case for WAL_CONFIG_MARKER (type 50) -- every config-change marker entry printed as UNKNOWN instead of a real, defined type. Added the case plus payload decode (tag/sha256) matching config_repl.c's config_marker_encode/_decode byte layout, hand-decoded here rather than linking config_repl.c into xce_test's link graph. Gap detection also had no way to tell "committed prefix missing!" (real loss) apart from a normal checkpoint-triggered WAL trim (persist.c's trim_wal_segments, floor-guarded so it never removes a segment a standby still needs) -- every long-running node's WAL, once checkpointed, would false-alarm on every inspection. Cross-checks the sibling data/snap/ directory (snapshot LSN is literally in the filename, snap-<hex>.capnp) and downgrades the message when a snapshot covers the gap. Adds waldump_stats_t.leading_gap_explained and 3 new tests plus one assertion on the existing gap test.
This commit is contained in:
parent
0ca96359f5
commit
a86de77f91
3 changed files with 228 additions and 5 deletions
|
|
@ -29,6 +29,13 @@ typedef struct {
|
|||
uint32_t n_dup_identical; /* of n_dup_submits, those whose payload is
|
||||
* byte-identical to the prior entry */
|
||||
int crc_broken; /* nonzero if a CRC/chain break truncated a segment */
|
||||
int leading_gap_explained; /* nonzero if the leading (prefix) gap's
|
||||
* upper LSN is covered by a sibling
|
||||
* data/snap/snap-<hex>.capnp file — i.e.
|
||||
* normal checkpoint-triggered WAL trim
|
||||
* (persist.c trim_wal_segments), not
|
||||
* genuine loss. 0 if there was no leading
|
||||
* gap, or no covering snapshot was found. */
|
||||
} waldump_stats_t;
|
||||
|
||||
/* One physically-present, CRC-valid WAL entry, surfaced to a visitor so a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue