From: Kern Sibbald Date: Sun, 6 Jul 2008 12:50:19 +0000 (+0000) Subject: kes Remove sleep at end of ./bacula X-Git-Tag: Release-3.0.0~1182 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=545829877cc79cb3f484d64da16863b1147b2548;p=bacula%2Fbacula kes Remove sleep at end of ./bacula kes Clear hash packet for hardlinked files correctly. This corrects a long standing bug where hardlinked files selected individually would occasionally not be restored. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7324 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/scripts/bacula.in b/bacula/scripts/bacula.in index 8010035a59..127c497936 100755 --- a/bacula/scripts/bacula.in +++ b/bacula/scripts/bacula.in @@ -27,8 +27,6 @@ case "$1" in [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2 [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2 [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2 - echo - sleep 6 ;; restart) diff --git a/bacula/src/cats/sql_cmds.c b/bacula/src/cats/sql_cmds.c index eb6463259e..d674e3ee1a 100644 --- a/bacula/src/cats/sql_cmds.c +++ b/bacula/src/cats/sql_cmds.c @@ -275,7 +275,7 @@ const char *uar_list_jobs = const char *uar_sel_files = "SELECT Path.Path,Filename.Name,FileIndex,JobId,LStat " "FROM File,Filename,Path " - "WHERE File.JobId=%s AND Filename.FilenameId=File.FilenameId " + "WHERE File.JobId IN (%s) AND Filename.FilenameId=File.FilenameId " "AND Path.PathId=File.PathId"; const char *uar_del_temp = "DROP TABLE temp"; diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index b28f1ea49f..c0fbb3f5bc 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1036,9 +1036,11 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, db_unlock(mdb); return false; } - - POOL_MEM buf (PM_MESSAGE); - + POOL_MEM buf(PM_MESSAGE); + +#define new_db_get_file_list +#ifdef new_db_get_file_list + /* This is broken, at least if called from ua_restore.c */ Mmsg(buf, "SELECT Path.Path, Filename.Name, File.FileIndex, File.JobId, File.LStat " "FROM ( " @@ -1051,11 +1053,17 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, "JOIN File ON (File.FileId = Temp.FileId) " "WHERE File.FileIndex > 0 ", jobids); +#else + /* + * I am not sure that this works the same as the code in ua_restore.c + * but it is very similar. + */ + Mmsg(buf, uar_sel_files, jobids); +#endif return db_sql_query(mdb, buf.c_str(), result_handler, ctx); } - /* Full : do nothing * Differential : get the last full id * Incremental : get the last full + last diff + last incr(s) ids diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 500c0c1aa7..482e17e589 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -1023,9 +1023,28 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) ua->info_msg(_("\nBuilding directory tree for JobId(s) %s ... "), rx->JobIds); +#define new_get_file_list +#ifdef new_get_file_list if (!db_get_file_list(ua->jcr, ua->db, rx->JobIds, insert_tree_handler, (void *)&tree)) { ua->error_msg("%s", db_strerror(ua->db)); } +#else + for (p=rx->JobIds; get_next_jobid_from_list(&p, &JobId) > 0; ) { + char ed1[50]; + + if (JobId == last_JobId) { + continue; /* eliminate duplicate JobIds */ + } + last_JobId = JobId; + /* + * Find files for this JobId and insert them in the tree + */ + Mmsg(rx->query, uar_sel_files, edit_int64(JobId, ed1)); + if (!db_sql_query(ua->db, rx->query, insert_tree_handler, (void *)&tree)) { + ua->error_msg("%s", db_strerror(ua->db)); + } + } +#endif if (tree.FileCount == 0) { 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")); diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index b6ae6b8dda..7a8990c653 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -181,8 +181,8 @@ int insert_tree_handler(void *ctx, int num_fields, char **row) int FileIndex; JobId_t JobId; -// Dmsg4(000, "Path=%s%s FI=%s JobId=%s\n", row[0], row[1], -// row[2], row[3]); + Dmsg4(400, "Path=%s%s FI=%s JobId=%s\n", row[0], row[1], + row[2], row[3]); if (*row[1] == 0) { /* no filename => directory */ if (!IsPathSeparator(*row[0])) { /* Must be Win32 directory */ type = TN_DIR_NLS; diff --git a/bacula/src/findlib/create_file.c b/bacula/src/findlib/create_file.c index 2028f475eb..5a4a92897c 100644 --- a/bacula/src/findlib/create_file.c +++ b/bacula/src/findlib/create_file.c @@ -327,6 +327,8 @@ int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace) #endif /* HAVE_CHFLAGS */ Qmsg3(jcr, M_ERROR, 0, _("Could not hard link %s -> %s: ERR=%s\n"), attr->ofname, attr->olname, be.bstrerror()); + Dmsg3(200, "Could not hard link %s -> %s: ERR=%s\n", + attr->ofname, attr->olname, be.bstrerror()); return CF_ERROR; #ifdef HAVE_CHFLAGS } diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index c27060ca5d..bc525b1f55 100644 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -60,7 +60,6 @@ struct f_link { struct f_link *next; dev_t dev; /* device */ ino_t ino; /* inode with device is unique */ - short linkcount; uint32_t FileIndex; /* Bacula FileIndex of this file */ char name[1]; /* The name */ }; @@ -415,12 +414,17 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, lp->dev == (dev_t)ff_pkt->statp.st_dev) { /* If we have already backed up the hard linked file don't do it again */ if (strcmp(lp->name, fname) == 0) { + Dmsg2(400, "== Name identical skip FI=%d file=%s\n", lp->FileIndex, fname); return 1; /* ignore */ } ff_pkt->link = lp->name; ff_pkt->type = FT_LNKSAVED; /* Handle link, file already saved */ ff_pkt->LinkFI = lp->FileIndex; - return handle_file(jcr, ff_pkt, top_level); + ff_pkt->linked = 0; + rtn_stat = handle_file(jcr, ff_pkt, top_level); + Dmsg3(400, "FT_LNKSAVED FI=%d LinkFI=%d file=%s\n", + ff_pkt->FileIndex, lp->FileIndex, lp->name); + return rtn_stat; } /* File not previously dumped. Chain it into our list. */ @@ -428,10 +432,12 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, lp = (struct f_link *)bmalloc(sizeof(struct f_link) + len); lp->ino = ff_pkt->statp.st_ino; lp->dev = ff_pkt->statp.st_dev; + lp->FileIndex = 0; /* set later */ bstrncpy(lp->name, fname, len); lp->next = ff_pkt->linkhash[linkhash]; ff_pkt->linkhash[linkhash] = lp; ff_pkt->linked = lp; /* mark saved link */ + Dmsg2(400, "added to hash FI=%d file=%s\n", ff_pkt->FileIndex, lp->name); } else { ff_pkt->linked = NULL; } @@ -454,6 +460,8 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, if (ff_pkt->linked) { ff_pkt->linked->FileIndex = ff_pkt->FileIndex; } + Dmsg3(400, "FT_REG FI=%d linked=%d file=%s\n", ff_pkt->FileIndex, + ff_pkt->linked ? 1 : 0, fname); if (ff_pkt->flags & FO_KEEPATIME) { utime(fname, &restore_times); } diff --git a/bacula/src/lib/attr.c b/bacula/src/lib/attr.c index 5e5210e4af..ee8810ff52 100644 --- a/bacula/src/lib/attr.c +++ b/bacula/src/lib/attr.c @@ -75,7 +75,7 @@ int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr) */ attr->stream = stream; Dmsg1(400, "Attr: %s\n", rec); - if (sscanf(rec, "%ld %ld", &attr->file_index, &attr->type) != 2) { + if (sscanf(rec, "%d %d", &attr->file_index, &attr->type) != 2) { Jmsg(jcr, M_FATAL, 0, _("Error scanning attributes: %s\n"), rec); Dmsg1(100, "\nError scanning attributes. %s\n", rec); return 0; @@ -244,7 +244,7 @@ void print_ls_output(JCR *jcr, ATTR *attr) if (attr->type == FT_DELETED) { /* TODO: change this to get last seen values */ bsnprintf(buf, sizeof(buf), - "---------- - - - - ---------- -------- %s\n", attr->ofname); + "---------- - - - - ---------- -------- %s\n", attr->ofname); Dmsg1(20, "%s", buf); Jmsg(jcr, M_RESTORED, 1, "%s", buf); return; diff --git a/bacula/src/version.h b/bacula/src/version.h index fba4a3771e..3892ed9079 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.1" -#define BDATE "04 July 2008" -#define LSMDATE "04Jul08" +#define BDATE "06 July 2008" +#define LSMDATE "06Jul08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index c3a38ab2d8..d84230af60 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -30,6 +30,11 @@ vtape driver General: +06Jul08 +kes Remove sleep at end of ./bacula +kes Clear hash packet for hardlinked files correctly. This corrects + a long standing bug where hardlinked files selected individually + would occasionally not be restored. 05Jul08 kes Apply Eric's patch to ensure that autoprune does not return a Volume not in the autochanger unless requested to do so. @@ -63,7 +68,7 @@ kes Fix failure of 2drive-concurrent-test. Always read label; clear_unload() only after drive is defined in acquire_for_read(). 27Jun08 kes Generally clean up the manual tape loading code. The main - conceptial change is that when a volume is marked to be unloaded, + conceptual change is that when a volume is marked to be unloaded, its volume name is retained, and it is only marked as unloaded when either the autoloader says it is unloaded or another tape is read on that drive. @@ -95,7 +100,7 @@ kes Add --with-db-password to ./configure kes Fix regress to handle db_password. ebl Add new "status storage slots" that list autochanger content. -ebl Update vtape driver to compile only under linux. +ebl Update vtape driver to compile only under Linux. ebl Fix a bug when restoring with a wrong mediatype. 18Jun08 kes Eliminate ints from conf files and structures to avoid @@ -116,10 +121,10 @@ ebl Fix autoselect option broken for a while. Fix #1089. Need some work with StorageId to be able to use a particular drive in a autochanger. 09Jun08 -ebl Rename faketape to vtape. -ebl Update faketape driver. +ebl Rename vtape to vtape. +ebl Update vtape driver. 08Jun08 -ebl Modify faketape driver to avoid sparse file. +ebl Modify vtape driver to avoid sparse file. kes Add make clean of qt-source directory during ./configure kes Store last block number written to tape in DEVICE and use it for testing for correct last block on EOT. @@ -200,7 +205,7 @@ kes Make sure we unload the right slot when swapping. 10May08 kes Add debug times, reduce size of two-pool-changer test 08May08 -ebl Tweak autoconf scripts for faketape +ebl Tweak autoconf scripts for vtape 07May08 kes Improve SD reserve debug code. kes Testing an improvement to free up volumes no longer in use. @@ -388,7 +393,7 @@ kes Fix Win32 FD backup/restore memory leak due to improper termination 16Mar08 ebl Reduce memory usage for accurate backup, working only with ctime and mtime. (not all Lstat field) - About 40MB for my linux system (400.000 files) + About 40MB for my Linux system (400.000 files) 14Mar08 kes Add dcr->reserved_volume flag that allows us to release a volume even if it is not vol->released. This allows maxvol2 to work when