From: Eric Bollengier Date: Mon, 28 Apr 2008 15:33:40 +0000 (+0000) Subject: ebl Make accurate mode with hash disk pass regression tests X-Git-Tag: Release-7.0.0~4686 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c6756a3eac2609433f5dfbbaefa0b016aba390f3;p=bacula%2Fbacula ebl Make accurate mode with hash disk pass regression tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6848 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c index 4c4c187e54..5c78f8eb8a 100644 --- a/bacula/src/filed/accurate.c +++ b/bacula/src/filed/accurate.c @@ -58,6 +58,7 @@ bool accurate_add_file(JCR *jcr, char *fname, char *lstat) fname, strlen(fname)+1, &elt, sizeof(CurFile))) { + Dmsg1(2, "Can't add <%s> to file_list\n", fname); /* TODO: check error */ } #else /* HTABLE */ @@ -70,13 +71,14 @@ bool accurate_add_file(JCR *jcr, char *fname, char *lstat) jcr->file_list->insert(item->fname, item); #endif - Dmsg2(500, "add fname=%s lstat=%s\n", fname, lstat); + Dmsg2(2, "add fname=<%s> lstat=%s\n", fname, lstat); return true; } bool accurate_mark_file_as_seen(JCR *jcr, CurFile *elt) { bool ret=true; + CurFile deb; #ifdef USE_TCHDB elt->seen = 1; @@ -84,9 +86,11 @@ bool accurate_mark_file_as_seen(JCR *jcr, CurFile *elt) elt->fname, strlen(elt->fname)+1, elt, sizeof(CurFile))) { + Dmsg1(2, "can't update <%s>\n", elt->fname); ret = false; /* TODO: add error message */ } -#else + +#else /* HTABLE */ CurFile *temp = (CurFile *)jcr->file_list->lookup(elt->fname); temp->seen = 1; #endif @@ -115,6 +119,10 @@ bool accurate_lookup(JCR *jcr, char *fname, CurFile *ret) } #endif + if (found) { + Dmsg1(2, "lookup <%s> ok\n", fname); + } + return found; } @@ -129,7 +137,9 @@ bool accurate_init(JCR *jcr, int nbfile) 16, 0); /* options like compression */ /* TODO: make accurate file unique */ - if(!tchdbopen(jcr->file_list, "/tmp/casket.hdb", HDBOWRITER | HDBOCREAT)){ + POOL_MEM buf; + Mmsg(buf, "/tmp/casket.hdb.%i", jcr->JobId); + if(!tchdbopen(jcr->file_list, buf.c_str(), HDBOWRITER | HDBOCREAT)){ /* TODO: handle error creation */ //ecode = tchdbecode(hdb); //fprintf(stderr, "open error: %s\n", tchdberrmsg(ecode)); @@ -193,7 +203,7 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt) } accurate_mark_file_as_seen(jcr, &elt); - Dmsg2(500, "accurate %s = %i\n", fname, stat); + Dmsg2(2, "accurate %s = %i\n", fname, stat); bail_out: unstrip_path(ff_pkt); @@ -273,13 +283,23 @@ bool accurate_send_deleted_list(JCR *jcr) elt = &item; /* traverse records */ tchdbiterinit(jcr->file_list); - while((key = tchdbiternext2(jcr->file_list)) != NULL){ - tchdbget3(jcr->file_list, key, strlen(key), elt, sizeof(CurFile)); - ff_pkt->fname = key; - ff_pkt->statp.st_mtime = elt->mtime; - ff_pkt->statp.st_ctime = elt->ctime; - encode_and_send_attributes(jcr, ff_pkt, stream); -// free(key); + while((key = tchdbiternext2(jcr->file_list)) != NULL) { + if (tchdbget3(jcr->file_list, + key, strlen(key)+1, + elt, sizeof(CurFile)) != -1) + { + if (!elt->seen) { + ff_pkt->fname = key; + ff_pkt->statp.st_mtime = elt->mtime; + ff_pkt->statp.st_ctime = elt->ctime; + encode_and_send_attributes(jcr, ff_pkt, stream); + Dmsg1(2, "deleted <%s>\n", key); + } + // free(key); + + } else { /* TODO: add error message */ + Dmsg1(2, "No value for <%s> key\n", key); + } } #else foreach_htable (elt, jcr->file_list) { @@ -306,7 +326,9 @@ bail_out: /* delete the object */ tchdbdel(jcr->file_list); - unlink("/tmp/casket.hdb"); + POOL_MEM buf; + Mmsg(buf, "/tmp/casket.hdb.%i", jcr->JobId); +// unlink("/tmp/casket.hdb"); #else jcr->file_list->destroy(); free(jcr->file_list); diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 6770bb8d69..4a3c043133 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -127,7 +127,6 @@ struct save_pkt; #ifdef FILE_DAEMON class htable; -struct TCHDB; struct CRYPTO_CTX { bool pki_sign; /* Enable PKI Signatures? */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 86386c5e3e..f9f5b52f4f 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -24,6 +24,8 @@ Add long term statistics job table General: +28Apr08 +ebl Make accurate mode with hash disk pass regression tests 27Apr08 ebl Implement first cut of accurate backup with hash disk. 19Apr08