From: Kern Sibbald Date: Wed, 16 Jul 2008 08:43:50 +0000 (+0000) Subject: Virtual Backup tweaks -- it is close to working. X-Git-Tag: Release-3.0.0~1140 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b28eb8aae39d05b0854b1be378450d9e931a82f0;p=bacula%2Fbacula Virtual Backup tweaks -- it is close to working. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7391 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 84611b7f36..ae306b6be4 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1049,7 +1049,7 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, "JOIN Path ON (Path.PathId = Temp.PathId) " "JOIN File ON (File.FileId = Temp.FileId) " "WHERE File.FileIndex > 0 ORDER BY JobId, FileIndex ASC", /* Return sorted by JobId, */ - /* FileIndex for restore code */ + /* FileIndex for restore code */ jobids); #else /* @@ -1097,7 +1097,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, return false; } - if (jr->JobLevel == L_INCREMENTAL) { + if (jr->JobLevel == L_INCREMENTAL || jr->JobLevel == L_VIRTUAL_FULL) { /* Now, find the last differential backup after the last full */ Mmsg(query, diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index b0251cd16f..209d3d6fca 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -1156,9 +1156,8 @@ void copy_rwstorage(JCR *jcr, alist *storage, const char *where) { if (jcr->JobReads) { copy_rstorage(jcr, storage, where); - } else { - copy_wstorage(jcr, storage, where); } + copy_wstorage(jcr, storage, where); } @@ -1171,9 +1170,8 @@ void set_rwstorage(JCR *jcr, USTORE *store) } if (jcr->JobReads) { set_rstorage(jcr, store); - } else { - set_wstorage(jcr, store); } + set_wstorage(jcr, store); } void free_rwstorage(JCR *jcr) diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 97b3590e19..22d0683832 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -678,29 +678,29 @@ static void select_job_level(UAContext *ua, JCR *jcr) { if (jcr->JobType == JT_BACKUP) { start_prompt(ua, _("Levels:\n")); - add_prompt(ua, _("Base")); +// add_prompt(ua, _("Base")); add_prompt(ua, _("Full")); add_prompt(ua, _("Incremental")); add_prompt(ua, _("Differential")); add_prompt(ua, _("Since")); add_prompt(ua, _("VirtualFull")); switch (do_prompt(ua, "", _("Select level"), NULL, 0)) { +// case 0: +// jcr->JobLevel = L_BASE; +// break; case 0: - jcr->JobLevel = L_BASE; - break; - case 1: jcr->JobLevel = L_FULL; break; - case 2: + case 1: jcr->JobLevel = L_INCREMENTAL; break; - case 3: + case 2: jcr->JobLevel = L_DIFFERENTIAL; break; - case 4: + case 3: jcr->JobLevel = L_SINCE; break; - case 5: + case 4: jcr->JobLevel = L_VIRTUAL_FULL; break; default: diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index d0e4056d98..86c117d1ca 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -90,6 +90,13 @@ bool do_vbackup_init(JCR *jcr) Dmsg2(dbglevel, "Read pool=%s (From %s)\n", jcr->rpool->name(), jcr->rpool_source); + jcr->start_time = time(NULL); + jcr->jr.StartTime = jcr->start_time; + jcr->jr.JobLevel = L_FULL; /* we want this to appear as a Full backup */ + if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { + Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); + } + POOLMEM *jobids = get_pool_memory(PM_FNAME); db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, jobids); Dmsg1(000, "Accurate jobids=%s\n", jobids); @@ -220,7 +227,6 @@ bool do_vbackup(JCR *jcr) return false; } - set_jcr_job_status(jcr, JS_Running); /* Pickup Job termination data */ @@ -243,8 +249,8 @@ bool do_vbackup(JCR *jcr) void vbackup_cleanup(JCR *jcr, int TermCode) { char sdt[50], edt[50], schedt[50]; - char ec1[30], ec2[30], ec3[30], ec4[30], ec5[30], compress[50]; - char ec6[30], ec7[30], ec8[30], elapsed[50]; + char ec1[30], ec3[30], ec4[30], compress[50]; + char ec7[30], ec8[30], elapsed[50]; char term_code[100], fd_term_msg[100], sd_term_msg[100]; const char *term_msg; int msg_type = M_INFO; @@ -257,8 +263,23 @@ void vbackup_cleanup(JCR *jcr, int TermCode) memset(&mr, 0, sizeof(mr)); memset(&cr, 0, sizeof(cr)); + jcr->JobLevel = L_FULL; /* we want this to appear as a Full backup */ + jcr->jr.JobLevel = L_FULL; /* we want this to appear as a Full backup */ + jcr->JobFiles = jcr->SDJobFiles; + jcr->JobBytes = jcr->SDJobBytes; update_job_end(jcr, TermCode); +#ifdef xxx + /* ***FIXME*** set to time of last incremental */ + /* Update final items to set them to the previous job's values */ + Mmsg(query, "UPDATE Job SET StartTime='%s',EndTime='%s'," + "JobTDate=%s WHERE JobId=%s", + jcr->previous_jr.cStartTime, jcr->previous_jr.cEndTime, + edit_uint64(jcr->previous_jr.JobTDate, ec1), + edit_uint64(mig_jcr->jr.JobId, ec2)); + db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL); +#endif + if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"), db_strerror(jcr->db)); @@ -365,9 +386,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) " End time: %s\n" " Elapsed time: %s\n" " Priority: %d\n" -" FD Files Written: %s\n" " SD Files Written: %s\n" -" FD Bytes Written: %s (%sB)\n" " SD Bytes Written: %s (%sB)\n" " Rate: %.1f KB/s\n" " Software Compression: %s\n" @@ -378,9 +397,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) " Volume Session Id: %d\n" " Volume Session Time: %d\n" " Last Volume Bytes: %s (%sB)\n" -" Non-fatal FD errors: %d\n" " SD Errors: %d\n" -" FD termination status: %s\n" " SD termination status: %s\n" " Termination: %s\n\n"), my_name, VERSION, LSMDATE, edt, @@ -399,11 +416,8 @@ void vbackup_cleanup(JCR *jcr, int TermCode) edit_utime(RunTime, elapsed, sizeof(elapsed)), jcr->JobPriority, edit_uint64_with_commas(jcr->jr.JobFiles, ec1), - edit_uint64_with_commas(jcr->SDJobFiles, ec2), edit_uint64_with_commas(jcr->jr.JobBytes, ec3), edit_uint64_with_suffix(jcr->jr.JobBytes, ec4), - edit_uint64_with_commas(jcr->SDJobBytes, ec5), - edit_uint64_with_suffix(jcr->SDJobBytes, ec6), kbps, compress, jcr->VSS?_("yes"):_("no"), @@ -414,9 +428,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) jcr->VolSessionTime, edit_uint64_with_commas(mr.VolBytes, ec7), edit_uint64_with_suffix(mr.VolBytes, ec8), - jcr->Errors, jcr->SDErrors, - fd_term_msg, sd_term_msg, term_msg); @@ -487,8 +499,8 @@ static bool create_bootstrap_file(JCR *jcr, POOLMEM *jobids) #endif complete_bsr(ua, rx.bsr); -// Dmsg0(000, "Print bsr\n"); -// print_bsr(ua, rx.bsr); + Dmsg0(000, "Print bsr\n"); + print_bsr(ua, rx.bsr); jcr->ExpectedFiles = write_bsr_file(ua, rx); Dmsg1(000, "Found %d files to consolidate.\n", jcr->ExpectedFiles); diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 7e47508b71..8b8b27bded 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -142,7 +142,7 @@ mount_next_vol: } else { autochanger = false; VolCatInfo.Slot = 0; - ask = true; + ask = retry >= 2; } Dmsg1(150, "autoload_dev returns %d\n", autochanger); /* diff --git a/bacula/src/stored/read_record.c b/bacula/src/stored/read_record.c index 8a0534e1dd..1ca911aa83 100644 --- a/bacula/src/stored/read_record.c +++ b/bacula/src/stored/read_record.c @@ -52,7 +52,7 @@ static bool try_repositioning(JCR *jcr, DEV_RECORD *rec, DCR *dcr); static char *rec_state_to_str(DEV_RECORD *rec); #endif -static const int dbglvl = 1000; +static const int dbglvl = 200; bool read_records(DCR *dcr, bool record_cb(DCR *dcr, DEV_RECORD *rec), diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index d03e727554..0abaaa5afd 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -30,7 +30,11 @@ vtape driver General: +16Jul08 +kes Virtual Backup tweaks -- it is close to working. 15Jul08 +kes Ensure that SD tried to mount a volume not in an autochanger + at least once before asking for operator intervention. kes Make SD aware of Virtual Backup jobs. kes Add VirtualFull for bat. kes Changes to get read storage correct for Virtual Backup.