forked from lei.chen/myxce
feat(raft-apply-decoupling): defer job construction past the commit barrier (task 3.1)
Reorder handle_jobsubmit() so job objects are constructed via create_job() only after the WAL commit succeeds, not before. Adds jobid_range_exists() for a fast-fail pre-check with no WAL work, and persist_submit_job_payloads_and_commit() (persist.c) operating on raw xce_job_t* payloads instead of pre-existing job_t*. Commit remains synchronous -- converting to the continuation-based commit API is task 3.2. Fixes bug-1408 (found during review): the post-commit array- construction loop suppressed notification for an entire array batch if any one sibling element failed to construct, stranding other durably-committed and successfully-constructed jobs invisible until the next restart's replay. Notification now fires unconditionally for every successfully-constructed element, independent of sibling failures; the client reply still separately reports the batch's construction status.
This commit is contained in:
parent
8febd663d5
commit
6f1fa97fab
6 changed files with 871 additions and 399 deletions
|
|
@ -719,6 +719,19 @@ void persist_log_entry_metadata(const wal_entry_hdr_t* hdr);
|
|||
* a negative rc MUST reject the submission (never reply success). */
|
||||
int persist_submit_wal_and_commit(persist_t* p, xlist_t* jlist);
|
||||
|
||||
/* Sibling of persist_submit_wal_and_commit for callers that must not
|
||||
* construct any job object before the commit barrier succeeds
|
||||
* (raft-apply-decoupling task 3.1 / Req 2.1, 2.3): `payloads` is an xlist_t
|
||||
* of xce_job_t* — raw submission data that has never been registered in any
|
||||
* job table. WAL-appends + majority-commits each entry in order; on full
|
||||
* success (return 0), out_lsns[i] holds payloads[i]'s committed LSN, for the
|
||||
* caller to construct and tag the corresponding job object AFTER this call
|
||||
* returns — there is nothing to roll back on failure because nothing was
|
||||
* ever constructed. Returns the first negative rc on failure; out_lsns is
|
||||
* only valid up to (not including) the failed index. */
|
||||
int persist_submit_job_payloads_and_commit(persist_t* p, xlist_t* payloads,
|
||||
uint64_t* out_lsns);
|
||||
|
||||
int persist_job_hook_fun(int type, int situation, int detail,
|
||||
void* cls, va_list ap);
|
||||
int persist_queue_hook_fun(int type, int situation, int detail,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue