1.  I recommend the following changes to update_mysql_tables:

--- update_mysql_tables.orig    2021-05-19 12:54:15.226740443 -0400
+++ update_mysql_tables 2021-05-19 12:54:53.833949117 -0400
@@ -161,14 +161,14 @@
 ALTER TABLE RestoreObject
    MODIFY FileIndex INTEGER UNSIGNED DEFAULT 0;
 ALTER TABLE BaseFiles
    MODIFY FileIndex INTEGER UNSIGNED DEFAULT 0;

-DROP INDEX JobId on File;
-DROP INDEX JobId_2 on File;
+DROP INDEX IF EXISTS JobId on File;
+DROP INDEX IF EXISTS JobId_2 on File;

-CREATE TABLE file_temp (
+CREATE TABLE IF NOT EXISTS file_temp (
    FileId BIGINT UNSIGNED NOT NULL,
    FileIndex INTEGER DEFAULT 0,
    JobId INTEGER UNSIGNED NOT NULL,
    PathId INTEGER UNSIGNED NOT NULL,
    Filename BLOB NOT NULL,
@@ -176,10 +176,12 @@
    MarkId INTEGER UNSIGNED DEFAULT 0,
    LStat TINYBLOB NOT NULL,
    MD5 TINYBLOB
    );

+TRUNCATE TABLE file_temp;
+
 INSERT INTO file_temp (FileId, FileIndex, JobId, PathId, Filename,
DeltaSeq,
                       MarkId, LStat, Md5)
    SELECT FileId, FileIndex, JobId, PathId, Filename.Name, DeltaSeq,
          MarkId, LStat, Md5
     FROM File JOIN Filename USING (FilenameId);


These changes allow the script to be retried (after making corrections)
if it fails for any reason.


2.  If running on a Galera cluster, YOU MUST BRING THE CLUSTER DOWN TO A
SINGLE NODE before performing this migration (and preferably also
disable Galera temporarily) because the schema rewrites will almost
certainly exceed the hard limits on Galera writeset size (128K maximum
rows or 4GB total writeset size, whichever comes first).


-- 
  Phil Stracchino
  Babylon Communications
  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