fix(apiserver): an accepted job is in the job store at once (bug-1894)

The apiserver's job store learned of a new job only from the
controller's asynchronous OnJobCreated / array push, so a 'jobs kill'
(or query) straight after 'jobs submit' could answer 'job not found'
for the job just accepted (2 of 4 immediate kills).

services.SubmitJob now records the accepted job right after the
controller's reply (which comes only after the job is committed and
applied): one record per element, base+i for arrays, stored with the new
DataStore.PutIfAbsent and marked JobInfo.Provisional (json:"-", not a
column). An OnJobCreated that already arrived is never overwritten; the
push that arrives later replaces the provisional record -- including in
dispatchJobArray, whose duplicate check no longer treats a provisional
element as already known.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-30 04:23:10 +00:00
parent 3e6c48a1fe
commit 141ac22c54
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 177 additions and 2 deletions

View file

@ -484,6 +484,11 @@ var JobFieldMappings = map[string]string{
}
type JobInfo struct {
// Provisional marks a record the apiserver stored itself when the
// controller accepted the submit, before the controller's own
// OnJobCreated/array push arrived (bug-1894); that push replaces it.
// Not a column: json "-" keeps it out of query results.
Provisional bool `json:"-"`
Unique_JobID int64 `json:"unique_job_id"`
JobID int64 `json:"job_id"`
ArrayIdx int `json:"array_idx"` //new