From 5ea3c44fe74d1dbb9d2db297c613b4b360f1af2f Mon Sep 17 00:00:00 2001 From: Marshall Garey <marshall@schedmd.com> Date: Tue, 28 Nov 2017 09:48:19 -0700 Subject: [PATCH] Fix for commit 9ed24025a6 to fix issue where job ordering causes wrong unused wall. The "order by" part of the original sql query was wrong. I had a situation where I had 2 jobs in an updated reservation, but instead of adding their times together, they were overwriting their times. This happened because of the ordering of the rows, where the reservation got split up because of the "order by job.time_start". That was simply wrong. Bug 4406 --- .../accounting_storage/mysql/as_mysql_convert.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/plugins/accounting_storage/mysql/as_mysql_convert.c b/src/plugins/accounting_storage/mysql/as_mysql_convert.c index c062ee1ed3e..129cf6124e4 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_convert.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_convert.c @@ -472,15 +472,10 @@ static int _convert_resv_table(mysql_conn_t *mysql_conn, char *cluster_name) } /* - * Ordering is important. First order by the resv id so rows - * with the same resv are consecutive. Then order by job start - * and end times (ascending) to make removing overlapping job - * time easy. + * Order by the resv id and resv time start so rows with the + * same resv are consecutive. */ - query = xstrdup_printf("select %s from \"%s_%s\" as rt left join " - "\"%s_%s\" as jt on (rt.id_resv = " - "jt.id_resv) order by rt.id_resv, " - "jt.time_start ASC, jt.time_end ASC;", + query = xstrdup_printf("select %s from \"%s_%s\" as rt left join \"%s_%s\" as jt on (rt.id_resv = jt.id_resv) order by rt.id_resv ASC, rt.time_start ASC;", join_str, cluster_name, resv_table, cluster_name, job_table); xfree(join_str); -- GitLab