Re: [Bacula-users] Race condition creating volumes on two different NASes

2021-05-26 Thread Andrea Venturoli

On 5/13/21 10:35 AM, Sven Hartge wrote:

If you are compiling from source, better use the head of the Bacula-9.6 
branch from GIT instead of the published sources, as they miss some 
patches.


I'm compiling through FreeBSD's port infrastrucure, so I just picked up 
this patch.

So far (a couple of weeks) I've not seen this problem again... seems solved.
Thanks a lot.

 bye
av.


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


Re: [Bacula-users] Race condition creating volumes on two different NASes

2021-05-14 Thread Eric Bollengier via Bacula-users
Hello Andrea,

I would recommend to use the latest git version of Branch-9.6 or to switch
to 11.0 where the SQL issue has been fixed. (The PostgreSQL backend doesn't
report such error as well).

Best Regards,
Eric



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


Re: [Bacula-users] Race condition creating volumes on two different NASes

2021-05-13 Thread Sven Hartge

On 13.05.21 08:36, Andrea Venturoli wrote:

12-May 22:45 jack-dir JobId 8096: Error: 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 
('Inc4403','File',0,4,53687091200,0,1,7776000,0,1,0,'Append',0,0,0,0,0,0,0,0,'0',0,0,0,3,0,0,0,0,1,1,0) 
failed. ERR=ERROR:  duplicate key value violates unique constraint 
"media_volumename_id"

DETAIL:  Key (volumename)=(Inc4403) already exists.


In the end this seems to be only annoying, as jobs with "warnings" must 
be better checked.

Or am I missing something?


If you are compiling from source, better use the head of the Bacula-9.6 
branch from GIT instead of the published sources, as they miss some patches.


For your case in particular, you need to add this patch:

--- a/src/dird/dird.c   2021-01-19 15:25:16.233573546 -0500
+++ b/src/dird/dird.c   2021-01-19 15:26:23.884070798 -0500
@@ -1263,11 +1263,11 @@
  }
  if (catalog->db_driver) {
/* To copy dbdriver field into "CAT" catalog resource class 
(local)

 * from dbdriver in "BDB" catalog DB Interface class (global)
 */
-bstrncpy(catalog->db_driver, BDB_db_driver, db_driver_len);
+bstrncpy(catalog->db_driver, BDB_db_driver, db_driver_len+1);
  }
   }

   if (!db || !db_open_database(NULL, db)) {
  Pmsg2(000, _("Could not open Catalog \"%s\", database 
\"%s\".\n"),



Grüße,
Sven.


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


[Bacula-users] Race condition creating volumes on two different NASes

2021-05-13 Thread Andrea Venturoli

Hello.

On an installation of mine, where I run Bacula 9.6.7, I often see the 
following at the start of a job:



12-May 22:45 jack-dir JobId 8096: Error: 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
 
('Inc4403','File',0,4,53687091200,0,1,7776000,0,1,0,'Append',0,0,0,0,0,0,0,0,'0',0,0,0,3,0,0,0,0,1,1,0)
 failed. ERR=ERROR:  duplicate key value violates unique constraint 
"media_volumename_id"
DETAIL:  Key (volumename)=(Inc4403) already exists.


What I think is happening is:
_ two job start at the same time, each targetting a different NAS as 
storage;

_ a race arises where both try to use the same volume name.



I think I'm seeing two different variations:

A) In one case:
_ job one succeeds and goes on;
_ job two emits this warning, then emits another one:

2-May 09:30 BackupNASB JobId 8087: Warning: mount.c:215 Open of File device "BackupNASB" 
(/share/MD0_DATA/bacula/Backup) Volume "Inc4403" failed: ERR=file_dev.c:190 Could not 
open(/share/MD0_DATA/bacula/Backup/Inc4394,OPEN_READ_WRITE,0640): ERR=No such file or directory

_ it marks the volume as "Error" in the catalog;
_ then goes on to with the next volume (Inc4404) and ends with "Ok -- 
with warnings";
_ the volume in the catalog is then changed to "Used" by job one, which 
terminates as "Ok".


B) In another case:
_ job one emits the first warning (but not the second one) then goes on 
on that same volume (Inc4403); outcome is "Ok -- with warnings";
_ job two logs the creation of Inc4403 and Inc4404, then uses the second 
one; outcome is "Ok".




In the end this seems to be only annoying, as jobs with "warnings" must 
be better checked.

Or am I missing something?



 bye & Thanks
av.

P.S.
Incidentally, this installation often fails to reuse old volumes, which 
I'm forced to delete manually when space fills up: this might be related 
to the above or not (I'll eventually start a different thread on this 
after the above is solved, if it persists).



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