diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c index e9ad6d042a5d34985ab8ea5bcdc719b966de5522..44c17221415f0f31edf21f323057a46d1b1a7128 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_job.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c @@ -240,7 +240,12 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn, * be notified of the change also so make the state without * the resize. */ if(IS_JOB_RESIZING(job_ptr)) { - as_mysql_job_complete(mysql_conn, job_ptr); + /* If we have a db_index lets end the previous record. */ + if(job_ptr->db_index) + as_mysql_job_complete(mysql_conn, job_ptr); + else + error("We don't have a db_index for job %u, " + "this should never happen.", job_ptr->job_id); job_state &= (~JOB_RESIZING); job_ptr->db_index = 0; } diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 8dda334519b9aef4352f59ae94fcf275cbf280d8..714444fbda7b0749f2c5f369462235c1d8026e22 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -6481,6 +6481,12 @@ int update_job(job_desc_msg_t * job_specs, uid_t uid) /* Record accounting information for a job immediately before changing size */ extern void job_pre_resize_acctg(struct job_record *job_ptr) { + /* if we don't have a db_index go a start this one up since if + running with the slurmDBD the job may not have started yet. + */ + if(!job_ptr->db_index) + jobacct_storage_g_job_start(acct_db_conn, job_ptr); + job_ptr->job_state |= JOB_RESIZING; job_ptr->resize_time = time(NULL); /* NOTE: job_completion_logger() calls