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.3.2~485 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a98629c7309d5147377d65e59cbc805f781cbd4;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 7754293f4..1450a85b6 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1561,20 +1561,10 @@ bool BDB::bdb_get_accurate_jobids(JCR *jcr, bstrutime(date, sizeof(date), StartTime + 1); jobids->reset(); - /* If we are coming from bconsole, we must ensure that we - * have a unique name. - */ - if (from_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(from_jobid, jobid); - } + Dmsg1(100, "from_jobid=%ld hint\n", from_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));