]> 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, 24 Mar 2022 08:03:02 +0000 (09:03 +0100)
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 7754293f4cf5a195898c553202caba0f97f2db63..1450a85b6f84c2403ef395a0f368e846e5ad91d9 100644 (file)
@@ -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));