I started an upgrade from Bacula 9.6.7 to Bacula 13.0.1 today and I have two 
suggestions for fixing bugs. If a patch with a merge request is preferred, I 
can do that next.

Action item 1:

There is an error on this line. There is more than one such line.

echo "Inserting File data from file.$$.data failed

That should be file1016.data (in this example), not file.$$.data - when an 
error occurs, it misleads the user.


The error I hit is:

+ cat file1017.data
+ /usr/bin/gzip -d
+ psql --set 'ON_ERROR_STOP=1' -d bacula -c $'BEGIN; TRUNCATE File; COPY File 
FROM STDIN; set maintenance_work_mem=\'2000MB\'; CREATE INDEX file_jpfid_idx on 
File (JobId, PathId, Filename text_pattern_ops); ALTER TABLE ONLY File ADD 
CONSTRAINT file_pkey PRIMARY KEY (FileId); COMMIT;'
BEGIN
TRUNCATE TABLE
ERROR:  invalid input syntax for type bigint: "SET"
CONTEXT:  COPY file, line 1, column fileid: "SET"
+ [ 1 -ne 0 ]
+ echo 'Inserting File data from file.26318.data failed.'
Inserting File data from file.26318.data failed.
+ exit 1

Looking at the file in question, I see some interesting stuff:

$ cat file1017.data | /usr/bin/gzip -d | head -20
SET
SET
SET
290658834       47767   129209  442701  next_vol.patch  0       0       Bs jlhS 
IGk B A A COQKg ro EAA I BRYSdD BLhUbc BLk9ZE A A C     fSmIlVrj9x4ETUxuH9PAIQ
290658835       50573   129209  237850  part_preface.xml.svn-base       0       
0       Bs n0Gc IEk B Pp Pp CfDWu i EAA E BRYSdQ BHf/U1 BHf/U2 A A C    
JebC91WLdIQADU0JDepbkg
290658836       44185   129209  227351  019.jpg 0       0       Bs P0IB IGk B 
Pp Pp /XtI xL1 EAA HA BRYScm BFx9n8 BFx9n8 A A C  G4caSihayh/RmpHvhl+wew
290658837       54991   129209  438580  T137.ithmb      0       0       Bs 34gB 
IHk B Pp Pp Dfgkg Cj9w EAA VA BRYSeJ BJwsMf BLUldS A A C        
CpSByTuNV1ZXrVej/29vfg
290658838       44189   129209  227351  023.jpg 0       0       Bs P0IF IGk B 
Pp Pp /X0o y9Q EAA HA BRYScm BFx9n8 BFx9n8 A A C  V0wtD4fr4t4GGYpcZNrkYA
290658839       44092   129209  227351  019--thumb.jpg  0       0       Bs P0Gk 
IGk B Pp Pp /Wl4 EAZ EAA k BRYScm BFx9n4 BFx9n4 A A C   ufFcqL3JsasSXNL8dz2OBg

I have an idea why SET SET SET occurs there.

I believe it relates to this line in the script:

psql --set ON_ERROR_STOP=1 -d ${db_name} $* -c "set work_mem='$WORKMEM';"'set 
enable_mergejoin to off ; set enable_hashjoin to off;

Action item 2:

That SET SET SET is the output of the three SET commands above.  It should be 
suppressed via an option on the psql invocation.  Sorry, I don't know that 
option off-hand.

To move onward with the upgrade, I modified the script.

I added the following to ignore the first three lines of the script.

    # we do everything in the same commit to avoid creating WALs on this 
operation
    cat file1016.data | $COMP -d | tail -n +4 | psql...

Side note: "cat filename  |"   can be replaced by "< filename"

I restarted the script after removing code related to work already done.

It succeeded.

First job failed though:

24-Nov 01:02 bacula-dir JobId 361289: Fatal error: sql_create.c:894 Fill File 
table Query failed: INSERT INTO File (FileIndex, JobId, PathId, Filename, 
LStat, MD5, DeltaSeq) SELECT batch.FileIndex, batch.JobId, Path.PathId, 
batch.Name, batch.LStat, batch.MD5, batch.DeltaSeq FROM batch JOIN Path ON 
(batch.Path = Path.Path) : ERR=ERROR:  permission denied for table file

There seem to be a few tables with incorrect permissions.

Running grant_bacula_privileges fixed that.

I hope to do a blog post with more details about the upgrade process including 
some suggestions:

* copy the scripts to the database server
* run it as the postgresql user, whatever that happens to be on the OS in 
question


Full output at 
https://gist.github.com/dlangille/d959a48b26843e97e023c9ed5389b7a2


-- 
  Dan Langille
  d...@langille.org


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

Reply via email to