On 03/20/2013 16:50, dweimer wrote: > OK, so I thought, hey why not setup an automated scheduled task to > delete the orphaned file and path entries, seemed like a good idea at > first. I have a fairly short retention period set, and as a result > generates about 300,000 orphaned file name records and about 75,000 > orphaned path entries a week. Which of course causes the database to > continually grow, and become slower over time. > > So I configured it to run a dbcheck before job, and follow that with a > database vacuum after job. > > Job { > Name = DBCheck > Client = webmail.dweimer.local-fd > Type = Admin > FileSet = Webmail > Schedule = AdminSchedule > Priority = 2000 > Messages = Standard > Pool = File > RunBeforeJob = "/usr/local/sbin/dbcheck -b -f -c > /usr/local/etc/bacula-dir.conf" > RunAfterJob = "/usr/local/bin/vacuumdb -d bacula" > } > > Manually started my job to test (not much found here I had just ran it > form command line prior to this test), starts out looking good, but dies > because it deletes the admin job entry for itself and then can no longer > update the database. > > 20-Mar 10:03 webmail.dweimer.local-dir JobId 484: shell command: run > BeforeJob "/usr/local/sbin/dbcheck -b -f -c > /usr/local/etc/bacula-dir.conf" > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for Paths without a trailing slash > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > bad Path records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for Filenames with a trailing slash > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > bad Filename records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for duplicate Filename entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > duplicate Filename records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for duplicate Path entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > duplicate Path records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned JobMedia entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned File entries. This may take some time! > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned Path entries. This may take some time! > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned Filename entries. This may take some time! > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 51 > orphaned Filename records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Deleting > 51 orphaned Filename records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned FileSet entries. This takes some time! > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > orphaned FileSet records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned Client entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 1 > orphaned Client records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Deleting 1 > orphaned Client records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for orphaned Job entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > orphaned Job records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for Admin Job entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 2 > Admin Job records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Deleting 2 > Admin Job records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Checking > for Restore Job entries. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: BeforeJob: Found 0 > Restore Job records. > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: Fatal error: > sql_update.c:123 Update failed: affected_rows=0 for UPDATE Job SET > JobStatus='R',Level=' ',StartTime='2013-03-20 > 10:09:10',ClientId=5,JobTDate=1363792150,PoolId=0,FileSetId=0 WHERE > JobId=484 > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: Warning: Error > updating job record. sql_update.c:202 Update failed: affected_rows=0 for > UPDATE Job SET JobStatus='f',EndTime='2013-03-20 > 10:09:10',ClientId=5,JobBytes=0,ReadBytes=0,JobFiles=0,JobErrors=1,VolSessionId=0,VolSessionTime=0,PoolId=0,FileSetId=0,JobTDate=1363792150,RealEndTime='2013-03-20 > 10:09:10',PriorJobId=0,HasBase=0,PurgedFiles=0 WHERE JobId=484 > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: Warning: Error > getting Job record for Job report: ERR=sql_get.c:318 No Job found for > JobId 484 > 20-Mar 10:09 webmail.dweimer.local-dir JobId 484: Error: Bacula 5.2.12 > (12Sep12): 20-Mar-2013 10:09:10 > JobId: 484 > Job: DBCheck.2013-03-20_10.03.22_26 > Scheduled time: 20-Mar-2013 10:03:22 > Start time: 20-Mar-2013 10:09:10 > End time: 20-Mar-2013 10:09:10 > Termination: *** Admin Error *** > > Is there anyway to tell this batch job to just run the orphaned checks, > or at least to not run the admin job purge? So that it will complete? > Or should I just use a scheduled cron job on the server instead of > running it through an admin job within Bacula? >
I think that dbcheck should only be used if Bacula has crashed (bug, power cut, etc) -- No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced. ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users