]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix db_get_accurate_jobids() with concurrent queries on the same jobs
authorEric Bollengier <eric@baculasystems.com>
Wed, 16 Jun 2021 15:49:09 +0000 (17:49 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 17 Jun 2021 07:13:18 +0000 (09:13 +0200)
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.

bacula/src/cats/sql_get.c

index a080df9cbeedc5d2c84a346227053a2f82c87064..2c252e588870a02320e0ff620a4c7fcc481ecb97 100644 (file)
@@ -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));