From: Eric Bollengier Date: Wed, 16 Jun 2021 15:49:09 +0000 (+0200) Subject: Fix db_get_accurate_jobids() with concurrent queries on the same jobs X-Git-Tag: Release-11.0.6~139 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a7db8d274d87cd9f60033422558f23d20f9421a;p=thirdparty%2Fbacula.git Fix db_get_accurate_jobids() with concurrent queries on the same jobs The btemp3 table name is computed with the from_jobid argument in the .bvfs_get_jobid command. If we have multiple requests at the same time, as the tables are not TEMPORARY (due to a MySQL issue), one query can drop the table of the other one and lead to problems. Waiting to have the from_jobid feature fully implemented, the code is removed. --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index a080df9cb..2c252e588 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1472,17 +1472,9 @@ bool BDB::bdb_get_accurate_jobids(JCR *jcr, /* If we are comming from bconsole, we must ensure that we * have a unique name. */ - if (jcr->JobId == 0) { - P(btemp_mutex); - bsnprintf(jobid, sizeof(jobid), "0%u", btemp_cur++); - V(btemp_mutex); - } else { - /* TODO: Here we have a hint on the JobId to return - * depdending on the Job level of the hint, we must - * adapt one of the queries (F, D, I) and add a JobId=x - */ - edit_uint64(jcr->JobId, jobid); - } + P(btemp_mutex); + bsnprintf(jobid, sizeof(jobid), "0%u", btemp_cur++); + V(btemp_mutex); if (jr->Name[0] != 0) { bdb_escape_string(jcr, esc, jr->Name, strlen(jr->Name));