From 7f3b2717d08ce3a7618c0cf0dc5bf6a5f8ddbe76 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 27 Mar 2004 10:25:21 +0000 Subject: [PATCH] Restore all/done updates git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1155 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ChangeLog | 12 ++++++ bacula/ReleaseNotes | 76 ++++++++++++++++++++++-------------- bacula/src/dird/ua.h | 1 + bacula/src/dird/ua_restore.c | 24 +++++++----- bacula/src/dird/ua_tree.c | 8 ++-- bacula/src/lib/signal.c | 2 +- 6 files changed, 80 insertions(+), 43 deletions(-) diff --git a/bacula/ChangeLog b/bacula/ChangeLog index bad993d5bf..f7f20a7c05 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,4 +1,16 @@ +27Mar04 +- Make the default for restore to have nothing marked. +- The "all" keyword on the restore command marks everything by + default. +- The "done" keyword on the restore command prevents user interaction + with the tree routines -- used mainly for scripting (regression ...). +- Correct a bug in the last_sibling code. +- Add alphabetic sorting of siblings so the "dir" and "ls" commands + during restore show files in alphabetic order. +25Mar04 +- Based on Mike Acar's suggestions rework tree insert routines. Improve + performance by using a last_sibling link for inserts. 24Mar04 - Apply corrected SQL to sql_get.c supplied by Dan Langille. - Implement "delete job jobid=xxx jobid=yyy ..." diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index f3e20fee77..a644726239 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -6,11 +6,11 @@ Major Features: - Data spooling which eliminates tape shoe-shine during Inc backups, and permits multiple simultaneous backups without interleaved blocks. -- Polling of devices eliminating need to unmount and mount from - console. - Native Win32 client -- much faster and restores permissions correctly (thanks to Christopher Hull) - PostgreSQL database driver (thanks to Dan Langille). +- Polling of devices eliminating need to unmount and mount from + console. - Improved Autochange support of Slots (update slots scan). - Autochanger support for multiple drives. - New conio code to implement Console command line editing and history. @@ -20,6 +20,47 @@ Major Features: - Daemon statistics memory. - Improved btape "test" and "fill" commands. + +Items to note: !!!!! +- The restore default is changed to have nothing selected by default. + You must either enter: "restore all" or after getting into the tree + selection prompt enter "mark *" to have everything selected. +- In previous versions the "all" keyword on the restore command caused + it to return without user interaction after selecting everything. + This function is now replaced by the "done" keyword (more logical). + The "all" keyword now causes everything to be selected by default. +- The default tape driver behavior is now to write only a single EOF + at the end of the tape. For most tape drives, this is totally + transparent and nothing needs to be done. For FreeBSD see below. +- FreeBSD users NOTE!!!!! + You MUST add the following two records to your SD Device resource for + tape drives. + + TWOEOF = yes + Fast Forward Space File = no + +- The daemon protocol has changed, you must update everything at once. +- The database level has been updated. You must either re-initialize + your databases with: + + ./drop_bacula_tables + ./make_bacula_tables + + which will delete ALL prior catalog information, or you can + update your database with: + + ./update_bacula_tables + + Please save your old database before dropping the tables or doing + an upgrade or you may regret it later. + +- smtp has now become bsmtp -- you *must* modify your .conf files. +- console has now become bconsole. +- console.conf is now bconsole.conf +- Please don't underestimate the repercussions of the bsmtp and bconsole + name changes! + + New directives: - "Close on Poll = yes/no" in SD Device resource. - "Volume Poll Interval = time-interval" in SD Device resource. @@ -57,6 +98,9 @@ New Commands: - "quit" command in restore tree. - Trace option on "setdebug trace=1/0 ..." - Update slots scan +- The "all" keyword on the restore command marks all files by default. +- The "done" keyword prevents user interaction with the tree -- used + mostly for batch scripting. Additional changes: @@ -133,31 +177,3 @@ Additional changes: a single Volume where the volume lable is not in the first tape block, so the tape is not recognized. -Items to note: !!!!! -- FreeBSD users NOTE!!!!! - You MUST add the following two records to your SD Device resource for - tape drives. - - TWOEOF = yes - Fast Forward Space File = no - -- The daemon protocol has changed, you must update everything at once. -- The database level has been updated. You must either re-initialize - your databases with: - - ./drop_bacula_tables - ./make_bacula_tables - - which will delete ALL prior catalog information, or you can - update your database with: - - ./update_bacula_tables - - Please save your old database before dropping the tables or doing - an upgrade or you may regret it later. - -- smtp has now become bsmtp -- console has now become bconsole. -- console.conf is now bconsole.conf -- Please don't underestimate the repercussions of the bsmtp and bconsole - name changes! diff --git a/bacula/src/dird/ua.h b/bacula/src/dird/ua.h index d2ded609b4..23fa60377e 100644 --- a/bacula/src/dird/ua.h +++ b/bacula/src/dird/ua.h @@ -58,6 +58,7 @@ struct TREE_CTX { TREE_NODE *node; /* current node */ TREE_NODE *avail_node; /* unused node last insert */ int cnt; /* count for user feedback */ + bool all; /* if set mark all as default */ UAContext *ua; }; diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index a79eb8b0fc..0f20e3a512 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -80,6 +80,7 @@ struct RESTORE_CTX { int fnl; /* filename length */ int pnl; /* path length */ bool found; + bool all; /* mark all as default */ NAME_LIST name_list; }; @@ -307,12 +308,13 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) "file", /* 3 */ "select", /* 4 */ "pool", /* 5 */ - "client", /* 6 */ - "storage", /* 7 */ - "fileset", /* 8 */ - "where", /* 9 */ - "all", /* 10 */ + "all", /* 6 */ + "client", /* 7 */ + "storage", /* 8 */ + "fileset", /* 9 */ + "where", /* 10 */ "yes", /* 11 */ + "done", /* 12 */ NULL }; @@ -387,8 +389,11 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) return 0; } break; + case 6: /* all specified */ + rx->all = true; + break; /* - * All keywords 6 or greater are ignored or handled by a select prompt + * All keywords 7 or greater are ignored or handled by a select prompt */ default: break; @@ -705,6 +710,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) tree.root = new_tree(rx->TotalFiles); tree.root->fname = nofname; tree.ua = ua; + tree.all = rx->all; last_JobId = 0; /* * For display purposes, the same JobId, with different volumes may @@ -734,13 +740,13 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) bsendmsg(ua, "%s", db_strerror(ua->db)); } } - bsendmsg(ua, "%d Job%s inserted into the tree and marked for extraction.\n", - items, items==1?"":"s"); + bsendmsg(ua, "%d Job%s inserted into the tree%s.\n", + items, items==1?"":"s", tree.all?" and marked for extraction":""); /* Check MediaType and select storage that corresponds */ get_storage_from_mediatype(ua, &rx->name_list, rx); - if (find_arg(ua, _("all")) < 0) { + if (find_arg(ua, _("done")) < 0) { /* Let the user interact in selecting which files to restore */ OK = user_select_files_from_tree(&tree); } diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 7fb06f2a35..5ebf41bf25 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -193,10 +193,12 @@ int insert_tree_handler(void *ctx, int num_fields, char **row) new_node->FileIndex = atoi(row[2]); new_node->JobId = (JobId_t)str_to_int64(row[3]); new_node->type = type; - new_node->extract = true; /* extract all by default */ new_node->soft_link = S_ISLNK(statp.st_mode) != 0; - if (type == TN_DIR || type == TN_DIR_NLS) { - new_node->extract_dir = true; /* if dir, extract it */ + if (tree->all) { + new_node->extract = true; /* extract all by default */ + if (type == TN_DIR || type == TN_DIR_NLS) { + new_node->extract_dir = true; /* if dir, extract it */ + } } } tree->cnt++; diff --git a/bacula/src/lib/signal.c b/bacula/src/lib/signal.c index aba1640035..82027beca4 100644 --- a/bacula/src/lib/signal.c +++ b/bacula/src/lib/signal.c @@ -77,7 +77,7 @@ static void signal_handler(int sig) } already_dead++; if (sig == SIGTERM) { - Emsg1(M_TERM, -1, "Shutting down Bacula service: %s ...\n", my_name); +// Emsg1(M_TERM, -1, "Shutting down Bacula service: %s ...\n", my_name); } else { Emsg2(M_FATAL, -1, "Bacula interrupted by signal %d: %s\n", sig, sig_names[sig]); } -- 2.39.5