Creating new medium fails in cats/sql_create.cc:489

45 views
Skip to first unread message

tilmang...@googlemail.com

unread,
Aug 15, 2020, 6:47:33 AM8/15/20
to bareos-users
Hello,

when issuing label command, it fails when inserting a new record in the database. How can a fix this permanently?

Version is bareos-19.2.6
Msql version is  Ver 5.7.31-0ubuntu0.18.04.1
Root cause: Mysql no longer accept a value of '0' for datetime fields. FirstWritten,LastWritten,LabelDate,InitialWrite are set  to 0 per default.
Workaround: I inserted the row manually into the mysql database, setting the fields to utc_timestamp.
ErrorMessage:
label storage=TapeStorage1 pool=Tgvs2-Tape volume=Tgvs2Tape-6
Enter slot (0 or Enter for none): 6
Connecting to Storage daemon TapeStorage1 at qtron.fritz.box:9103 ...
Sending label command for Volume "Tgvs2Tape-6" Slot 6 ...
stored/block.cc:300 Volume data error at 0:0! Wanted ID: "BB02", got "". Buffer discarded.
3000 OK label. VolBytes=64512 Volume="Tgvs2Tape-6" Device="TapeDrive1" (/dev/nst0)
cats/sql_create.cc:489 Create DB Media record INSERT INTO Media (VolumeName,MediaType,MediaTypeId,PoolId,MaxVolBytes,VolCapacityBytes,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime,EndFile,EndBlock,LabelType,StorageId,DeviceId,LocationId,ScratchPoolId,RecyclePoolId,Enabled,ActionOnPurge,EncryptionKey,MinBlocksize,MaxBlocksize) VALUES ('Tgvs2Tape-6','DDS-4',0,14,26843545600,0,1,2592000,0,1,0,'Append',6,64512,1,0,0,0,0,0,1,0,0,0,0,1,0,'',0,0) failed. ERR=Incorrect datetime value: '0000-00-00 00:00:00' for column 'FirstWritten' at row 1
Do not forget to mount the drive!!!

Thanks
Tilman

Andreas Rogge

unread,
Aug 20, 2020, 4:24:54 AM8/20/20
to bareos...@googlegroups.com
Hi,

the MySQL backend is deprecated and is not getting much attention
anymore. Please consider migrating to PostgreSQL. Bareos 19.2 provides a
migration tool (bareos-dbcopy) for that.

You can probably work around the issue by configuring the sql_mode for
your MySQL server so that the deprecated syntax will still work. The
offending flag is probably "NO_ZERO_DATE" which is enabled in SQL strict
mode.

Best Regards,
Andreas
--
Andreas Rogge andrea...@bareos.com
Bareos GmbH & Co. KG Phone: +49 221-630693-86
http://www.bareos.com

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer: S. Dühr, M. Außendorf, J. Steffens, Philipp Storz

signature.asc
Reply all
Reply to author
Forward
0 new messages