From f5ebdde27474369bf39998c7cd1018924e57c1dd Mon Sep 17 00:00:00 2001 From: motodiary Date: Thu, 30 May 2024 15:40:10 +0800 Subject: [PATCH] fix the DefaultWCKey not working --- 0036-fix-the-DefaultWCKey-not-working.patch | 68 +++++++++++++++++++++ slurm.spec | 6 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0036-fix-the-DefaultWCKey-not-working.patch diff --git a/0036-fix-the-DefaultWCKey-not-working.patch b/0036-fix-the-DefaultWCKey-not-working.patch new file mode 100644 index 0000000..c7b5052 --- /dev/null +++ b/0036-fix-the-DefaultWCKey-not-working.patch @@ -0,0 +1,68 @@ +From 083cb43d1961f51ccb50634444d92f528efcbfcd Mon Sep 17 00:00:00 2001 +From: motodiary +Date: Thu, 30 May 2024 15:33:22 +0800 +Subject: [PATCH] fix the DefaultWCKey not working + +--- + .../accounting_storage/pgsql/as_pgsql_wckey.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c b/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c +index 862cf70..701022f 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c +@@ -134,7 +134,7 @@ static int _make_sure_users_have_default( + + /* only look at non * and non deleted ones */ + query = xstrdup_printf( +- "SELECT DISTINCT is_def, wckey_name FROM " ++ "SELECT DISTINCT is_def, wckey_name, creation_time FROM " + "\"%s_%s\" WHERE \"user\"='%s' AND wckey_name " + "not like '*%%' AND deleted=0 ORDER BY " + "is_def desc, creation_time desc LIMIT 1;", +@@ -350,6 +350,7 @@ static int _cluster_modify_wckeys(pgsql_conn_t *pgsql_conn, + query = xstrdup_printf("SELECT t1.id_wckey, t1.wckey_name, t1.user " + "FROM \"%s_%s\" AS t1%s;", + cluster_name, wckey_table, extra); ++ DB_DEBUG(DB_WCKEY, pgsql_conn->conn, "query\n%s", query); + result = pgsql_db_query_ret(pgsql_conn, query, 0); + if (!pgsql_db_match_state(pgsql_errno(result), SUCCESSFUL_COMPLETION)) { + xfree(query); +@@ -358,10 +359,12 @@ static int _cluster_modify_wckeys(pgsql_conn_t *pgsql_conn, + } + + /* This key doesn't exist on this cluster, that is ok. */ +- if (!pgsql_num_rows(result)) ++ if (!pgsql_num_rows(result)) { + xfree(query); + pgsql_free_result(&result); ++ debug4("This key doesn't exist on this cluster, that is ok."); + return SLURM_SUCCESS; ++ } + + while ((row = pgsql_fetch_row(result))) { + slurmdb_wckey_rec_t *wckey_rec = NULL; +@@ -456,6 +459,7 @@ static int _cluster_get_wckeys(pgsql_conn_t *pgsql_conn, + xfree(query); + + if (!pgsql_num_rows(result)) { ++ debug4("%s got nothing", __func__); + pgsql_free_result(&result); + return SLURM_SUCCESS; + } +@@ -567,9 +571,9 @@ extern int as_pgsql_add_wckeys(pgsql_conn_t *pgsql_conn, uint32_t uid, + + xstrfmtcat(query, + "INSERT INTO \"%s_%s\" (%s) VALUES (%s) " +- "ON CONFLICT (id_wckey) DO UPDATE SET deleted=0, " +- "id_wckey=CURRVAL(pg_get_serial_sequence('%s_%s', 'id_wckey'))%s;", +- object->cluster, wckey_table, cols, vals, object->cluster, wckey_table, extra); ++ "ON CONFLICT (id_wckey) DO UPDATE SET deleted=0%s;", ++// "id_wckey=CURRVAL(pg_get_serial_sequence('%s_%s', 'id_wckey'))%s;", ++ object->cluster, wckey_table, cols, vals, extra); + + DB_DEBUG(DB_WCKEY, pgsql_conn->conn, "query\n%s", query); + SQLHSTMT stmt_ptr = SQL_NULL_HSTMT; +-- +2.33.0 + diff --git a/slurm.spec b/slurm.spec index d85052c..3921aba 100644 --- a/slurm.spec +++ b/slurm.spec @@ -1,6 +1,6 @@ Name: slurm Version: 21.08.8 -%define rel 38 +%define rel 39 Release: %{rel}%{?dist} Summary: Slurm Workload Manager @@ -51,6 +51,7 @@ Patch32: 0032-Correcting-archive-SQL-statements-in-tables.patch Patch33: 0033-fix-pgsql_db_insert_ret_id.patch 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 # build options .rpmmacros options change to default action # ==================== ==================== ======================== @@ -743,6 +744,9 @@ rm -rf %{buildroot} %systemd_postun_with_restart slurmdbd.service %changelog +* Thu May 30 2024 Xing Liu - 21.08.8-39 +- fix the DefaultWCKey not working + * Thu May 30 2024 Xing Liu - 21.08.8-38 - fix the sql error in adding resource -- Gitee