]> git.sur5r.net Git - bacula/bacula/commitdiff
Revert "Reduce diff output in weird-files-test"
authorKern Sibbald <kern@sibbald.com>
Sun, 15 Nov 2009 14:01:03 +0000 (15:01 +0100)
committerKern Sibbald <kern@sibbald.com>
Sun, 15 Nov 2009 14:01:03 +0000 (15:01 +0100)
This reverts commit ab4931484f4d46b3ed2c57d2d1b300385041cefb which was premature.

bacula/src/console/console.c
bacula/src/dird/autoprune.c
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/protos.h
bacula/src/dird/ua_dotcmds.c
bacula/src/dird/ua_prune.c
bacula/src/dird/ua_select.c
regress/tests/weird-files-test

index f8cb0cd1c511c018ffba5ada16f51fd93818ef81..05892a718a776169146ca3d604688d5ff53fc06a 100644 (file)
@@ -273,13 +273,13 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
       } else if (stat == 0) {         /* timeout */
          if (strcmp(prompt, "*") == 0) {
             tid = start_bsock_timer(UA_sock, timeout);
-            UA_sock->fsend(".messages");
+            bnet_fsend(UA_sock, ".messages");
             stop_bsock_timer(tid);
          } else {
             continue;
          }
       } else {
-         at_prompt = false;
+         at_prompt = FALSE;
          /* @ => internal command for us */
          if (UA_sock->msg[0] == '@') {
             parse_args(UA_sock->msg, &args, &argc, argk, argv, MAX_CMD_ARGS);
@@ -289,7 +289,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
             continue;
          }
          tid = start_bsock_timer(UA_sock, timeout);
-         if (!UA_sock->send()) {   /* send command */
+         if (!bnet_send(UA_sock)) {   /* send command */
             stop_bsock_timer(tid);
             break;                    /* error */
          }
@@ -299,7 +299,7 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
          break;
       }
       tid = start_bsock_timer(UA_sock, timeout);
-      while ((stat = UA_sock->recv()) >= 0) {
+      while ((stat = bnet_recv(UA_sock)) >= 0) {
          if (at_prompt) {
             if (!stop) {
                sendit("\n");
index 5bd14a87d98733cd846a5c0fa4fb6b635256a8ae..31f09167acbfba70000e6cfd33d1ac6b4d90646d 100644 (file)
@@ -50,7 +50,6 @@ void do_autoprune(JCR *jcr)
 {
    UAContext *ua;
    CLIENT *client;
-   POOL *pool;
    bool pruned;
 
    if (!jcr->client) {                /* temp -- remove me */
@@ -59,17 +58,18 @@ void do_autoprune(JCR *jcr)
 
    ua = new_ua_context(jcr);
    client = jcr->client;
-   pool = jcr->pool;
 
    if (jcr->job->PruneJobs || jcr->client->AutoPrune) {
-      prune_jobs(ua, client, pool, jcr->get_JobType());
+      Jmsg(jcr, M_INFO, 0, _("Begin pruning Jobs.\n"));
+      prune_jobs(ua, client, jcr->get_JobType());
       pruned = true;
    } else {
       pruned = false;
    }
 
    if (jcr->job->PruneFiles || jcr->client->AutoPrune) {
-      prune_files(ua, client, pool);
+      Jmsg(jcr, M_INFO, 0, _("Begin pruning Files.\n"));
+      prune_files(ua, client);
       pruned = true;
    }
    if (pruned) {
index 3248bff78667912f5bff3734d28f6bd88b756bf2..746da36db16b529eca7c394a2cc054a95f97d3ab 100644 (file)
@@ -404,9 +404,6 @@ static RES_ITEM pool_items[] = {
    {"scratchpool",   store_res,       ITEM(res_pool.ScratchPool), R_POOL, 0, 0},
    {"copypool",      store_alist_res, ITEM(res_pool.CopyPool), R_POOL, 0, 0},
    {"catalog",       store_res,       ITEM(res_pool.catalog), R_CATALOG, 0, 0},
-   {"fileretention", store_time,      ITEM(res_pool.FileRetention), 0, 0, 0},
-   {"jobretention",  store_time,      ITEM(res_pool.JobRetention),  0, 0, 0},
-
    {NULL, NULL, {0}, 0, 0, 0}
 };
 
@@ -954,7 +951,7 @@ next_run:
       sendit(sock, _("      RecyleOldest=%d PurgeOldest=%d ActionOnPurge=%d\n"), 
               res->res_pool.recycle_oldest_volume,
               res->res_pool.purge_oldest_volume,
-              res->res_pool.action_on_purge);
+             res->res_pool.action_on_purge);
       sendit(sock, _("      MaxVolJobs=%d MaxVolFiles=%d MaxVolBytes=%s\n"),
               res->res_pool.MaxVolJobs, 
               res->res_pool.MaxVolFiles,
@@ -963,9 +960,6 @@ next_run:
               edit_utime(res->res_pool.MigrationTime, ed1, sizeof(ed1)),
               edit_uint64(res->res_pool.MigrationHighBytes, ed2),
               edit_uint64(res->res_pool.MigrationLowBytes, ed3));
-      sendit(sock, _("      JobRetention=%s FileRetention=%s\n"),
-         edit_utime(res->res_client.JobRetention, ed1, sizeof(ed1)),
-         edit_utime(res->res_client.FileRetention, ed2, sizeof(ed2)));
       if (res->res_pool.NextPool) {
          sendit(sock, _("      NextPool=%s\n"), res->res_pool.NextPool->name());
       }
index a589ffa27359ba166f9e7afed558b83f73e8d6f5..75fc49f6278712fd95a7a2c9f3714256000d3d4e 100644 (file)
@@ -567,9 +567,6 @@ public:
    POOL  *ScratchPool;                /* ScratchPool source when requesting media */
    alist *CopyPool;                   /* List of copy pools */
    CAT *catalog;                      /* Catalog to be used */
-   utime_t FileRetention;             /* file retention period in seconds */
-   utime_t JobRetention;              /* job retention period in seconds */
-
    /* Methods */
    char *name() const;
 };
index 6d99a859d8b25617ad4427eaec2b89d8621bf38b..a19bdded4dd6dc809f93670826c661dbf9f1eede 100644 (file)
@@ -279,8 +279,8 @@ bool user_select_files_from_tree(TREE_CTX *tree);
 int insert_tree_handler(void *ctx, int num_fields, char **row);
 
 /* ua_prune.c */
-int prune_files(UAContext *ua, CLIENT *client, POOL *pool);
-int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType);
+int prune_files(UAContext *ua, CLIENT *client);
+int prune_jobs(UAContext *ua, CLIENT *client, int JobType);
 int prune_stats(UAContext *ua, utime_t retention);
 bool prune_volume(UAContext *ua, MEDIA_DBR *mr);
 int job_delete_handler(void *ctx, int num_fields, char **row);
index 0e37efc6d11e39bd7d2b15e9295cd02fbccc60ff..ef777e207825e1c9c55ce10e1057e39717774c42 100644 (file)
@@ -35,6 +35,7 @@
  *
  *     Kern Sibbald, April MMII
  *
+ *   Version $Id$
  */
 
 #include "bacula.h"
@@ -871,8 +872,6 @@ static bool defaultscmd(UAContext *ua, const char *cmd)
          ua->send_msg("max_vol_bytes=%s", edit_uint64(pool->MaxVolBytes, ed1));
          ua->send_msg("auto_prune=%d", pool->AutoPrune);
          ua->send_msg("recycle=%d", pool->Recycle);
-         ua->send_msg("file_retention=%s", edit_uint64(pool->FileRetention, ed1));
-         ua->send_msg("job_retention=%s", edit_uint64(pool->JobRetention, ed1));
       }
    }
    return true;
index de98645e089c3a959cd0d764b2c8730e9ca63562..9dc98f760dd6ea0c4e38661c0d9428661efab634 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2002-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -32,6 +32,7 @@
  *
  *     Kern Sibbald, February MMII
  *
+ *   Version $Id$
  */
 
 #include "bacula.h"
@@ -103,8 +104,8 @@ int file_delete_handler(void *ctx, int num_fields, char **row)
 /*
  *   Prune records from database
  *
- *    prune files (from) client=xxx [pool=yyy]
- *    prune jobs (from) client=xxx [pool=yyy]
+ *    prune files (from) client=xxx
+ *    prune jobs (from) client=xxx
  *    prune volume=xxx
  *    prune stats
  */
@@ -112,7 +113,6 @@ int prunecmd(UAContext *ua, const char *cmd)
 {
    DIRRES *dir;
    CLIENT *client;
-   POOL *pool;
    POOL_DBR pr;
    MEDIA_DBR mr;
    utime_t retention;
@@ -139,38 +139,18 @@ int prunecmd(UAContext *ua, const char *cmd)
    switch (kw) {
    case 0:  /* prune files */
       client = get_client_resource(ua);
-      if (find_arg_with_value(ua, "pool") >= 0) {
-         pool = get_pool_resource(ua);
-      } else {
-         pool = NULL;
-      }
-      /* Pool File Retention takes precedence over client File Retention */
-      if (pool && pool->FileRetention > 0) {
-         if (!confirm_retention(ua, &pool->FileRetention, "File")) {
-            return false;
-         }
-      } else if (!client || !confirm_retention(ua, &client->FileRetention, "File")) {
+      if (!client || !confirm_retention(ua, &client->FileRetention, "File")) {
          return false;
       }
-      prune_files(ua, client, pool);
+      prune_files(ua, client);
       return true;
    case 1:  /* prune jobs */
       client = get_client_resource(ua);
-      if (find_arg_with_value(ua, "pool") >= 0) {
-         pool = get_pool_resource(ua);
-      } else {
-         pool = NULL;
-      }
-      /* Pool Job Retention takes precedence over client Job Retention */
-      if (pool && pool->JobRetention > 0) {
-         if (!confirm_retention(ua, &pool->JobRetention, "Job")) {
-            return false;
-         }
-      } else if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) {
+      if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) {
          return false;
       }
       /* ****FIXME**** allow user to select JobType */
-      prune_jobs(ua, client, pool, JT_BACKUP);
+      prune_jobs(ua, client, JT_BACKUP);
       return 1;
    case 2:  /* prune volume */
       if (!select_pool_and_media_dbr(ua, &pr, &mr)) {
@@ -234,10 +214,8 @@ int prune_stats(UAContext *ua, utime_t retention)
  *
  * This routine assumes you want the pruning to be done. All checking
  *  must be done before calling this routine.
- *
- * Note: pool can possibly be NULL.
  */
-int prune_files(UAContext *ua, CLIENT *client, POOL *pool)
+int prune_files(UAContext *ua, CLIENT *client)
 {
    struct del_ctx del;
    struct s_count_ctx cnt;
@@ -249,23 +227,18 @@ int prune_files(UAContext *ua, CLIENT *client, POOL *pool)
    db_lock(ua->db);
    memset(&cr, 0, sizeof(cr));
    memset(&del, 0, sizeof(del));
-   bstrncpy(cr.Name, client->name(), sizeof(cr.Name));
+   bstrncpy(cr.Name, client->hdr.name, sizeof(cr.Name));
    if (!db_create_client_record(ua->jcr, ua->db, &cr)) {
       db_unlock(ua->db);
       return 0;
    }
 
-   if (pool && pool->FileRetention > 0) {
-      period = pool->FileRetention;
-   } else {
-      period = client->FileRetention;
-   }
+   period = client->FileRetention;
    now = (utime_t)time(NULL);
 
-   edit_int64(now - period, ed1);
-   Jmsg(ua->jcr, M_INFO, 0, _("Begin pruning Jobs older than %s secs.\n"), ed1); 
-   /* Select Jobs -- for counting */ 
-   Mmsg(query, count_select_job, ed1, edit_int64(cr.ClientId, ed2));
+   /* Select Jobs -- for counting */
+   Mmsg(query, count_select_job, edit_int64(now - period, ed1), 
+        edit_int64(cr.ClientId, ed2));
    Dmsg3(050, "select now=%u period=%u sql=%s\n", (uint32_t)now, 
                (uint32_t)period, query.c_str());
    cnt.count = 0;
@@ -349,7 +322,7 @@ static bool create_temp_tables(UAContext *ua)
  *
  * For Restore Jobs there are no restrictions.
  */
-int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType)
+int prune_jobs(UAContext *ua, CLIENT *client, int JobType)
 {
    struct del_ctx del;
    POOL_MEM query(PM_MESSAGE);
@@ -367,11 +340,7 @@ int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType)
       return 0;
    }
 
-   if (pool && pool->JobRetention > 0) {
-      period = pool->JobRetention;
-   } else {
-      period = client->JobRetention;
-   }
+   period = client->JobRetention;
    now = (utime_t)time(NULL);
 
    /* Drop any previous temporary tables still there */
@@ -382,13 +351,11 @@ int prune_jobs(UAContext *ua, CLIENT *client, POOL *pool, int JobType)
       goto bail_out;
    }
 
-
    /*
     * Select all files that are older than the JobRetention period
     *  and stuff them into the "DeletionCandidates" table.
     */
    edit_int64(now - period, ed1);
-   Jmsg(ua->jcr, M_INFO, 0, _("Begin pruning Jobs older than %s secs.\n"), ed1);
    Mmsg(query, insert_delcand, (char)JobType, ed1, 
         edit_int64(cr.ClientId, ed2));
    if (!db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL)) {
index 89b3f178ce6d51dd6c5079906b729acd4c423c50..aebdaa0b8be6ec3b4b0d66ce38bc8cff86f1635c 100644 (file)
@@ -31,6 +31,7 @@
  *
  *     Kern Sibbald, October MMI
  *
+ *   Version  $Id$
  */
 
 #include "bacula.h"
index c7d4b202e091723969e708fc25d00b1f780b7748..bd211f0b1de277fb03cc9ddbfab20ce51e67be24 100755 (executable)
@@ -71,11 +71,7 @@ ${cwd}/bin/testls weird-files | sort >${cwd}/tmp/restored
 cd ${cwd}
 
 check_two_logs
-if test "$debug" -eq 1; then
-  diff -u ${cwd}/tmp/original ${cwd}/tmp/restored                
-  dstat=$?
-else
-  diff -u ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
-  dstat=$?
-fi
+#diff -u ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
+diff -u ${cwd}/tmp/original ${cwd}/tmp/restored                
+dstat=$?
 end_test