test(raft-ha-core-safety): machine-checkable walcompare report (task 1.1)
Per-member (lsn,term,pcrc,present) report + committed-vs-uncommitted divergence classification via walcompare_report()/--report. Soak signal (OK/exit-code) preserved. 4 new unit tests, all GREEN.
This commit is contained in:
parent
227f592250
commit
b028d25dbd
5 changed files with 453 additions and 120 deletions
|
|
@ -32,6 +32,9 @@ typedef struct {
|
|||
uint64_t member_term[16]; /* per-member matched term at lsn */
|
||||
uint32_t member_pcrc[16]; /* per-member payload CRC at lsn */
|
||||
int member_present[16]; /* 1 if the member holds this LSN, else 0 */
|
||||
int committed; /* 1 = divergence within the committed prefix
|
||||
* (lsn <= committed boundary, a safety
|
||||
* violation); 0 = uncommitted tail divergence */
|
||||
} walcompare_divergence_t;
|
||||
|
||||
/* Result codes. */
|
||||
|
|
@ -62,3 +65,29 @@ enum {
|
|||
*/
|
||||
int walcompare(const walcompare_member_t* members, int n, FILE* out,
|
||||
walcompare_divergence_t* div);
|
||||
|
||||
/* Same comparison as walcompare(), but ALSO emits a machine-checkable,
|
||||
* per-member report over the full log: one
|
||||
*
|
||||
* WALCMP member=<i> lsn=<L> term=<T> pcrc=<8hex> status=<present|MISSING|beyond> committed=<0|1>
|
||||
*
|
||||
* line per (member, LSN) for every LSN in [1..max-recovered-tip], where
|
||||
* `committed=1` iff the LSN is within the committed boundary. Each divergence
|
||||
* additionally emits a
|
||||
*
|
||||
* WALCMP_DIVERGENCE lsn=<L> class=<committed|uncommitted> compared=<c> present=<p>
|
||||
*
|
||||
* classification line. A `committed` divergence is fatal (verdict
|
||||
* WALCMP_DIVERGENT, `div->committed = 1`); an `uncommitted`-tail divergence
|
||||
* (above the committed boundary) is reported but NON-fatal — the verdict stays
|
||||
* WALCMP_OK when the committed prefix is identical. Field order is fixed and
|
||||
* the tokens are stable so the harness can grep them. `out` must be non-NULL.
|
||||
*
|
||||
* Backward-compatible: walcompare() keeps its original concise output (the
|
||||
* `== walcompare ==` header, the human divergence block, and the final
|
||||
* `walcompare: OK` verdict line) and additionally emits the machine
|
||||
* classification at a committed divergence; only walcompare_report() prints the
|
||||
* full per-LSN table and scans the uncommitted tail.
|
||||
*/
|
||||
int walcompare_report(const walcompare_member_t* members, int n, FILE* out,
|
||||
walcompare_divergence_t* div);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue