From: Martin Simmons Date: Wed, 5 Jan 2011 09:19:22 +0000 (+0100) Subject: Fix #1661 about verify differences with VERIFY_VOLUME_TO_CATALOG X-Git-Tag: Release-7.0.0~1241 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cb9553b3aa0bd83072d94452bc1598cb7398cc44;p=bacula%2Fbacula Fix #1661 about verify differences with VERIFY_VOLUME_TO_CATALOG In L_VERIFY_VOLUME_TO_CATALOG, it needs to check every FileIndex to ensure that the catalog is in the same order as the volume. That also correctly handles duplicate names, which have different values for FileIndex. This bug was introduced when fixing #1524 --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index e4ebfbaca4..d3d21a2de0 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -105,7 +105,7 @@ int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, * use includes the directory twice. In this case, Verify * VolumeToCatalog fails because we have two copies in the catalog, * and only the first one is marked (twice). So, when calling from Verify, - * jr is not NULL and we know jr->FileIndex is the fileindex + * VolumeToCatalog jr is not NULL and we know jr->FileIndex is the fileindex * of the version of the directory/file we actually want and do * a more explicit SQL search. */ @@ -125,6 +125,14 @@ int db_get_file_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr, FILE_DBR *fdbr) edit_int64(fdbr->PathId, ed1), edit_int64(fdbr->FilenameId, ed2), edit_int64(jr->ClientId,ed3)); + } else if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG) { + Mmsg(mdb->cmd, + "SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND " + "File.FilenameId=%s AND File.FileIndex=%u", + edit_int64(fdbr->JobId, ed1), + edit_int64(fdbr->PathId, ed2), + edit_int64(fdbr->FilenameId,ed3), + jr->FileIndex); } else { Mmsg(mdb->cmd, "SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND "