feat(worker-rejoin-resync): add worker reconciling status type (task 1.2)

Add XCE_WORKER_RECONCILING status bit (0x00800000, next in the existing
sequential bitmask) + IS_WORKER_RECONCILING macro mirroring
IS_WORKER_UNAVAIL's shape, and resync_state_t (round_token,
queried_jobids array+count, deadline) referenced via a nullable
worker_t.resync pointer -- NULL when no reconciliation round is
outstanding. Compiles and is reachable, unused by any caller yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y4M5MJM2zK6nU43da267Ku
This commit is contained in:
Rongsong Shen 2026-09-01 09:04:29 +00:00
parent 1ff57ef66e
commit 1260d9134b
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 28 additions and 6 deletions

View file

@ -7,7 +7,7 @@
- Observable completion: the schema builds cleanly and the new message/opcode/config-field definitions are visible in the generated bindings
- _Requirements: 2.1, 2.2, 3.5, 3.7, 5.3, 8.1, 8.2, 8.3_
- [ ] 1.2 (P) Add a worker reconciling status and round-tracking state
- [x] 1.2 (P) Add a worker reconciling status and round-tracking state
- Add a new worker status value meaning "job-state reconciliation outstanding for this host"
- Add a per-worker reconciliation-round structure capable of holding a round identifier, the set of queried job IDs, and a deadline
- Observable completion: the new status value and round structure compile and are reachable from the worker record, unused by any caller yet

View file

@ -174,6 +174,7 @@ typedef struct {
#define XCE_WORKER_CLOSED (0x00100000)
#define XCE_WORKER_HIDDEN (0x00200000) /* Admin explicitly removed — invisible but not yet cleaned up */
#define XCE_WORKER_CLOSED_BY_ADMIN (0x00400000) /* Admin closed — host closed explicitly by admin */
#define XCE_WORKER_RECONCILING (0x00800000) /* worker-rejoin-resync: job-state reconciliation outstanding for this host (Req 5.1) */
#define IS_WORKER_UNAVAIL(status) (((status) & XCE_WORKER_UNAVAIL) != 0)
#define IS_WORKER_LOCKEDU(status) (((status) & XCE_WORKER_LOCKEDU) != 0)
@ -182,6 +183,7 @@ typedef struct {
#define IS_WORKER_LOCKED(status) \
(IS_WORKER_LOCKEDU(status) || IS_WORKER_LOCKEDW(status))
#define IS_WORKER_BUSY(status) (((status) & XCE_WORKER_BUSY) != 0)
#define IS_WORKER_RECONCILING(status) (((status) & XCE_WORKER_RECONCILING) != 0)
typedef struct {
char* hosttype;
@ -281,12 +283,32 @@ typedef struct {
double allocated;
} xce_res_account_t;
/* worker-rejoin-resync: per-worker job-state reconciliation round. One
* resync_state_t per worker_t (worker_t.resync below), absent (NULL) when
* no reconciliation is currently outstanding for that worker. Purely
* in-memory bookkeeping, not itself persisted -- see design.md's Data
* Models / State Management for the full rationale. */
typedef struct {
xce_worker_t host;
char hostkey[XCE_MAXKEY_LEN];
endpoint_t* ep;
int idx;
zarray_t usages;
uint64_t round_token; /* discards stale/superseded reports (Req 6.3) */
int n_queried_jobids;
uint64_t* queried_jobids; /* set semantics (membership-checked, not
* positionally iterated): job IDs queried this
* round; array+count, mirroring
* xce_job_state_query_t.jobids (typemap.h) */
uint64_t deadline; /* CLOCK_MONOTONIC ms deadline (Req 5.3); same
* representation as delaymgr_t.nextrun_ms
* (delay.h) */
} resync_state_t;
typedef struct {
xce_worker_t host;
char hostkey[XCE_MAXKEY_LEN];
endpoint_t* ep;
int idx;
zarray_t usages;
resync_state_t* resync; /* worker-rejoin-resync: NULL unless a job-state
* reconciliation round is currently outstanding
* for this worker */
} worker_t;
typedef struct {