Alright, here's the details I promised:

openSUSE Leap 42.3
mysql-community-server 5.6.40-36.1
Bacula 9.0.8-1.1 from extra repo obs://build.opensuse.org/home:cristyde

The error:

Sending relabel command from "Oktober-2" to "Nessy" ...
3000 OK label. VolBytes=64512 VolABytes=0 VolType=0 Volume="Nessy"
Device="LTO-2" (/dev/nst0)
sql_create.c:439 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
('Nessy','LTO-2',0,5,53687091200,0,1,31536000,0,0,0,'Append',0,64512,0,0,0,0,0,0,'0',0,0,0,4,0,0,0,0,1,0,0)
failed. ERR=Field 'FirstWritten' doesn't have a default value
Label command failed for Volume Nessy.

Minimal fix:

mysql> 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,FirstWritten,LastWritten,LabelDate,InitialWrite)VALUES
('Nessy','LTO-2',0,5,53687091200,0,1,31536000,0,0,0,'Append',0,64512,0,0,0,0,0,0,'0',0,0,0,4,0,0,0,0,1,0,0,'2018-06-27','2018-06-27','2018-06-27','2018-06-27')
;
Query OK, 1 row affected (0,03 sec)

mysql> delete from Media where VolumeName = 'Oktober-2';
Query OK, 1 row affected (0,00 sec)

Of course the "delete" part isn't necessary if I label a new volume
instead of relabelling an existing one, otherwise it's the same.

So, sorry to contradict you, Kern, but Bacula actually does *not* work
perfectly well with an "out of the box" installation of MySQL on
openSUSE Leap 42.3 or later.

Am 02.08.2018 um 16:39 schrieb Tilman Schmidt:
> Just a quick note to help narrowing this down:
> * I'm experiencing this "Field 'StartTime' doesn't have a default value" 
> error on an openSUSE installation ever since it was upgraded to Leap 42.3 and 
> Bacula 9.
> * The machine in question runs MySQL, not MariaDB, even though openSUSE has 
> deprecated MySQL.
> * Getting MySQL to run caused a lot of pain, mostly related to systemd.
> * Your on your own with that. openSUSE answers all requests on that topic 
> with: "We don't support MySQL - use MariaDB."
> * Luckily on that machine the "no default value" error only strikes when I 
> try to label a new volume.
> * The few times this has occurred I fixed it by performing the failed 
> database INSERT manually and adding explicit values for all the DATETIME 
> fields.
> 
> All from memory. I'll gladly post details next time I get to the affected 
> machine.
> 
> HTH
> Tilman
> 
> On Thu, Aug 2, 2018, at 15:18, Kern Sibbald wrote:
>> Hello,
>>
>> Maybe you can get some help from the list or from bacula-devel.  At this 
>> time, I am not yet equipped or ready to start trying to support 
>> MariaDB.  It will happen sometime, but not just now.  One of the big 
>> problems for me is that it seems it is impossible (at least on Ubuntu) 
>> to have both installed on the same machine -- at least not out of the 
>> box, and trying to switch from one to the other is a veritable 
>> nightmare, because each package leaves little traces that confuse the other.
>>
>> Best regards,
>> Kern
>>
>> On 08/01/2018 05:11 PM, George Anchev wrote:
>>> On Wed, 1 Aug 2018 12:59:43 +0200 Kern Sibbald
>>> wrote:
>>>
>>>> Please note that we do not officially support
>>>> MariaDB -- one prior version has some serious
>>>> problems falsely detecting deadlocks. Bacula works
>>>> perfectly well with all "out of the box"
>>>> installations of MySQL.
>>>>
>>>> Concerning the error message you are getting, either
>>>> this is a MariaDB problem or you are not running
>>>> MySQL out of the box
>>> I have MariaDB installed from the official openSUSE
>>> Leap 15.0 repository. I suppose that qualifies as "out
>>> of the box" MariaDB (but not MySQL?) installation? I
>>> really don't know much about the differences between
>>> the two.
>>>
>>>> and you have applied some stricter SQL requirements
>>>> which require default values for DATETIME fields.
>>> Personally I have not done anything at all. As
>>> mentioned I simply have what comes with openSUSE. I am
>>> not a DB expert at all. So far I have been using
>>> Bacula 7.4.2 with MariaDB for years with zero issues.
>>> But the problems began after updating Leap 42.3 to Leap
>>> 15.0.
>>>
>>>> Either remove those requirements (I forget exactly
>>>> what they are but they have been reported numerous
>>>> times on this list), or you must explicitly define
>>>> default values for those fields.  Note if you do
>>>> define default values, you *must* ensure that the
>>>> default value is stored as a zero in the database
>>>> (probably 1 Jan 1970).  This value of 0 is used by
>>>> Bacula in certain cases for Volume table
>>>> references.  If the value does not default to 0
>>>> Bacula will fail in some places.
>>> How do I do all this please? Can you please provide
>>> steps as for a layman which ensure that Bacula will
>>> work correctly (without failing anywhere)?
>>>
>>> -OR- (if above is not possible/recommended)
>>>
>>> Can you provide steps to safely migrate everything to
>>> PosgreSQL (preserving current data)?
>>>
>>> --
>>> George
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Bacula-users mailing list
>> Bacula-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
> 
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to