From: Eric Bollengier Date: Thu, 6 Aug 2009 19:25:15 +0000 (+0200) Subject: add option to truncate cache table during startup for bvfs_test X-Git-Tag: Release-5.0.0~336^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4386bcf6f6b202e8a0c78f22024fe9bb6bb413b6;p=bacula%2Fbacula add option to truncate cache table during startup for bvfs_test --- diff --git a/bacula/src/tools/bvfs_test.c b/bacula/src/tools/bvfs_test.c index 4eae62cc01..0772873bfc 100644 --- a/bacula/src/tools/bvfs_test.c +++ b/bacula/src/tools/bvfs_test.c @@ -62,7 +62,8 @@ PROG_COPYRIGHT " -w specify working directory\n" " -j specify jobids\n" " -p specify path\n" -" -f specify file\n" +//" -f specify file\n" +" -T truncate cache table before starting\n" " -v verbose\n" " -? print this message\n\n"), 2001, VERSION, BDATE); exit(1); @@ -98,6 +99,7 @@ int main (int argc, char *argv[]) { int ch; char *jobids="1", *path=NULL, *file=NULL; + bool clean=false; setlocale(LC_ALL, ""); bindtextdomain("bacula", LOCALEDIR); textdomain("bacula"); @@ -110,7 +112,7 @@ int main (int argc, char *argv[]) OSDependentInit(); - while ((ch = getopt(argc, argv, "h:c:d:n:P:Su:vf:w:?j:p:f:")) != -1) { + while ((ch = getopt(argc, argv, "h:c:d:n:P:Su:vf:w:?j:p:f:T")) != -1) { switch (ch) { case 'd': /* debug level */ if (*optarg == 't') { @@ -159,6 +161,10 @@ int main (int argc, char *argv[]) jobids = optarg; break; + case 'T': + clean = true; + break; + case '?': default: usage(); @@ -196,12 +202,15 @@ int main (int argc, char *argv[]) } bjcr->db = db; - - db_sql_query(db, "DELETE FROM brestore_pathhierarchy", NULL, NULL); - db_sql_query(db, "DELETE FROM brestore_knownjobid", NULL, NULL); - db_sql_query(db, "DELETE FROM brestore_pathvisibility", NULL, NULL); - bvfs_update_cache(bjcr, db); + if (clean) { + Pmsg0(0, "Clean old table"); + db_sql_query(db, "DELETE FROM brestore_pathhierarchy", NULL, NULL); + db_sql_query(db, "DELETE FROM brestore_knownjobid", NULL, NULL); + db_sql_query(db, "DELETE FROM brestore_pathvisibility", NULL, NULL); + bvfs_update_cache(bjcr, db); + } + Bvfs fs(bjcr, db); fs.set_handler(result_handler, &fs);