From: Kern Sibbald Date: Thu, 28 Aug 2008 15:46:55 +0000 (+0000) Subject: kes Correct a problem with Level and Virtual backup, rework how X-Git-Tag: Release-3.0.0~1054 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=10778e6d36c49f8283c519da1ec044b4b3fecc5d;p=bacula%2Fbacula kes Correct a problem with Level and Virtual backup, rework how bsrs are printed in debug to use standard routine. kes Apply patch from Chris in bug #1133 that provides alternate db port support for dbcheck. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7519 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/manpages/dbcheck.8 b/bacula/manpages/dbcheck.8 index 79107cc079..441b11df20 100644 --- a/bacula/manpages/dbcheck.8 +++ b/bacula/manpages/dbcheck.8 @@ -14,6 +14,8 @@ .I bacula-database .I user .I password +.RI [ dbhost ] +.RI [ dbport ] .br .SH DESCRIPTION This manual page documents briefly the diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 2fe3d53cbe..753f47864d 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1073,8 +1073,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, { char clientid[50], jobid[50], filesetid[50]; char date[MAX_TIME_LENGTH]; - - POOL_MEM query (PM_FNAME); + POOL_MEM query(PM_FNAME); bstrutime(date, sizeof(date), time(NULL) + 1); jobids[0]='\0'; @@ -1098,7 +1097,6 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, } if (jr->JobLevel == L_INCREMENTAL || jr->JobLevel == L_VIRTUAL_FULL) { - /* Now, find the last differential backup after the last full */ Mmsg(query, "INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) " diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index 28574282b9..1b57b1882b 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -135,21 +135,6 @@ static bool is_volume_selected(RBSR_FINDEX *fi, } - -static void print_findex(UAContext *ua, RBSR_FINDEX *fi) -{ - ua->send_msg("fi=0x%lx\n", fi); - for ( ; fi; fi=fi->next) { - if (fi->findex == fi->findex2) { - ua->send_msg("FileIndex=%d\n", fi->findex); - Dmsg1(1000, "FileIndex=%d\n", fi->findex); - } else { - ua->send_msg("FileIndex=%d-%d\n", fi->findex, fi->findex2); - Dmsg2(1000, "FileIndex=%d-%d\n", fi->findex, fi->findex2); - } - } -} - /* Create a new bootstrap record */ RBSR *new_bsr() { @@ -258,6 +243,10 @@ uint32_t write_bsr_file(UAContext *ua, RESTORE_CTX &rx) ua->send_msg(_("Bootstrap records written to %s\n"), fname.c_str()); + if (debug_level >= 10) { + print_bsr(ua, rx); + } + bail_out: return count; } @@ -469,22 +458,9 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd) return total_count; } -void print_bsr(UAContext *ua, RBSR *bsr) +void print_bsr(UAContext *ua, RESTORE_CTX &rx) { - for ( ; bsr; bsr=bsr->next) { - for (int i=0; i < bsr->VolCount; i++) { - ua->send_msg("Volume=\"%s\"\n", bsr->VolParams[i].VolumeName); - ua->send_msg("MediaType\"%s\"\n", bsr->VolParams[i].MediaType); - ua->send_msg("VolSessionId=%u\n", bsr->VolSessionId); - ua->send_msg("VolSessionTime=%u\n", bsr->VolSessionTime); - ua->send_msg("VolFile=%u-%u\n", bsr->VolParams[i].StartFile, - bsr->VolParams[i].EndFile); - ua->send_msg("VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock, - bsr->VolParams[i].EndBlock); - print_findex(ua, bsr->fi); - } - print_bsr(ua, bsr->next); - } + write_bsr(ua, rx, stdout); } diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index dd4c4919f8..84677d62bb 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -74,7 +74,7 @@ void add_findex(RBSR *bsr, uint32_t JobId, int32_t findex); void add_findex_all(RBSR *bsr, uint32_t JobId); RBSR_FINDEX *new_findex(); void make_unique_restore_filename(UAContext *ua, POOLMEM **fname); -void print_bsr(UAContext *ua, RBSR *bsr); +void print_bsr(UAContext *ua, RESTORE_CTX &rx); /* catreq.c */ diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 63d0756ede..2a41178c60 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -92,8 +92,10 @@ bool do_vbackup_init(JCR *jcr) } POOLMEM *jobids = get_pool_memory(PM_FNAME); + jcr->jr.JobLevel = L_VIRTUAL_FULL; db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, jobids); - Dmsg1(100, "Accurate jobids=%s\n", jobids); + jcr->jr.JobLevel = L_FULL; + Dmsg1(10, "Accurate jobids=%s\n", jobids); if (*jobids == 0) { free_pool_memory(jobids); Jmsg(jcr, M_FATAL, 0, _("Cannot find previous JobIds.\n")); @@ -244,7 +246,7 @@ void vbackup_cleanup(JCR *jcr, int TermCode) char sdt[50], edt[50], schedt[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]; + char term_code[100], sd_term_msg[100]; const char *term_msg; int msg_type = M_INFO; MEDIA_DBR mr; @@ -359,16 +361,13 @@ void vbackup_cleanup(JCR *jcr, int TermCode) bsnprintf(compress, sizeof(compress), "%.1f %%", compression); } } - jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg)); jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg)); -// bmicrosleep(15, 0); /* for debugging SIGHUP */ - Jmsg(jcr, msg_type, 0, _("Bacula %s %s (%s): %s\n" " Build OS: %s %s %s\n" " JobId: %d\n" " Job: %s\n" -" Backup Level: %s%s\n" +" Backup Level: Virtual Full\n" " Client: \"%s\" %s\n" " FileSet: \"%s\" %s\n" " Pool: \"%s\" (From %s)\n" @@ -382,8 +381,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode) " SD Files Written: %s\n" " SD Bytes Written: %s (%sB)\n" " Rate: %.1f KB/s\n" -" Software Compression: %s\n" -" VSS: %s\n" " Encryption: %s\n" " Accurate: %s\n" " Volume name(s): %s\n" @@ -397,7 +394,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode) HOST_OS, DISTNAME, DISTVER, jcr->jr.JobId, jcr->jr.Job, - level_to_str(jcr->get_JobLevel()), jcr->since, jcr->client->name(), cr.Uname, jcr->fileset->name(), jcr->FSCreateTime, jcr->pool->name(), jcr->pool_source, @@ -412,8 +408,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode) edit_uint64_with_commas(jcr->jr.JobBytes, ec3), edit_uint64_with_suffix(jcr->jr.JobBytes, ec4), kbps, - compress, - jcr->VSS?_("yes"):_("no"), jcr->Encrypt?_("yes"):_("no"), jcr->accurate?_("yes"):_("no"), jcr->VolumeName, @@ -492,11 +486,10 @@ 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); - jcr->ExpectedFiles = write_bsr_file(ua, rx); - Dmsg1(000, "Found %d files to consolidate.\n", jcr->ExpectedFiles); + if (debug_level >= 10) { + Dmsg1(000, "Found %d files to consolidate.\n", jcr->ExpectedFiles); + } if (jcr->ExpectedFiles == 0) { free_ua_context(ua); free_bsr(rx.bsr); diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 89a0b7b0ad..e40c7f3f6f 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -432,7 +432,7 @@ bool release_device(DCR *dcr) if (dev->can_read()) { VOLUME_CAT_INFO *vol = &dev->VolCatInfo; dev->clear_read(); /* clear read bit */ - Dmsg2(000, "dir_update_vol_info. label=%d Vol=%s\n", + Dmsg2(150, "dir_update_vol_info. label=%d Vol=%s\n", dev->is_labeled(), vol->VolCatName); if (dev->is_labeled() && vol->VolCatName[0] != 0) { dir_update_volume_info(dcr, false, false); /* send Volume info to Director */ diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index e89b384081..48769c8133 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -104,7 +104,7 @@ static bool yes_no(const char *prompt); static void usage() { fprintf(stderr, -"Usage: dbcheck [-c config] [-C catalog name] [-d debug_level] []\n" +"Usage: dbcheck [-c config] [-C catalog name] [-d debug_level] [] []\n" " -b batch mode\n" " -C catalog name in the director conf file\n" " -c Director conf filename\n" @@ -120,8 +120,10 @@ int main (int argc, char *argv[]) { int ch; const char *user, *password, *db_name, *dbhost; + int dbport = 0; char *configfile = NULL; char *catalogname = NULL; + char *endptr; setlocale(LC_ALL, ""); bindtextdomain("bacula", LOCALEDIR); @@ -220,9 +222,10 @@ int main (int argc, char *argv[]) if (dbhost && dbhost[0] == 0) { dbhost = NULL; } + dbport = catalog->db_port; } } else { - if (argc > 5) { + if (argc > 6) { Pmsg0(0, _("Wrong number of arguments.\n")); usage(); } @@ -254,11 +257,24 @@ int main (int argc, char *argv[]) user = argv[2]; password = argv[3]; dbhost = argv[4]; + } else if (argc == 6) { + db_name = argv[1]; + user = argv[2]; + password = argv[3]; + dbhost = argv[4]; + dbport = strtol(argv[5], &endptr, 10); + if (*endptr != '\0') { + Pmsg0(0, _("Database port must be a numeric value.\n")); + exit(1); + } else if (dbport == LONG_MIN || dbport == LONG_MAX) { + Pmsg0(0, _("Database port must be a int value.\n")); + exit(1); + } } } /* Open database */ - db = db_init_database(NULL, db_name, user, password, dbhost, 0, NULL, 0); + db = db_init_database(NULL, db_name, user, password, dbhost, dbport, NULL, 0); if (!db_open_database(NULL, db)) { Emsg1(M_FATAL, 0, "%s", db_strerror(db)); return 1; diff --git a/bacula/src/version.h b/bacula/src/version.h index aa8a862a54..363eb9c58a 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.3" -#define BDATE "26 Aug 2008" -#define LSMDATE "26Aug08" +#define BDATE "28 Aug 2008" +#define LSMDATE "28Aug08" #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 67b75a3a91..3cd1b27dd5 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -33,6 +33,10 @@ separator in console (!$%&'()*+,-/:;<>?[]^`{|}~) General: 28Aug08 +kes Correct a problem with Level and Virtual backup, rework how + bsrs are printed in debug to use standard routine. +kes Apply patch from Chris in bug #1133 that provides alternate db port + support for dbcheck. ebl Remove catalog dependency from bcopy tool. ebl Modify catalog scripts to have an easier packaging integration, using default variables.