Hi,
Recently, I had to load some job data archive files in the
slurmdbd/mysql database but I encountered a problem of data shift.
In the src/plugins/accounting_storage/mysql/as_mysql_archive.c source
file, there is a mismatch between the static array "job_req_inx" and the
corresponding enum type {JOB_REQ_*,...} that causes a shift of some jobs
data during the archiving process (function _archive_jobs).
When we look at the job_req_inx array, the shift affects (and includes)
the variables between "partition" and "id_resv" for all versions of
slurmdbd protocol (the mismatch has been there for a very long time).
So, for example, when we look at a job archive file generated by an
rpc_version >=SLURMDBD_2_6_VERSION or >= SLURM_14_11_PROTOCOL_VERSION,
we can notice that during the _archive_jobs call:
partition is saved in the resvid location
priority in partition location
qos in priority location
req_cpus in qos location
req_mem in req_cpus location
resvid in req_mem location
So when we run "sacctmgr archive load ...", the job archive file is
decoded with "_unpack_local_job" but the object->resvid variable
receives the partition value, the object->partition receives the
priority value, etc...
The problem can be be solved during the job archive file reading by
modifying the _unpack_local_job function and moving the
"unpackstr_ptr(&object->partition, &tmp32, buffer)" call. Concerning the
mismatch, it should be corrected in a future slurmdbd protocol revision,
by moving JOB_REQ_RESVID before JOB_REQ_START in the enum type.
For slurm-14.11, the reading patch is:
static int _unpack_local_job(local_job_t *object,
uint16_t rpc_version, Buf buffer)
{
uint32_t tmp32;
if (rpc_version >= SLURM_14_11_PROTOCOL_VERSION) {
unpackstr_ptr(&object->account, &tmp32, buffer);
unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer);
unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer);
unpackstr_ptr(&object->associd, &tmp32, buffer);
unpackstr_ptr(&object->array_jobid, &tmp32, buffer);
unpackstr_ptr(&object->array_max_tasks, &tmp32, buffer);
unpackstr_ptr(&object->array_taskid, &tmp32, buffer);
unpackstr_ptr(&object->blockid, &tmp32, buffer);
unpackstr_ptr(&object->derived_ec, &tmp32, buffer);
unpackstr_ptr(&object->derived_es, &tmp32, buffer);
unpackstr_ptr(&object->exit_code, &tmp32, buffer);
unpackstr_ptr(&object->timelimit, &tmp32, buffer);
unpackstr_ptr(&object->eligible, &tmp32, buffer);
unpackstr_ptr(&object->end, &tmp32, buffer);
unpackstr_ptr(&object->gid, &tmp32, buffer);
unpackstr_ptr(&object->id, &tmp32, buffer);
unpackstr_ptr(&object->jobid, &tmp32, buffer);
unpackstr_ptr(&object->kill_requid, &tmp32, buffer);
unpackstr_ptr(&object->name, &tmp32, buffer);
unpackstr_ptr(&object->nodelist, &tmp32, buffer);
unpackstr_ptr(&object->node_inx, &tmp32, buffer);
//unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->priority, &tmp32, buffer);
unpackstr_ptr(&object->qos, &tmp32, buffer);
unpackstr_ptr(&object->req_cpus, &tmp32, buffer);
unpackstr_ptr(&object->req_mem, &tmp32, buffer);
unpackstr_ptr(&object->resvid, &tmp32, buffer);
unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->start, &tmp32, buffer);
unpackstr_ptr(&object->state, &tmp32, buffer);
unpackstr_ptr(&object->submit, &tmp32, buffer);
unpackstr_ptr(&object->suspended, &tmp32, buffer);
unpackstr_ptr(&object->track_steps, &tmp32, buffer);
unpackstr_ptr(&object->uid, &tmp32, buffer);
unpackstr_ptr(&object->wckey, &tmp32, buffer);
unpackstr_ptr(&object->wckey_id, &tmp32, buffer);
} else if (rpc_version >= SLURMDBD_2_6_VERSION) {
unpackstr_ptr(&object->account, &tmp32, buffer);
unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer);
unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer);
unpackstr_ptr(&object->associd, &tmp32, buffer);
unpackstr_ptr(&object->blockid, &tmp32, buffer);
unpackstr_ptr(&object->derived_ec, &tmp32, buffer);
unpackstr_ptr(&object->derived_es, &tmp32, buffer);
unpackstr_ptr(&object->exit_code, &tmp32, buffer);
unpackstr_ptr(&object->timelimit, &tmp32, buffer);
unpackstr_ptr(&object->eligible, &tmp32, buffer);
unpackstr_ptr(&object->end, &tmp32, buffer);
unpackstr_ptr(&object->gid, &tmp32, buffer);
unpackstr_ptr(&object->id, &tmp32, buffer);
unpackstr_ptr(&object->jobid, &tmp32, buffer);
unpackstr_ptr(&object->kill_requid, &tmp32, buffer);
unpackstr_ptr(&object->name, &tmp32, buffer);
unpackstr_ptr(&object->nodelist, &tmp32, buffer);
unpackstr_ptr(&object->node_inx, &tmp32, buffer);
//unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->priority, &tmp32, buffer);
unpackstr_ptr(&object->qos, &tmp32, buffer);
unpackstr_ptr(&object->req_cpus, &tmp32, buffer);
unpackstr_ptr(&object->req_mem, &tmp32, buffer);
unpackstr_ptr(&object->resvid, &tmp32, buffer);
unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->start, &tmp32, buffer);
unpackstr_ptr(&object->state, &tmp32, buffer);
unpackstr_ptr(&object->submit, &tmp32, buffer);
unpackstr_ptr(&object->suspended, &tmp32, buffer);
unpackstr_ptr(&object->track_steps, &tmp32, buffer);
unpackstr_ptr(&object->uid, &tmp32, buffer);
unpackstr_ptr(&object->wckey, &tmp32, buffer);
unpackstr_ptr(&object->wckey_id, &tmp32, buffer);
} else {
unpackstr_ptr(&object->account, &tmp32, buffer);
unpackstr_ptr(&object->alloc_cpus, &tmp32, buffer);
unpackstr_ptr(&object->alloc_nodes, &tmp32, buffer);
unpackstr_ptr(&object->associd, &tmp32, buffer);
unpackstr_ptr(&object->blockid, &tmp32, buffer);
unpackstr_ptr(&object->derived_ec, &tmp32, buffer);
unpackstr_ptr(&object->derived_es, &tmp32, buffer);
unpackstr_ptr(&object->exit_code, &tmp32, buffer);
unpackstr_ptr(&object->timelimit, &tmp32, buffer);
unpackstr_ptr(&object->eligible, &tmp32, buffer);
unpackstr_ptr(&object->end, &tmp32, buffer);
unpackstr_ptr(&object->gid, &tmp32, buffer);
unpackstr_ptr(&object->id, &tmp32, buffer);
unpackstr_ptr(&object->jobid, &tmp32, buffer);
unpackstr_ptr(&object->kill_requid, &tmp32, buffer);
unpackstr_ptr(&object->name, &tmp32, buffer);
unpackstr_ptr(&object->nodelist, &tmp32, buffer);
unpackstr_ptr(&object->node_inx, &tmp32, buffer);
//unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->priority, &tmp32, buffer);
unpackstr_ptr(&object->qos, &tmp32, buffer);
unpackstr_ptr(&object->req_cpus, &tmp32, buffer);
unpackstr_ptr(&object->resvid, &tmp32, buffer);
unpackstr_ptr(&object->partition, &tmp32, buffer);
unpackstr_ptr(&object->start, &tmp32, buffer);
unpackstr_ptr(&object->state, &tmp32, buffer);
unpackstr_ptr(&object->submit, &tmp32, buffer);
unpackstr_ptr(&object->suspended, &tmp32, buffer);
unpackstr_ptr(&object->track_steps, &tmp32, buffer);
unpackstr_ptr(&object->uid, &tmp32, buffer);
unpackstr_ptr(&object->wckey, &tmp32, buffer);
unpackstr_ptr(&object->wckey_id, &tmp32, buffer);
}
return SLURM_SUCCESS;
}
But as I say, the problem occurs for all slurm release and all
"as_mysql_archive.c" source files should be modified...
Best regards,
Didier