From: Kern Sibbald Date: Sat, 30 Aug 2008 18:25:09 +0000 (+0000) Subject: kes Another try at fixing Vbackup. It looks much better this time. X-Git-Tag: Release-3.0.0~1043 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=706490171cd2e5458defa3e4abfeca745d19d1f3;p=bacula%2Fbacula kes Another try at fixing Vbackup. It looks much better this time. Disable file index sanity check in FD with value stored in attributes record because with Vbackup the File Index gets changed, but not the attributes record. Enhance some debug code. Fix handling of re-indexing records that are copied in Vbackup. 29Aug08 kes Made level_to_str() know about Virtual backup. kes Set correct Virtual backup write pool. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7530 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index 830f338032..92b0f86efe 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index d41aae599e..c86a4f891e 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -153,6 +153,7 @@ bool do_vbackup_init(JCR *jcr) if (!set_migration_wstorage(jcr, jcr->pool)) { return false; } + jcr->pool = jcr->pool->NextPool; pm_strcpy(jcr->pool_source, _("Job Pool's NextPool resource")); Dmsg2(dbglevel, "Write pool=%s read rpool=%s\n", jcr->pool->name(), jcr->rpool->name()); @@ -179,11 +180,13 @@ bool do_vbackup(JCR *jcr) ((STORE *)jcr->rstorage->first())->name(), ((STORE *)jcr->wstorage->first())->name()); /* ***FIXME*** we really should simply verify that the pools are different */ +#ifdef xxx if (((STORE *)jcr->rstorage->first())->name() == ((STORE *)jcr->wstorage->first())->name()) { Jmsg(jcr, M_FATAL, 0, _("Read storage \"%s\" same as write storage.\n"), ((STORE *)jcr->rstorage->first())->name()); return false; } +#endif /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start Virtual Backup JobId %s, Job=%s\n"), diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 461d79b9e5..d241d83caa 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -331,12 +331,14 @@ void do_restore(JCR *jcr) if (!unpack_attributes_record(jcr, rctx.stream, sd->msg, attr)) { goto bail_out; } +#ifdef xxx if (file_index != attr->file_index) { Jmsg(jcr, M_FATAL, 0, _("Record header file index %ld not equal record index %ld\n"), file_index, attr->file_index); Dmsg0(200, "File index error\n"); goto bail_out; } +#endif Dmsg3(200, "File %s\nattrib=%s\nattribsEx=%s\n", attr->fname, attr->attr, attr->attrEx); diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 86d0760338..16683c50e7 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -413,6 +413,9 @@ const char *job_level_to_str(int level) case L_VERIFY_DATA: str = _("Verify Data"); break; + case L_VIRTUAL_FULL: + str = _("Virtual Full"); + break; case L_NONE: str = " "; break; diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index e5c0535894..4d33c255ae 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -409,7 +409,7 @@ bool dir_create_jobmedia_record(DCR *dcr) dcr->StartBlock, dcr->EndBlock, dcr->Copy, dcr->Stripe, edit_uint64(dcr->VolMediaId, ed1)); - Dmsg1(100, ">dird %s", dir->msg); + Dmsg1(100, ">dird %s", dir->msg); if (dir->recv() <= 0) { Dmsg0(190, "create_jobmedia error bnet_recv\n"); Jmsg(jcr, M_FATAL, 0, _("Error creating JobMedia record: ERR=%s\n"), diff --git a/bacula/src/stored/mac.c b/bacula/src/stored/mac.c index de22d4f15b..965a4398a3 100644 --- a/bacula/src/stored/mac.c +++ b/bacula/src/stored/mac.c @@ -113,6 +113,7 @@ bool do_mac(JCR *jcr) jcr->run_time = time(NULL); set_start_vol_position(jcr->dcr); + jcr->JobFiles = 0; ok = read_records(jcr->read_dcr, record_cb, mount_next_read_volume); goto ok_out; @@ -192,10 +193,13 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) DEVICE *dev = jcr->dcr->dev; char buf1[100], buf2[100]; int32_t stream; - uint32_t last_VolSessionId = 0; - uint32_t last_VolSessionTime = 0; - int32_t last_FileIndex = 0; +#ifdef xxx + Dmsg5(000, "on entry JobId=%d FI=%s SessId=%d Strm=%s len=%d\n", + jcr->JobId, + FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId, + stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len); +#endif /* If label and not for us, discard it */ if (rec->FileIndex < 0 && rec->match_stat <= 0) { return true; @@ -217,15 +221,16 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) * We do so by detecting a FileIndex change and incrementing the * JobFiles, which we then use as the output FileIndex. */ - if (rec->VolSessionId != last_VolSessionId || - rec->VolSessionTime != last_VolSessionTime || - (rec->FileIndex > 0 && rec->FileIndex != last_FileIndex)) { - jcr->JobFiles++; - last_VolSessionId = rec->VolSessionId; - last_VolSessionTime = rec->VolSessionTime; - last_FileIndex = rec->FileIndex; - } - if (rec->FileIndex > 0) { + if (rec->FileIndex > 0) { + /* If something changed, increment FileIndex */ + if (rec->VolSessionId != rec->last_VolSessionId || + rec->VolSessionTime != rec->last_VolSessionTime || + rec->FileIndex != rec->last_FileIndex) { + jcr->JobFiles++; + rec->last_VolSessionId = rec->VolSessionId; + rec->last_VolSessionTime = rec->VolSessionTime; + rec->last_FileIndex = rec->FileIndex; + } rec->FileIndex = jcr->JobFiles; /* set sequential output FileIndex */ } } @@ -235,11 +240,10 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) */ rec->VolSessionId = jcr->VolSessionId; rec->VolSessionTime = jcr->VolSessionTime; - Dmsg5(200, "before write_rec JobId=%d FI=%s SessId=%d Strm=%s len=%d\n", + Dmsg5(200, "before write JobId=%d FI=%s SessId=%d Strm=%s len=%d\n", jcr->JobId, FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId, - stream_to_ascii(buf1, rec->Stream,rec->FileIndex), rec->data_len); - + stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len); while (!write_record_to_block(jcr->dcr->block, rec)) { Dmsg4(200, "!write_record_to_block blkpos=%u:%u len=%d rem=%d\n", dev->file, dev->block_num, rec->data_len, rec->remainder); diff --git a/bacula/src/stored/read.c b/bacula/src/stored/read.c index 6221b8a299..3b204a4b91 100644 --- a/bacula/src/stored/read.c +++ b/bacula/src/stored/read.c @@ -108,12 +108,15 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) BSOCK *fd = jcr->file_bsock; bool ok = true; POOLMEM *save_msg; + char ec1[50], ec2[50]; if (rec->FileIndex < 0) { return true; } - Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n", - rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream, + Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%s Strm=%s, len=%d\n", + rec->VolSessionId, rec->VolSessionTime, + FI_to_ascii(ec1, rec->FileIndex), + stream_to_ascii(ec2, rec->Stream, rec->FileIndex), rec->data_len); /* Send record header to File daemon */ diff --git a/bacula/src/version.h b/bacula/src/version.h index 66506f3234..8171ec097f 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.3" -#define BDATE "29 Aug 2008" -#define LSMDATE "29Aug08" +#define BDATE "30 Aug 2008" +#define LSMDATE "30Aug08" #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 7bfaa5aca1..f4e55012b9 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -32,7 +32,16 @@ separator in console (!$%&'()*+,-/:;<>?[]^`{|}~) General: +30Aug08 +kes Another try at fixing Vbackup. It looks much better this time. + Disable file index sanity check in FD with value stored in + attributes record because with Vbackup the File Index gets + changed, but not the attributes record. + Enhance some debug code. + Fix handling of re-indexing records that are copied in Vbackup. 29Aug08 +kes Made level_to_str() know about Virtual backup. +kes Set correct Virtual backup write pool. kes Fix compile warning in new dbcheck port code. kes Fix migration code broken by previous virtual backup fix. 28Aug08