X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=server-src%2Famflush.c;h=4d28e44755118821311cffa1a934d9a8234fa689;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hp=d8e11786b29842896e08c0fae4e6d7809fd7294c;hpb=fd48f3e498442f0cbff5f3606c7c403d0566150e;p=debian%2Famanda diff --git a/server-src/amflush.c b/server-src/amflush.c index d8e1178..4d28e44 100644 --- a/server-src/amflush.c +++ b/server-src/amflush.c @@ -31,13 +31,13 @@ #include "amanda.h" #include "match.h" +#include "find.h" #include "conffile.h" #include "diskfile.h" #include "tapefile.h" #include "logfile.h" #include "clock.h" #include "holding.h" -#include "driverio.h" #include "server_util.h" #include "timestamp.h" @@ -92,6 +92,8 @@ main( GSList *datestamp_list = NULL; config_overrides_t *cfg_ovr; char **config_options; + find_result_t *holding_files; + disklist_t holding_disklist = { NULL, NULL }; /* * Configure program for internationalization: @@ -172,6 +174,13 @@ main( dbrename(get_config_name(), DBG_SUBDIR_SERVER); + /* load DLEs from the holding disk, in case there's anything to flush there */ + search_holding_disk(&holding_files, &holding_disklist); + /* note that the dumps are added to the global disklist, so we need not + * consult holding_files or holding_disklist after this. The holding-only + * dumps will be filtered properly by match_disklist, setting the dp->todo + * flag appropriately. */ + errstr = match_disklist(&diskq, argc-1, argv+1); if (errstr) { g_printf(_("%s"),errstr); @@ -340,6 +349,7 @@ main( holding_file_get_dumpfile((char *)holding_file->data, &file); if (holding_file_size((char *)holding_file->data, 1) <= 0) { + g_debug("%s is empty - ignoring", (char *)holding_file->data); log_add(L_INFO, "%s: removing file with no data.", (char *)holding_file->data); holding_file_unlink((char *)holding_file->data); @@ -347,11 +357,12 @@ main( continue; } + /* search_holding_disk should have already ensured that every + * holding dumpfile has an entry in the dynamic disklist */ dp = lookup_disk(file.name, file.disk); - if (!dp) { - error("dp == NULL"); - /*NOTREACHED*/ - } + assert(dp != NULL); + + /* but match_disklist may have indicated we should not flush it */ if (dp->todo == 0) continue; qdisk = quote_string(file.disk); @@ -363,6 +374,8 @@ main( file.datestamp, file.dumplevel, qhname); + + g_debug("flushing '%s'", (char *)holding_file->data); g_fprintf(driver_stream, "FLUSH %s %s %s %d %s\n", file.name, @@ -656,6 +669,7 @@ confirm(GSList *datestamp_list) } g_printf(_("Ok, quitting. Run amflush again when you are ready.\n")); + log_add(L_INFO, "pid-done %ld", (long)getpid()); exit(1); }