On Mon, Sep 05, 2022 at 11:57:43AM -0500, dmitri maziuk wrote:

> Right, I saw the starting '\x' and looked no further. OP will have to figure
> out what encoding that POS is actually dumping into -- keeping in mind that
> it may be the OS messing it up when saving to text file -- and then figure
> out the right spell to un$#@! it.
> 

Hello Dima et al., 

I don't think pgloader uses any files as intermediate storage but will
connect both to mysql / mariadb and transfer the data between them
(but that's just guessing).

I also tried the other method recommended in this thread, using only
the INSERT statements that mysqldump creates (minus the JobStatus
table which is created & filled by bacula's script) on a postgres
database created by the bacula-provided scripts.

I've gotten as far as successfully importing the resulting mysql dump
file into postgres, the volumenames look ok (no hex strings this time)
but as soon as I start a backup job, bacula complains about not being
able to find an appendable volume.

When I try to label a new volume (again, for testing purposes) I get a
"duplicate key" error from postgres as bacula tries to insert the data
into the media table:

$ echo "drop database bacula;"  | psql
$ ./create_postgresql_database
$ ./make_postgresql_tables
$ ./grant_postgresql_privileges

... snip snip ....

GRANT
GRANT
GRANT
GRANT
Privileges for user bacula granted on database bacula.

Then I create the dump, mangling it in a way so that postgres imports
it without errors (I don't care about the mangled \' filenames for now
that are in the File table):

$ (mysqldump -u bacula -pXXXXXXXXXXXX -nc --compatible=postgresql 
--default-character-set=latin1 bacula  | grep INSERT | grep -v JobStatus | sed 
's/"//ig'  | sed "s/\\\'//ig") | psql bacula 

... snip snip ....

INSERT 0 14026
INSERT 0 14000
INSERT 0 13746
INSERT 0 13778
INSERT 0 13073
INSERT 0 13817
INSERT 0 6915
INSERT 0 6
INSERT 0 3
INSERT 0 1

$


I can then start up bacula-postgres with the resulting catalog just fine: 

# /server/bacula/etc/bacula stop ; /server/bacula-13.0.1_postgres/etc/bacula 
start 

a "stat dir" looks good w/r to volume names: 

# echo stat dir | bconsole
1000 OK: 10002 zif-dir Version: 13.0.1 (05 August 2022)
Enter a period to cancel a command.
stat dir

Scheduled Jobs:
Level          Type     Pri  Scheduled          Job Name           Volume
===================================================================================
Incremental    Backup    10  08-Sep-22 10:45    zif                zif-incr-0024
====


Starting a job I receive the "no appendable volumes found" message,
then trying to a label a new volume (for testing purposes) I get this
message:

*label volume="testvolume" pool=Online_zif_incr storage=FileStorage_zif_incr
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
Sending label command for Volume "testvolume" Slot 0 ...
3000 OK label. VolBytes=231 VolABytes=0 VolType=1 Volume="testvolume" 
Device="FileStorage_zif_incr" (/backup/online_backup_zif/)
sql_create.c:483 Create DB Media record INSERT INTO Media 
(VolumeName,MediaType,MediaTypeId,PoolId,MaxVolBytes,VolCapacityBytes,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime,VolType,VolParts,VolCloudParts,LastPartBytes,EndFile,EndBlock,LabelType,StorageId,DeviceId,LocationId,ScratchPoolId,RecyclePoolId,Enabled,ActionOnPurge,CacheRetention)VALUES
 
('testvolume','File_zif',0,5,0,0,1,3456000,0,1,0,'Append',0,231,0,0,0,1,0,0,'0',0,0,0,2,0,0,0,0,1,1,0)
 failed. ERR=ERROR:  duplicate key value violates unique constraint "media_pkey"
DETAIL:  Key (mediaid)=(1) already exists.

Sorry for the longish post & lines, I just wanted to ensure I include
all the info.


All the best, 

Uwe 










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

Reply via email to