From: Eric Bollengier Date: Thu, 25 Sep 2008 18:07:08 +0000 (+0000) Subject: ebl First fix for the mysql bug in accurate code. X-Git-Tag: Release-7.0.0~4089 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=528c9e736ebced472302089331183a57c5120fdf;p=bacula%2Fbacula ebl First fix for the mysql bug in accurate code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7643 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index d778dac73f..30f25f5c35 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1062,7 +1062,8 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, return db_sql_query(mdb, buf.c_str(), result_handler, ctx); } -/* Full : do nothing +/* The decision do change an incr/diff was done before + * Full : do nothing * Differential : get the last full id * Incremental : get the last full + last diff + last incr(s) ids * @@ -1071,6 +1072,7 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *jobids) { + bool ret=false; char clientid[50], jobid[50], filesetid[50]; char date[MAX_TIME_LENGTH]; POOL_MEM query(PM_FNAME); @@ -1079,7 +1081,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, /* First, find the last good Full backup for this job/client/fileset */ Mmsg(query, -"CREATE TEMPORARY TABLE btemp3%s AS " +"CREATE TABLE btemp3%s AS " "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles " "FROM Job JOIN FileSet USING (FileSetId) " "WHERE ClientId = %s " @@ -1093,7 +1095,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, edit_uint64(jr->FileSetId, filesetid)); if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { - return false; + goto bail_out; } if (jr->JobLevel == L_INCREMENTAL || jr->JobLevel == L_VIRTUAL_FULL) { @@ -1112,7 +1114,9 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, jobid, filesetid); - db_sql_query(mdb, query.c_str(), NULL, NULL); + if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { + goto bail_out; + } /* We just have to take all incremental after the last Full/Diff */ Mmsg(query, @@ -1128,18 +1132,22 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, clientid, jobid, filesetid); - db_sql_query(mdb, query.c_str(), NULL, NULL); + if (!db_sql_query(mdb, query.c_str(), NULL, NULL)) { + goto bail_out; + } } /* build a jobid list ie: 1,2,3,4 */ Mmsg(query, "SELECT JobId FROM btemp3%s", jobid); db_sql_query(mdb, query.c_str(), db_get_int_handler, jobids); Dmsg1(1, "db_accurate_get_jobids=%s\n", jobids); + ret = true; +bail_out: Mmsg(query, "DROP TABLE btemp3%s", jobid); db_sql_query(mdb, query.c_str(), NULL, NULL); - return true; + return ret; } /* diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index d051c7b8f0..88d35c37e0 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -19,6 +19,7 @@ remove reader/writer in FOPTS???? General: 25Sep08 +ebl Fix the mysql bug in the new accurate code kes Improve plugin debug. Create plugin test. kes Set main thread specific data to INVALID because it has no jcr. This allows debug output to work correctly.