diff --git a/0049-fix-the-preempt-error.patch b/0049-fix-the-preempt-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..669706ec11e9998ecd4a194b084d4553a3aaf93a --- /dev/null +++ b/0049-fix-the-preempt-error.patch @@ -0,0 +1,146 @@ +From 563e6bc7db394629c020e1ec6e6def1a4983f122 Mon Sep 17 00:00:00 2001 +From: motodiary +Date: Fri, 14 Jun 2024 09:26:04 +0800 +Subject: [PATCH] fix the preempt error + +--- + src/database/pgsql_common.c | 29 ++++++++++++------- + .../accounting_storage/pgsql/as_pgsql_assoc.c | 10 ++----- + .../accounting_storage/pgsql/as_pgsql_qos.c | 2 +- + .../pgsql/as_pgsql_resource.c | 2 +- + .../accounting_storage/pgsql/as_pgsql_tres.c | 2 +- + .../accounting_storage/pgsql/as_pgsql_wckey.c | 2 +- + 6 files changed, 26 insertions(+), 21 deletions(-) + +diff --git a/src/database/pgsql_common.c b/src/database/pgsql_common.c +index ce574f1..d280d08 100755 +--- a/src/database/pgsql_common.c ++++ b/src/database/pgsql_common.c +@@ -1614,17 +1614,26 @@ extern char* pgsql_errno(pgsql_res_t* result) + extern uint64_t pgsql_insert_id(SQLHSTMT stmt) + { + xassert(stmt); +- SQLINTEGER last_id = 0; ++ uint64_t last_id = 0; ++ char* col_data = NULL; ++ SQLRETURN rc = 0; + +- SQLRETURN rc = 0; +- SQLINTEGER len; +- rc = SQLGetStmtAttr(stmt, SQL_DESC_AUTO_UNIQUE_VALUE, &last_id, sizeof(last_id), &len); +- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { +- SQLCHAR state[PGSQL_STATE_LEN + 1]; +- PGSQL_HANDLE_ERROR("SQLGetStmtAttr", rc, SQL_HANDLE_STMT, stmt, state); +- last_id = 0; ++ if(stmt == NULL){ ++ return 0; ++ } ++ ++ if(SQLFetch(stmt) != SQL_NO_DATA){ ++ PGSQL_GET_TEXT_DATA(stmt, 0, col_data, rc); ++// if (col_data == NULL) { ++// error("%s get insert id failed", __func__); ++// return 0; ++// } ++ last_id = slurm_atoull(col_data); ++ xfree(col_data); ++ return last_id; ++ } else { ++ return 0; + } +- +- return last_id; ++ + } + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c b/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c +index dd91b8e..2c38201 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_assoc.c +@@ -109,11 +109,6 @@ enum { + ASSOC_REQ_COUNT + }; + +-static char *get_parent_limits_select = +- "select @par_id, @mj, @mja, @mpt, @msj, " +- "@mwpj, @mtpj, @mtpn, @mtmpj, @mtrm, " +- "@def_qos_id, @qos, @delta_qos, @prio;"; +- + enum { + ASSOC2_REQ_PARENT_ID, + ASSOC2_REQ_MJ, +@@ -2790,7 +2785,7 @@ extern int as_pgsql_add_assocs(pgsql_conn_t *pgsql_conn, uint32_t uid, + xstrfmtcat(query, + "insert into \"%s_%s\" " + "(%s, lft, rgt, deleted) " +- "values (%s, %d, %d, 2);", ++ "values (%s, %d, %d, 2) RETURNING id_assoc;", + object->cluster, assoc_table, cols, + vals, my_left+(incr-1), my_left+incr); + +@@ -2882,8 +2877,9 @@ extern int as_pgsql_add_assocs(pgsql_conn_t *pgsql_conn, uint32_t uid, + if (!assoc_id) { + // (void) last_affected_rows(pgsql_conn); + // assoc_id = mysql_insert_id(pgsql_conn->db_conn); +- (void) last_affected_rows(stmt); + assoc_id = pgsql_insert_id(stmt); ++ (void) last_affected_rows(stmt); ++ + //info("last id was %d", assoc_id); + } + pgsql_db_free_statement(&stmt); +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_qos.c b/src/plugins/accounting_storage/pgsql/as_pgsql_qos.c +index 0a7733d..395a21f 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_qos.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_qos.c +@@ -688,7 +688,7 @@ extern int as_pgsql_add_qos(pgsql_conn_t *pgsql_conn, uint32_t uid, + + xstrfmtcat(query, + "INSERT INTO %s (%s) VALUES (%s) " +- "ON CONFLICT (id) DO UPDATE SET deleted=0%s;", ++ "ON CONFLICT (name) DO UPDATE SET deleted=0%s RETURNING id;", + qos_table, cols, vals, extra); + + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_resource.c b/src/plugins/accounting_storage/pgsql/as_pgsql_resource.c +index 5d5e5f9..dda70e6 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_resource.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_resource.c +@@ -442,7 +442,7 @@ static int _add_res(pgsql_conn_t *pgsql_conn, slurmdb_res_rec_t *object, + + xstrfmtcat(query, + "INSERT INTO %s (%s) VALUES (%s) " +- "ON CONFLICT (id) DO UPDATE SET deleted=0%s;", ++ "ON CONFLICT (name, server, type) DO UPDATE SET deleted=0%s RETURNING id;", + // "id=CURRVAL(pg_get_serial_sequence('%s', 'id'))%s;", + res_table, cols, vals, extra); + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_tres.c b/src/plugins/accounting_storage/pgsql/as_pgsql_tres.c +index 3f3e739..794d3a1 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_tres.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_tres.c +@@ -95,7 +95,7 @@ extern int as_pgsql_add_tres(pgsql_conn_t *pgsql_conn, + + xstrfmtcat(query, + "insert into %s (%s) values (%s) " +- "on conflict (type,name) do update set deleted=0;", ++ "on conflict (type,name) do update set deleted=0 RETURNING id;", + // "id=currval(pg_get_serial_sequence('%s', 'id'));", + tres_table, cols, vals); + +diff --git a/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c b/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c +index 701022f..dc32252 100755 +--- a/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c ++++ b/src/plugins/accounting_storage/pgsql/as_pgsql_wckey.c +@@ -571,7 +571,7 @@ 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%s;", ++ "ON CONFLICT (wckey_name, \"user\") DO UPDATE SET deleted=0%s RETURNING id_wckey;", + // "id_wckey=CURRVAL(pg_get_serial_sequence('%s_%s', 'id_wckey'))%s;", + object->cluster, wckey_table, cols, vals, extra); + +-- +2.33.0 + diff --git a/slurm.spec b/slurm.spec index 0ef2ae60de2adc0426e11611ce6d008ae263b9cb..4b9ebf283ff41c5aeb1578f12506355b392e2e82 100644 --- a/slurm.spec +++ b/slurm.spec @@ -1,6 +1,6 @@ Name: slurm Version: 21.08.8 -%define rel 51 +%define rel 52 Release: %{rel}%{?dist} Summary: Slurm Workload Manager @@ -64,6 +64,7 @@ Patch45: 0045-Remove-comments-in-concatenated-strings.patch Patch46: 0046-Add-empty-check-and-inline-in-set_autocommit_off.patch Patch47: 0047-rename-_get_result_by_index.patch Patch48: 0048-fix-sacct-not-showing-job-information.patch +Patch49: 0049-fix-the-preempt-error.patch # build options .rpmmacros options change to default action # ==================== ==================== ======================== @@ -756,6 +757,9 @@ rm -rf %{buildroot} %systemd_postun_with_restart slurmdbd.service %changelog +* Fri Jun 14 2024 Xing Liu - 21.08.8-52 +- fix the preempt error + * Thu Jun 13 2024 Xing Liu - 21.08.8-51 - fix sacct not showing job information