forked from lei.chen/myxce
- Add load_snapshot(): reads P0 sentinel ("XCESNAP\0" + lsn), validates magic,
extracts checkpoint_lsn
- Add replay_wal(): scans seg-*.wal files in LSN order, skips entries <= from_lsn,
verifies CRC chain, stops on mismatch, applies entries via apply_wal_entry() stub
- Add persist_recover(): find latest .capnp snapshot, load it, replay post-checkpoint
WAL, retention pass (no-op in P0)
- Fix trim_wal_segments(): compare against active segment start LSN (not checkpoint_lsn)
to avoid deleting the currently-open segment and losing post-checkpoint WAL entries
- Add restore_job() stub in job.c (P0-12a placeholder)
- Add worker_from_capnp() stub in worker.c (P0-12 placeholder)
- Declare both new functions in cluster.h and worker.h
- Add 5 recovery tests: empty state, snapshot lsn loading, WAL replay, corrupt
sentinel rejection, latest-snapshot selection; all 23 controller tests pass
13 lines
338 B
C
13 lines
338 B
C
#if !defined(_WORKER_H_)
|
|
#define _WORKER_H_ 1
|
|
|
|
#include "config.h"
|
|
#include "mylock.h"
|
|
#include "netio.h"
|
|
#include "xce/types.h"
|
|
#include "zarray.h"
|
|
|
|
extern int add_worker(void*, endpoint_t*, const char*, hostattrs_t*);
|
|
extern int restore_worker(void*, xce_worker_t);
|
|
extern int worker_from_capnp(cluster_t*, const void*, size_t);
|
|
#endif
|