Re: Runscript Unknown term code Re: Bacula 15.0.2 update

Phil Stracchino <[email protected]> Mon, 13 May 2024 21:24:47 -0400
Newsgroups gmane.comp.sysutils.backup.bacula.devel
Organization Fenian House Publishing
Message-ID <[email protected]>
Fixed now.

This is the CORRECTED patch to bvfs.c to make .bvfs_update stay under 
the 128K-row transaction limit for Galera 3.



--- bacula-15.0.2/src/cats/bvfs.c.orig	2024-03-22 05:48:41.000000000 -0400
+++ bacula-15.0.2/src/cats/bvfs.c	2024-05-13 18:44:03.553492388 -0400
@@ -723,10 +723,11 @@
  }

  void bvfs_update_cache(JCR *jcr, BDB *mdb)
  {
     uint32_t nb=0;
+   int dc = 0;
     db_list_ctx jobids_list;

     mdb->bdb_lock();

  #ifdef xxx
@@ -776,17 +777,22 @@

     mdb->bdb_sql_query(mdb->cmd, db_list_handler, &jobids_list);

     bvfs_update_path_hierarchy_cache(jcr, mdb, jobids_list.list);

-   mdb->bdb_start_transaction(jcr);
-   Dmsg0(dbglevel, "Cleaning pathvisibility\n");
-   Mmsg(mdb->cmd,
-        "DELETE FROM PathVisibility "
-         "WHERE NOT EXISTS "
-        "(SELECT 1 FROM Job WHERE JobId=PathVisibility.JobId)");
-   nb = mdb->DeleteDB(jcr, mdb->cmd);
+   do {
+        mdb->bdb_start_transaction(jcr);
+        Dmsg0(dbglevel, "Cleaning pathvisibility\n");
+        Mmsg(mdb->cmd,
+            "DELETE FROM PathVisibility "
+            "WHERE NOT EXISTS "
+            "(SELECT 1 FROM Job WHERE JobId=PathVisibility.JobId) LIMIT 
100000");
+        dc = mdb->DeleteDB(jcr, mdb->cmd);
+        nb += dc;
+    }
+   while (dc == 100000);
+
     Dmsg1(dbglevel, "Affected row(s) = %d\n", nb);

     mdb->bdb_end_transaction(jcr);
     mdb->bdb_unlock();
  }




-- 
   Phil Stracchino
   Fenian House Publishing
   [email protected]
   [email protected]
   Landline: +1.603.293.8485
   Mobile:   +1.603.998.6958