Amanda-Users

Re: Autoflush not working in 2.5.2

2007-05-15 19:45:18
Subject: Re: Autoflush not working in 2.5.2
From: Jean-Louis Martineau <martineau AT zmanda DOT com>
To: Christopher McCrory <chrismcc AT pricegrabber DOT com>
Date: Tue, 15 May 2007 19:30:21 -0400
The patch is already in the latest 2.5.2 snapshot.
That snapshot have a lot of bug fixed.

Jean-Louis

Christopher McCrory wrote:
Hello...

On Mon, 2007-05-14 at 19:39 -0400, Jean-Louis Martineau wrote:
The information was useful, I found a problem.

Try http://www.zmanda.com/downloads/community/community-builds/amanda-2.5.2-flush-1.tar.gz


that tarball had a lot of other changes in it also.  Is it possible to
get a patch or a svn patch reference?

thanks




diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/amadmin.c 
amanda-2.5.2.holding/server-src/amadmin.c
--- amanda-2.5.2/server-src/amadmin.c   2007-05-04 07:39:04.000000000 -0400
+++ amanda-2.5.2.holding/server-src/amadmin.c   2007-05-15 06:57:12.000000000 
-0400
@@ -1197,7 +1197,7 @@ get_file_list(
         dumpspec_free_list(dumplist);
     } else if (allow_empty) {
         /* just list all of them */
-        file_list = holding_get_files(NULL, 1);
+        file_list = holding_get_files(NULL, NULL, 1);
     }
 
     return file_list;
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/cmdline.c 
amanda-2.5.2.holding/server-src/cmdline.c
--- amanda-2.5.2/server-src/cmdline.c   2007-05-04 07:39:04.000000000 -0400
+++ amanda-2.5.2.holding/server-src/cmdline.c   2007-05-15 06:57:36.000000000 
-0400
@@ -219,7 +219,7 @@ cmdline_match_holding(
     sl_t *matching_files = new_sl();
 
     holding_set_verbosity(0);
-    holding_files = holding_get_files(NULL, 1);
+    holding_files = holding_get_files(NULL, NULL, 1);
 
     for (he = holding_files->first; he != NULL; he = he->next) {
         filetype = holding_file_read_header(he->name, &host, &disk, NULL, 
&datestamp);
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/find.c 
amanda-2.5.2.holding/server-src/find.c
--- amanda-2.5.2/server-src/find.c      2007-05-04 07:39:04.000000000 -0400
+++ amanda-2.5.2.holding/server-src/find.c      2007-05-15 06:57:25.000000000 
-0400
@@ -278,7 +278,7 @@ search_holding_disk(
     disk_t *dp;
     dumpfile_t file;
 
-    holding_file_list = holding_get_files(NULL, 1);
+    holding_file_list = holding_get_files(NULL, NULL, 1);
 
     for(e = holding_file_list->first; e != NULL; e = e->next) {
        holding_file = e->name;
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/holding.c 
amanda-2.5.2.holding/server-src/holding.c
--- amanda-2.5.2/server-src/holding.c   2007-05-04 07:39:04.000000000 -0400
+++ amanda-2.5.2.holding/server-src/holding.c   2007-05-15 09:04:13.000000000 
-0400
@@ -148,12 +148,15 @@ holding_set_verbosity(int v)
 static void
 holding_get_directories_per_disk(
     char *hdisk,
+    sl_t *date_list,
     int fullpaths,
     sl_t *rv)
 {
     DIR *dir;
     struct dirent *workdir;
     char *hdir = NULL;
+    sle_t *dl;
+    int date_found;
 
     if ((dir = opendir(hdisk)) == NULL) {
         if (verbose && errno != ENOENT)
@@ -188,13 +191,26 @@ holding_get_directories_per_disk(
                 puts(_("skipping cruft directory, perhaps you should delete 
it."));
         } else {
             /* found a holding directory -- keep it */
-            if (fullpaths)
-                rv = insert_sort_sl(rv, hdir);
-            else
-                rv = insert_sort_sl(rv, workdir->d_name);
-            if (verbose) {
-                puts(_("found Amanda directory."));
-            }
+           if (date_list) {
+               date_found = 0;
+               for (dl= date_list->first; dl != NULL; dl = dl->next) {
+                   if (strcmp(dl->name, workdir->d_name)) {
+                       date_found = 1;
+                       break;
+                   }
+               }
+           } else {
+               date_found = 1;
+           }
+           if (date_found == 1) {
+               if (fullpaths)
+                    rv = insert_sort_sl(rv, hdir);
+               else
+                    rv = insert_sort_sl(rv, workdir->d_name);
+               if (verbose) {
+                    puts(_("found Amanda directory."));
+               }
+           }
         }
     }
 
@@ -205,6 +221,7 @@ holding_get_directories_per_disk(
 sl_t *
 holding_get_directories(
     char *hdisk,
+    sl_t *date_list,
     int fullpaths)
 {
     holdingdisk_t *hdisk_conf;
@@ -218,13 +235,13 @@ holding_get_directories(
     /* call _per_disk for the hdisk we were given, or for all
      * hdisks if we were given NULL */
     if (hdisk) {
-        holding_get_directories_per_disk(hdisk, fullpaths, rv);
+        holding_get_directories_per_disk(hdisk, date_list, fullpaths, rv);
     } else {
         for (hdisk_conf = getconf_holdingdisks(); 
                     hdisk_conf != NULL;
                     hdisk_conf = hdisk_conf->next) {
             hdisk = holdingdisk_get_diskdir(hdisk_conf);
-            holding_get_directories_per_disk(hdisk, fullpaths, rv);
+            holding_get_directories_per_disk(hdisk, date_list, fullpaths, rv);
         }
     }
 
@@ -303,6 +320,7 @@ holding_get_files_per_dir(
 sl_t *
 holding_get_files(
     char *hdir,
+    sl_t *date_list,
     int fullpaths)
 {
     sl_t *hdirs;
@@ -319,7 +337,7 @@ holding_get_files(
     if (hdir) {
         holding_get_files_per_dir(hdir, fullpaths, rv);
     } else {
-        hdirs = holding_get_directories(NULL, 1);
+        hdirs = holding_get_directories(NULL, date_list, 1);
         for (e = hdirs->first; e != NULL; e = e->next) {
             holding_get_files_per_dir(e->name, fullpaths, rv);
         }
@@ -379,24 +397,13 @@ holding_get_files_for_flush(
     }
 
     /* loop over *all* files, checking each one */
-    file_list = holding_get_files(NULL, 1);
+    file_list = holding_get_files(NULL, date_list, 1);
     for (file_elt = file_list->first; file_elt != NULL; file_elt = 
file_elt->next) {
         /* get info on that file */
         filetype = holding_file_read_header(file_elt->name, &host, &disk, 
NULL, &datestamp);
         if (filetype != F_DUMPFILE)
             continue;
 
-        /* loop over dates, until we find a match */
-        date_matches = 0;
-        for (date = date_list->first; date !=NULL; date = date->next) {
-            if (strcmp(datestamp, date->name) == 0) {
-                date_matches = 1;
-                break;
-            }
-        }
-        if (!date_matches)
-            continue;
-
         /* check that the hostname and disk are in the disklist */
         dp = lookup_disk(host, disk);
         if (dp == NULL) {
@@ -582,7 +589,7 @@ pick_all_datestamp(
 
     /* get all holding directories, without full paths -- this
      * will be datestamps only */
-    rv = holding_get_directories(NULL, 0);
+    rv = holding_get_directories(NULL, NULL, 0);
 
     holding_set_verbosity(old_verbose);
     return rv;
diff -u -r --show-c-function --new-file 
--exclude-from=/home/martinea/src.orig/amanda.diff 
--ignore-matching-lines='$Id:' amanda-2.5.2/server-src/holding.h 
amanda-2.5.2.holding/server-src/holding.h
--- amanda-2.5.2/server-src/holding.h   2007-05-04 07:39:04.000000000 -0400
+++ amanda-2.5.2.holding/server-src/holding.h   2007-05-15 09:04:51.000000000 
-0400
@@ -80,11 +80,13 @@ holding_set_verbosity(int verbose);
  * bare directory names (datestamps).
  *
  * @param hdisk: holding disk to enumerate, or NULL for all
+ * @param date_list: Limit to thes timestamps.
  * @param fullpaths: if true, return full pathnames
  * @returns: newly allocated sl_t of matching directories
  */
 sl_t *
 holding_get_directories(char *hdisk,
+                       sl_t *date_list,
                         int fullpaths);
 
 /*
@@ -96,11 +98,13 @@ holding_get_directories(char *hdisk,
  * bare file names.
  *
  * @param hdir: holding directory to enumerate, or NULL for all
+ * @param date_list: Limit to thes timestamps.
  * @param fullpaths: if true, return full pathnames
  * @returns: newly allocated sl_t of matching files
  */
 sl_t *
 holding_get_files(char *hdir,
+                 sl_t *date_list,
                   int fullpaths);
 
 /* Get a list of holding files that should be flushed, optionally
<Prev in Thread] Current Thread [Next in Thread>