diff --git a/0038-fix-querying-the-user-binding-qos.patch b/0038-fix-querying-the-user-binding-qos.patch new file mode 100644 index 0000000000000000000000000000000000000000..46a743497183b1fb4e3df56309308b2640445933 --- /dev/null +++ b/0038-fix-querying-the-user-binding-qos.patch @@ -0,0 +1,105 @@ +From 19e4bf1c3cc632a045aaa1053a0f64694ea9e5c0 Mon Sep 17 00:00:00 2001 +From: motodiary +Date: Fri, 31 May 2024 10:05:24 +0800 +Subject: [PATCH] fix querying the user binding qos + +--- + .../accounting_storage/pgsql/as_pgsql_assoc.c | 57 ++++++++++--------- + 1 file changed, 30 insertions(+), 27 deletions(-) + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c b/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c +index 1f98dd5..c5eadf0 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c +@@ -1642,31 +1642,32 @@ static int _process_modify_assoc_results(pgsql_conn_t *pgsql_conn, + */ + if (new_qos[0] == '-') { + xstrfmtcat(vals, +- ", qos=if (qos='', '', " +- "replace(replace(" +- "qos, ',%s,', ','), " +- "',,', ','))" +- ", qos=if (qos=',', '', qos)" +- ", delta_qos=if (qos='', " +- "replace(concat(replace(" +- "replace(" +- "delta_qos, ',+%s,', ','), " +- "',-%s,', ','), " +- "',%s,'), ',,', ','), '')", ++ ", qos = CASE WHEN qos='' THEN qos='' WHEN qos=',' THEN qos='' ELSE " ++ "REGEXP_REPLACE(" ++ "REGEXP_REPLACE(qos::text, ',%s,'::text, ','::text, 'g'::text)::text, " ++ "',,'::text, ','::text, 'g'::text) END" ++ ", delta_qos = CASE WHEN qos='' THEN " ++ "REGEXP_REPLACE(concat(REGEXP_REPLACE(" ++ "REGEXP_REPLACE(" ++ "delta_qos::text, ',+%s,'::text, ','::text, 'g'::text)::text, " ++ "',-%s,'::text, ','::text, 'g'::text)::text, " ++ "',%s,'::text)::text, ',,'::text, ','::text, 'g'::text) ELSE '' END", + new_qos+1, new_qos+1, + new_qos+1, new_qos); + } else if (new_qos[0] == '+') { + xstrfmtcat(vals, +- ", qos=if (qos='', '', " +- "replace(concat(" +- "replace(qos, ',%s,', ','), " +- "',%s,'), ',,', ',')), " +- "delta_qos=if (" +- "qos='', replace(concat(" +- "replace(replace(" +- "delta_qos, ',+%s,', ','), " +- "',-%s,', ','), " +- "',%s,'), ',,', ','), '')", ++ ", qos = CASE WHEN qos='' THEN '' ELSE " ++ "REGEXP_REPLACE(" ++ "concat(" ++ "REGEXP_REPLACE(qos::text, ',%s,'::text, ','::text, 'g'::text)::text, " ++ "',%s,'::text)::text, ',,'::text, ','::text, 'g'::text) END, " ++ "delta_qos = CASE WHEN qos='' THEN " ++ "REGEXP_REPLACE(" ++ "concat(" ++ "REGEXP_REPLACE(" ++ "REGEXP_REPLACE(delta_qos::text, ',+%s,'::text, ','::text, 'g'::text)::text, " ++ "',-%s,'::text, ','::text, 'g'::text)::text, " ++ "',%s,'::text)::text, ',,'::text, ','::text, 'g'::text) ELSE '' END", + new_qos+1, new_qos+1, + new_qos+1, new_qos+1, + new_qos); +@@ -2652,7 +2653,7 @@ extern int as_pgsql_add_assocs(pgsql_conn_t *pgsql_conn, uint32_t uid, + if (object->id) { + xstrcat(cols, ", id_assoc"); + xstrfmtcat(vals, ", '%u'", object->id); +- xstrfmtcat(update, " AND id_assoc='%u'", object->id); ++ //xstrfmtcat(update, " AND id_assoc='%u'", object->id); + xstrfmtcat(extra, ", id_assoc='%u'", object->id); + } + +@@ -3671,8 +3672,11 @@ extern int as_pgsql_reset_lft_rgt(pgsql_conn_t *pgsql_conn, uid_t uid, + "(creation_time, mod_time, acct, lft, rgt) " + "values (%ld, %ld, 'root', 1, 2) " + "on conflict(id_assoc) do update set deleted=0, " +- "id_assoc=currval(pg_get_serial_sequence('%s_%s', 'id_assoc')), mod_time=%ld;", +- tmp_cluster_name, assoc_table, now, now, tmp_cluster_name, assoc_table, now); ++// "id_assoc=currval(pg_get_serial_sequence('%s_%s', 'id_assoc')), " ++ "mod_time=%ld;", ++ tmp_cluster_name, assoc_table, now, now, ++// tmp_cluster_name, assoc_table, ++ now); + + + DB_DEBUG(DB_ASSOC, pgsql_conn->conn, "query\n%s", query); +@@ -3699,9 +3703,8 @@ extern int as_pgsql_reset_lft_rgt(pgsql_conn_t *pgsql_conn, uid_t uid, + info("Resetting cluster with correct lft and rgt's"); + /* Update the normal table with the correct lft and rgts */ + query = xstrdup_printf( +- "update \"%s_%s\" t1 left outer join \"%s_%s\" t2 on " +- "t1.id_assoc = t2.id_assoc set t1.lft = t2.lft, " +- "t1.rgt = t2.rgt, t1.mod_time = t2.mod_time;", ++ "UPDATE \"%s_%s\" AS t1 SET lft = t2.lft, rgt = t2.rgt, mod_time = t2.mod_time " ++ "FROM \"%s_%s\" AS t2 WHERE t1.id_assoc = t2.id_assoc;", + cluster_name, assoc_table, + tmp_cluster_name, assoc_table); + +-- +2.33.0 + diff --git a/slurm.spec b/slurm.spec index e8978bfe9a54a8e0c798e2803be7f29b96d53451..ce207bff7860ba365d892c12828c9f9c49b2c47b 100644 --- a/slurm.spec +++ b/slurm.spec @@ -1,6 +1,6 @@ Name: slurm Version: 21.08.8 -%define rel 40 +%define rel 41 Release: %{rel}%{?dist} Summary: Slurm Workload Manager @@ -53,6 +53,7 @@ Patch34: 0034-Replace-the-REPLACE-function-with-the-REGEXP_REPLACE.patch Patch35: 0035-fix-the-sql-error-in-adding-resource.patch Patch36: 0036-fix-the-DefaultWCKey-not-working.patch Patch37: 0037-fix-adding-tres-resource-failure.patch +Patch38: 0038-fix-querying-the-user-binding-qos.patch # build options .rpmmacros options change to default action # ==================== ==================== ======================== @@ -745,6 +746,9 @@ rm -rf %{buildroot} %systemd_postun_with_restart slurmdbd.service %changelog +* Fri May 31 2024 Xing Liu - 21.08.8-41 +- fix querying the user binding qos + * Thu May 30 2024 Xing Liu - 21.08.8-40 - fix adding tres resource failure