From c66ce9c54a3798322ac6d8d799ba3a812e6f3c11 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 23 May 2009 12:01:08 +0000 Subject: [PATCH] When doing a tree selection restore, look at the PurgedFiles column in the first JobId, and if non-zero, the Job was purged, so do not do selection git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8853 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/ua_restore.c | 21 ++++++++++++++++++++- bacula/technotes | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 36857ed387..e924dadabf 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -994,7 +994,7 @@ static bool ask_for_fileregex(UAContext *ua, RESTORE_CTX *rx) return true; /* select everything */ } ua->send_msg(_("\nThere were no files inserted into the tree, so file selection\n" - "is not possible.Most likely your retention policy pruned the files\n")); + "is not possible. Most likely your retention policy pruned the files\n")); if (get_yesno(ua, _("\nDo you want to restore all the files? (yes|no): "))) { if (ua->pint32_val == 1) return true; @@ -1084,6 +1084,25 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) } } #endif + /* + * Look at the first JobId on the list (presumably the oldest) and + * if it is marked purged, don't do the manual selection because + * the Job was pruned, so the tree is incomplete. + */ + if (tree.FileCount != 0) { + p = rx->JobIds; + if (get_next_jobid_from_list(&p, &JobId) > 0) { + /* Find out if first Job is purged */ + Mmsg(rx->query, "SELECT PurgedFiles from Job WHERE JobId=%s", edit_int64(JobId, ed1)); + if (!db_sql_query(ua->db, rx->query, restore_count_handler, (void *)rx)) { + ua->error_msg("%s\n", db_strerror(ua->db)); + } + /* rx->JobId is the PurgedFiles flag */ + if (rx->found && rx->JobId > 0) { + tree.FileCount = 0; /* set count to zero, no tree selection */ + } + } + } if (tree.FileCount == 0) { OK = ask_for_fileregex(ua, rx); if (OK) { diff --git a/bacula/technotes b/bacula/technotes index 41272f3d5c..b517b0a3ad 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -3,6 +3,9 @@ General: 23May09 +kes When doing a tree selection restore, look at the PurgedFiles column + in the first JobId, and if non-zero, the Job was purged, so do + not do selection. kes Yet another try to get qmake to install bat correctly. It looks like the trick is to have an executable bat file when qmake is run during ./configure. -- 2.39.5