On 5/13/24 14:20, Phil Stracchino wrote:
If I were to try to *fix* this compatibility issue (and it would quite
possibly perform better this way anyway), what I would do there is add a
LIMIT 100000 and then loop on it until ROW_COUNT() < 100000.  BEST
PRACTICE for Galera performance is to try to keep individual writes
below 10K rows, but an occasional 100K write isn't going to have much
impact.


Here's a patch that SHOULD accomplish that:


--- 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 14:35:08.754557022 -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,23 @@

    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);
+   dc = -1;
+   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();
 }



I'm testing this patch now.



--
  Phil Stracchino
  Fenian House Publishing
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958



_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to