diff --git a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c index 9e9db7f8179f5bd6b6ac39cf818292af69de1523..213bac10f816d1633d38b63267312da1ed918274 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c @@ -1382,9 +1382,9 @@ extern int as_mysql_node_down(mysql_conn_t *mysql_conn, return SLURM_ERROR; if (reason) - my_reason = slurm_add_slash_to_quotes(reason); + my_reason = reason; else - my_reason = slurm_add_slash_to_quotes(node_ptr->reason); + my_reason = node_ptr->reason; row = mysql_fetch_row(result); if (row && (node_ptr->node_state == slurm_atoul(row[0])) && @@ -1396,7 +1396,6 @@ extern int as_mysql_node_down(mysql_conn_t *mysql_conn, node_ptr->name, mysql_conn->cluster_name, node_ptr->node_state, row[0], my_reason, row[1]); - xfree(my_reason); mysql_free_result(result); return SLURM_SUCCESS; } @@ -1434,7 +1433,7 @@ extern int as_mysql_node_down(mysql_conn_t *mysql_conn, DB_DEBUG(mysql_conn->conn, "query\n%s", query); rc = mysql_db_query(mysql_conn, query); xfree(query); - xfree(my_reason); + return rc; } diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c index 17ddff18c4e933e5dc06ee954da6b3f67b630eab..474e3f18eb36244d9c2d1d9ac9786652ce65e4b2 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_job.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c @@ -306,8 +306,7 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn, int rc = SLURM_SUCCESS; char *nodes = NULL, *jname = NULL, *node_inx = NULL; int track_steps = 0; - char *block_id = NULL, *partition = NULL, *work_dir = NULL; - char *gres_req = NULL, *gres_alloc = NULL, *mcs_label = NULL; + char *block_id = NULL, *partition = NULL; char temp_bit[BUF_SIZE]; char *query = NULL; int reinit = 0; @@ -466,9 +465,9 @@ extern int as_mysql_job_start(mysql_conn_t *mysql_conn, no_rollup_change: if (job_ptr->name && job_ptr->name[0]) - jname = slurm_add_slash_to_quotes(job_ptr->name); + jname = job_ptr->name; else { - jname = xstrdup("allocation"); + jname = "allocation"; track_steps = 1; } @@ -509,20 +508,9 @@ no_rollup_change: job_ptr->assoc_id); if (!IS_JOB_PENDING(job_ptr) && job_ptr->part_ptr) - partition = slurm_add_slash_to_quotes(job_ptr->part_ptr->name); + partition = job_ptr->part_ptr->name; else if (job_ptr->partition) - partition = slurm_add_slash_to_quotes(job_ptr->partition); - - if (job_ptr->gres_req) - gres_req = slurm_add_slash_to_quotes(job_ptr->gres_req); - - if (job_ptr->gres_alloc) - gres_alloc = slurm_add_slash_to_quotes(job_ptr->gres_alloc); - if (job_ptr->mcs_label) - mcs_label = slurm_add_slash_to_quotes(job_ptr->mcs_label); - if (job_ptr->details->work_dir) - work_dir = slurm_add_slash_to_quotes( - job_ptr->details->work_dir); + partition = job_ptr->partition; if (!job_ptr->db_index) { if (start_time && (job_state >= JOB_COMPLETE) && @@ -568,9 +556,9 @@ no_rollup_change: xstrcat(query, ", wckey"); if (node_inx) xstrcat(query, ", node_inx"); - if (gres_req) + if (job_ptr->gres_req) xstrcat(query, ", gres_req"); - if (gres_alloc) + if (job_ptr->gres_alloc) xstrcat(query, ", gres_alloc"); if (array_recs && array_recs->task_id_str) xstrcat(query, ", array_task_str, array_max_tasks, " @@ -582,7 +570,7 @@ no_rollup_change: xstrcat(query, ", tres_alloc"); if (job_ptr->tres_req_str) xstrcat(query, ", tres_req"); - if (work_dir) + if (job_ptr->details->work_dir) xstrcat(query, ", work_dir"); xstrfmtcat(query, @@ -604,8 +592,8 @@ no_rollup_change: if (wckeyid) xstrfmtcat(query, ", %u", wckeyid); - if (mcs_label) - xstrfmtcat(query, ", '%s'", mcs_label); + if (job_ptr->mcs_label) + xstrfmtcat(query, ", '%s'", job_ptr->mcs_label); if (job_ptr->account) xstrfmtcat(query, ", '%s'", job_ptr->account); if (partition) @@ -616,10 +604,10 @@ no_rollup_change: xstrfmtcat(query, ", '%s'", job_ptr->wckey); if (node_inx) xstrfmtcat(query, ", '%s'", node_inx); - if (gres_req) - xstrfmtcat(query, ", '%s'", gres_req); - if (gres_alloc) - xstrfmtcat(query, ", '%s'", gres_alloc); + if (job_ptr->gres_req) + xstrfmtcat(query, ", '%s'", job_ptr->gres_req); + if (job_ptr->gres_alloc) + xstrfmtcat(query, ", '%s'", job_ptr->gres_alloc); if (array_recs && array_recs->task_id_str) xstrfmtcat(query, ", '%s', %u, %u", array_recs->task_id_str, @@ -634,8 +622,9 @@ no_rollup_change: xstrfmtcat(query, ", '%s'", job_ptr->tres_alloc_str); if (job_ptr->tres_req_str) xstrfmtcat(query, ", '%s'", job_ptr->tres_req_str); - if (work_dir) - xstrfmtcat(query, ", '%s'", work_dir); + if (job_ptr->details->work_dir) + xstrfmtcat(query, ", '%s'", + job_ptr->details->work_dir); xstrfmtcat(query, ") on duplicate key update " @@ -663,7 +652,8 @@ no_rollup_change: if (wckeyid) xstrfmtcat(query, ", id_wckey=%u", wckeyid); if (job_ptr->mcs_label) - xstrfmtcat(query, ", mcs_label='%s'", mcs_label); + xstrfmtcat(query, ", mcs_label='%s'", + job_ptr->mcs_label); if (job_ptr->account) xstrfmtcat(query, ", account='%s'", job_ptr->account); if (partition) @@ -674,10 +664,11 @@ no_rollup_change: xstrfmtcat(query, ", wckey='%s'", job_ptr->wckey); if (node_inx) xstrfmtcat(query, ", node_inx='%s'", node_inx); - if (gres_req) - xstrfmtcat(query, ", gres_req='%s'", gres_req); - if (gres_alloc) - xstrfmtcat(query, ", gres_alloc='%s'", gres_alloc); + if (job_ptr->gres_req) + xstrfmtcat(query, ", gres_req='%s'", job_ptr->gres_req); + if (job_ptr->gres_alloc) + xstrfmtcat(query, ", gres_alloc='%s'", + job_ptr->gres_alloc); if (array_recs && array_recs->task_id_str) xstrfmtcat(query, ", array_task_str='%s', " "array_max_tasks=%u, array_task_pending=%u", @@ -696,8 +687,9 @@ no_rollup_change: if (job_ptr->tres_req_str) xstrfmtcat(query, ", tres_req='%s'", job_ptr->tres_req_str); - if (work_dir) - xstrfmtcat(query, ", work_dir='%s'", work_dir); + if (job_ptr->details->work_dir) + xstrfmtcat(query, ", work_dir='%s'", + job_ptr->details->work_dir); if (debug_flags & DEBUG_FLAG_DB_JOB) DB_DEBUG(mysql_conn->conn, "query\n%s", query); @@ -722,7 +714,8 @@ no_rollup_change: if (wckeyid) xstrfmtcat(query, "id_wckey=%u, ", wckeyid); if (job_ptr->mcs_label) - xstrfmtcat(query, "mcs_label='%s', ", mcs_label); + xstrfmtcat(query, "mcs_label='%s', ", + job_ptr->mcs_label); if (job_ptr->account) xstrfmtcat(query, "account='%s', ", job_ptr->account); if (partition) @@ -733,10 +726,12 @@ no_rollup_change: xstrfmtcat(query, "wckey='%s', ", job_ptr->wckey); if (node_inx) xstrfmtcat(query, "node_inx='%s', ", node_inx); - if (gres_req) - xstrfmtcat(query, "gres_req='%s', ", gres_req); - if (gres_alloc) - xstrfmtcat(query, "gres_alloc='%s', ", gres_alloc); + if (job_ptr->gres_req) + xstrfmtcat(query, "gres_req='%s', ", + job_ptr->gres_req); + if (job_ptr->gres_alloc) + xstrfmtcat(query, "gres_alloc='%s', ", + job_ptr->gres_alloc); if (array_recs && array_recs->task_id_str) xstrfmtcat(query, "array_task_str='%s', " "array_max_tasks=%u, " @@ -756,8 +751,9 @@ no_rollup_change: if (job_ptr->tres_req_str) xstrfmtcat(query, "tres_req='%s', ", job_ptr->tres_req_str); - if (work_dir) - xstrfmtcat(query, "work_dir='%s', ", work_dir); + if (job_ptr->details->work_dir) + xstrfmtcat(query, "work_dir='%s', ", + job_ptr->details->work_dir); xstrfmtcat(query, "time_start=%ld, job_name='%s', " "state=greatest(state, %u), " @@ -791,13 +787,7 @@ no_rollup_change: end_it: xfree(tres_alloc_str); xfree(block_id); - xfree(partition); - xfree(gres_req); - xfree(gres_alloc); - xfree(jname); xfree(query); - xfree(mcs_label); - xfree(work_dir); return rc; } @@ -832,11 +822,9 @@ extern List as_mysql_modify_job(mysql_conn_t *mysql_conn, uint32_t uid, if (job->derived_ec != NO_VAL) xstrfmtcat(vals, ", derived_ec=%u", job->derived_ec); - if (job->derived_es) { - char *derived_es = slurm_add_slash_to_quotes(job->derived_es); - xstrfmtcat(vals, ", derived_es='%s'", derived_es); - xfree(derived_es); - } + if (job->derived_es) + xstrfmtcat(vals, ", derived_es='%s'", job->derived_es); + if (!vals) { errno = SLURM_NO_CHANGE_IN_DATA; error("No change specified for job modification"); @@ -1040,18 +1028,12 @@ extern int as_mysql_job_complete(mysql_conn_t *mysql_conn, else if (job_ptr->tres_alloc_str) xstrfmtcat(query, ", tres_alloc='%s'", job_ptr->tres_alloc_str); - if (job_ptr->comment) { - char *comment = slurm_add_slash_to_quotes(job_ptr->comment); - xstrfmtcat(query, ", derived_es='%s'", comment); - xfree(comment); - } + if (job_ptr->comment) + xstrfmtcat(query, ", derived_es='%s'", job_ptr->comment); - if (job_ptr->admin_comment) { - char *comment = slurm_add_slash_to_quotes( - job_ptr->admin_comment); - xstrfmtcat(query, ", admin_comment='%s'", comment); - xfree(comment); - } + if (job_ptr->admin_comment) + xstrfmtcat(query, ", admin_comment='%s'", + job_ptr->admin_comment); exit_code = job_ptr->exit_code; if (exit_code == 1) { @@ -1082,7 +1064,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn, int rc = SLURM_SUCCESS; char temp_bit[BUF_SIZE]; char node_list[BUFFER_SIZE]; - char *node_inx = NULL, *step_name = NULL; + char *node_inx = NULL; time_t start_time, submit_time; char *query = NULL; @@ -1201,8 +1183,6 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn, } } - step_name = slurm_add_slash_to_quotes(step_ptr->name); - /* we want to print a -1 for the requid so leave it a %d */ /* The stepid could be -2 so use %d not %u */ @@ -1221,7 +1201,7 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn, mysql_conn->cluster_name, step_table, step_ptr->job_ptr->db_index, step_ptr->step_id, - (int)start_time, step_name, + (int)start_time, step_ptr->name, JOB_RUNNING, step_ptr->tres_alloc_str, nodes, tasks, node_list, node_inx, task_dist, step_ptr->cpu_freq_max, step_ptr->cpu_freq_min, @@ -1233,7 +1213,6 @@ extern int as_mysql_step_start(mysql_conn_t *mysql_conn, DB_DEBUG(mysql_conn->conn, "query\n%s", query); rc = mysql_db_query(mysql_conn, query); xfree(query); - xfree(step_name); return rc; } diff --git a/src/plugins/accounting_storage/mysql/as_mysql_resv.c b/src/plugins/accounting_storage/mysql/as_mysql_resv.c index 86cde4929dff507bd0cbf99476094d12c474bf10..0322be4603d2d6c1a2d916ee1c885c0c96a90705 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_resv.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_resv.c @@ -98,11 +98,9 @@ static int _setup_resv_limits(slurmdb_reservation_rec_t *resv, } if (resv->name) { - char *tmp_char = slurm_add_slash_to_quotes(resv->name); xstrcat(*cols, ", resv_name"); - xstrfmtcat(*vals, ", '%s'", tmp_char); - xstrfmtcat(*extra, ", resv_name='%s'", tmp_char); - xfree(tmp_char); + xstrfmtcat(*vals, ", '%s'", resv->name); + xstrfmtcat(*extra, ", resv_name='%s'", resv->name); } if (resv->nodes) {