For the first time in as long as I can remember (possibly ever, I'm not
sure), I had a job failure last night due to a deadlock.


14-Oct 04:30 minbar-dir JobId 27066: Using Device "FileStorage" to write.
14-Oct 04:30 minbar-dir JobId 27066: Error: bdb.h:140 bdb.h:140 update
UPDATE Media SET
+VolJobs=4,VolFiles=0,VolBlocks=0,VolBytes=232,VolABytes=0,VolHoleBytes=0,VolHoles=0,VolMounts=1,VolErrors=0,VolWrites=1,MaxV
+olBytes=0,VolStatus='Append',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=55,VolType=1,VolParts=0,VolCloudParts=0,LastPartB
+ytes=0,LabelType=0,StorageId=16,PoolId=5,VolRetention=2592000,VolUseDuration=82800,MaxVolJobs=0,MaxVolFiles=0,Enabled=1,Loca
+tionId=0,ScratchPoolId=0,RecyclePoolId=1,RecycleCount=0,Recycle=0,ActionOnPurge=0,CacheRetention=0,EndBlock=0
WHERE
+VolumeName='INCR-20201014-04:30' failed:
Deadlock found when trying to get lock; try restarting transaction
14-Oct 04:30 minbar-dir JobId 27066: Fatal error: Catalog error updating
Media record. bdb.h:140 update UPDATE Media SET
+VolJobs=4,VolFiles=0,VolBlocks=0,VolBytes=232,VolABytes=0,VolHoleBytes=0,VolHoles=0,VolMounts=1,VolErrors=0,VolWrites=1,MaxV
+olBytes=0,VolStatus='Append',Slot=0,InChanger=0,VolReadTime=0,VolWriteTime=55,VolType=1,VolParts=0,VolCloudParts=0,LastPartB
+ytes=0,LabelType=0,StorageId=16,PoolId=5,VolRetention=2592000,VolUseDuration=82800,MaxVolJobs=0,MaxVolFiles=0,Enabled=1,Loca
+tionId=0,ScratchPoolId=0,RecyclePoolId=1,RecycleCount=0,Recycle=0,ActionOnPurge=0,CacheRetention=0,EndBlock=0
WHERE
+VolumeName='INCR-20201014-04:30' failed:
Deadlock found when trying to get lock; try restarting transaction
14-Oct 04:30 asgard-sd JobId 27066: Fatal error: Error getting Volume
info: 1993 Update Media error
14-Oct 04:30 asgard-sd JobId 27066: Warning: Warning cannot use Volume
"INCR-20201014-04:30", update_volume_info failed.
14-Oct 04:30 narn-fd JobId 27066: Fatal error: job.c:3012 Bad response
from SD to Append Data command. Wanted 3000 OK data
, got len=76 msg="3903 Error append data: Error getting Volume info:
1993 Update Media error  "


The DB itself is even recommending the CORRECT course of action on the
part of the application or DB driver here:

"Deadlock found when trying to get lock; try restarting transaction"

It appears that for once in a blue moon, two jobs tried to perform this
operation *exactly* simultaneously.  Really, the DB error message here
is giving the correct advice:  When you encounter a deadlock, the first
thing an application should do is back off briefly and then retry the
transaction, with updated data if appropriate.  It is a fact of life
when using SQL databases that occasionally, deadlocks happen.
Applications that use databases should be prepared to handle them.

This is NOT the database's responsibility to handle.  The database's
responsibility ends at notifying the application that a deadlock
occurred.  The database does not know, and cannot know, what the
application developer intended or what time constraints exist upon the
validity of the data in the transaction.


-- 
  Phil Stracchino
  Babylon Communications
  ph...@caerllewys.net
  p...@co.ordinate.org
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


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

Reply via email to