diff --git a/src/plugins/accounting_storage/mysql/as_mysql_federation.c b/src/plugins/accounting_storage/mysql/as_mysql_federation.c index 3ce5f9942c19f565a679ade5ce50d72f9ba5f7c4..4f10406f0468cd7389ffba867b4b22ebef4bfabc 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_federation.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_federation.c @@ -693,12 +693,16 @@ extern List as_mysql_remove_federations(mysql_conn_t *mysql_conn, uint32_t uid, extern int as_mysql_add_feds_to_update_list(mysql_conn_t *mysql_conn) { - int rc = SLURM_SUCCESS; + int rc = SLURM_ERROR; List feds = as_mysql_get_federations(mysql_conn, 0, NULL); - if (feds && list_count(feds)) { - if ((rc = addto_update_list(mysql_conn->update_list, - SLURMDB_UPDATE_FEDS, feds)) - != SLURM_SUCCESS) + + /* Even if there are no feds, need to send an empty list for the case + * that all feds were removed. The controller needs to know that it was + * removed from a federation. */ + if (feds && + ((rc = addto_update_list(mysql_conn->update_list, + SLURMDB_UPDATE_FEDS, feds)) + != SLURM_SUCCESS)) { FREE_NULL_LIST(feds); } return rc;