]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add an option that permit to specify spool size in job
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 30 Sep 2007 16:27:20 +0000 (16:27 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 30 Sep 2007 16:27:20 +0000 (16:27 +0000)
     definition.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5694 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/job.c
bacula/src/dird/msgchan.c
bacula/src/jcr.h
bacula/src/stored/acquire.c
bacula/src/stored/job.c
bacula/technotes-2.3

index 870a32120a5a7735f164eef596139f776a87c4cb..eb04adaa00092ddc6e98ffc155dcab9e17a389ee 100644 (file)
@@ -296,6 +296,7 @@ RES_ITEM job_items[] = {
    {"optimizejobscheduling",store_bool, ITEM(res_job.OptimizeJobScheduling), 0, ITEM_DEFAULT, false},
    {"spoolattributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, false},
    {"spooldata",   store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
+   {"spoolsize",   store_size, ITEM(res_job.spool_size), 0, 0, 0},
    {"rerunfailedlevels",   store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
    {"prefermountedvolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
    {"runbeforejob", store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
@@ -607,6 +608,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          res->res_job.RescheduleOnError, res->res_job.RescheduleTimes,
          edit_uint64_with_commas(res->res_job.RescheduleInterval, ed1),
          res->res_job.spool_data, res->res_job.write_part_after_job);
+      if (res->res_job.spool_size) {
+         sendit(sock, _("     SpoolSize=%s\n"),        edit_uint64(res->res_job.spool_size, ed1));
+      }
       if (res->res_job.JobType == JT_MIGRATE) {
          sendit(sock, _("     SelectionType=%d\n"), res->res_job.selection_type);
       }
index 2df2d6ad901c428e37339f70ac6ebe7688adb7cc..61e4a32cdbeb45f9151b7b5e6d5a6c6f26f98048 100644 (file)
@@ -380,6 +380,7 @@ public:
    utime_t RescheduleInterval;        /* Reschedule interval */
    utime_t JobRetention;              /* job retention period in seconds */
    uint32_t MaxConcurrentJobs;        /* Maximum concurrent jobs */
+   int64_t spool_size;                /* Size of spool file for this job */
    int RescheduleTimes;               /* Number of times to reschedule job */
    bool RescheduleOnError;            /* Set to reschedule on error */
    bool PrefixLinks;                  /* prefix soft links with Where path */
index 3b90108b35f8685f74f43d358d784f29f305e6e1..df9751a21251526a2a20573d73ba367ab49c77a7 100644 (file)
@@ -976,6 +976,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job)
    jcr->fileset = job->fileset;
    jcr->messages = job->messages;
    jcr->spool_data = job->spool_data;
+   jcr->spool_size = job->spool_size;
    jcr->write_part_after_job = job->write_part_after_job;
    if (jcr->RestoreBootstrap) {
       free(jcr->RestoreBootstrap);
index 935a9d08ab0764188a620e7cc613db6b79971e5a..bca443577f536ad30bec94bf3a2a2e20af19a08e 100644 (file)
@@ -51,7 +51,7 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 /* Commands sent to Storage daemon */
 static char jobcmd[]     = "JobId=%s job=%s job_name=%s client_name=%s "
    "type=%d level=%d FileSet=%s NoAttr=%d SpoolAttr=%d FileSetMD5=%s "
-   "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d\n";
+   "SpoolData=%d SpoolSize=%s WritePartAfterJob=%d PreferMountedVols=%d\n";
 static char use_storage[] = "use storage=%s media_type=%s pool_name=%s "
    "pool_type=%s append=%d copy=%d stripe=%d\n";
 static char use_device[] = "use device=%s\n";
@@ -157,7 +157,7 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore)
    POOL_MEM job_name, client_name, fileset_name;
    int copy = 0;
    int stripe = 0;
-   char ed1[30];
+   char ed1[30], ed2[30];
 
    sd = jcr->store_bsock;
    /*
@@ -187,7 +187,8 @@ bool start_storage_daemon_job(JCR *jcr, alist *rstore, alist *wstore)
              jcr->JobType, jcr->JobLevel,
              fileset_name.c_str(), !jcr->pool->catalog_files,
              jcr->job->SpoolAttributes, jcr->fileset->MD5, jcr->spool_data, 
-             jcr->write_part_after_job, jcr->job->PreferMountedVolumes);
+             edit_int64(jcr->spool_size, ed2), jcr->write_part_after_job,
+             jcr->job->PreferMountedVolumes);
    Dmsg1(100, ">stored: %s\n", sd->msg);
    if (bget_dirmsg(sd) > 0) {
        Dmsg1(100, "<stored: %s", sd->msg);
index e54a97837a22a92c024200cc4e5a39e014b9040b..ad28b3485cdb63f760a1b06483053d0e8199469f 100644 (file)
@@ -247,6 +247,7 @@ public:
    int replace;                       /* Replace option */
    int NumVols;                       /* Number of Volume used in pool */
    int reschedule_count;              /* Number of times rescheduled */
+   int64_t spool_size;                /* Spool size for this job */
    bool spool_data;                   /* Spool data in SD */
    bool acquired_resource_locks;      /* set if resource locks acquired */
    bool term_wait_inited;             /* Set when cond var inited */
@@ -323,6 +324,7 @@ public:
    bool ignore_label_errors;          /* ignore Volume label errors */
    bool spool_attributes;             /* set if spooling attributes */
    bool no_attributes;                /* set if no attributes wanted */
+   int64_t spool_size;                /* Spool size for this job */
    bool spool_data;                   /* set to spool data */
    int CurVol;                        /* Current Volume count */
    DIRRES* director;                  /* Director resource */
index 20cac300a1f438f89f505e561b4305d7e20fe597..e5cad381bb8450991c80ab6961aa3e1773f02458 100644 (file)
@@ -644,7 +644,12 @@ DCR *new_dcr(JCR *jcr, DCR *dcr, DEVICE *dev)
       if (dcr->attached_to_dev) {
          detach_dcr_from_dev(dcr);
       }
-      dcr->max_job_spool_size = dev->device->max_job_spool_size;
+      /* Use job spoolsize prior to device spoolsize */
+      if (jcr->spool_size) {
+         dcr->max_job_spool_size = jcr->spool_size;
+      } else {
+         dcr->max_job_spool_size = dev->device->max_job_spool_size;
+      }
       dcr->device = dev->device;
       dcr->dev = dev;
       attach_dcr_to_dev(dcr);
index 79b7aa58a56bdff968099050e794fd23479e9a06..965c197bea3ecd947bdb6fcee4e0ec660f21ba47 100644 (file)
@@ -49,7 +49,7 @@ extern bool do_mac(JCR *jcr);
 /* Requests from the Director daemon */
 static char jobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
       "type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
-      "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d\n";
+      "SpoolData=%d SpoolSize=%s WritePartAfterJob=%d PreferMountedVols=%d\n";
 
 
 /* Responses sent to Director daemon */
@@ -73,6 +73,7 @@ bool job_cmd(JCR *jcr)
 {
    int JobId;
    char auth_key[100];
+   char spool_size[30];
    char seed[100];
    BSOCK *dir = jcr->dir_bsock;
    POOL_MEM job_name, client_name, job, fileset_name, fileset_md5;
@@ -88,9 +89,9 @@ bool job_cmd(JCR *jcr)
    stat = sscanf(dir->msg, jobcmd, &JobId, job.c_str(), job_name.c_str(),
               client_name.c_str(),
               &JobType, &level, fileset_name.c_str(), &no_attributes,
-              &spool_attributes, fileset_md5.c_str(), &spool_data, 
+              &spool_attributes, fileset_md5.c_str(), &spool_data, spool_size,
               &write_part_after_job, &PreferMountedVols);
-   if (stat != 13) {
+   if (stat != 14) {
       pm_strcpy(jcr->errmsg, dir->msg);
       dir->fsend(BAD_job, stat, jcr->errmsg);
       Dmsg1(100, ">dird: %s", dir->msg);
@@ -125,6 +126,7 @@ bool job_cmd(JCR *jcr)
    jcr->no_attributes = no_attributes;
    jcr->spool_attributes = spool_attributes;
    jcr->spool_data = spool_data;
+   jcr->spool_size = str_to_int64(spool_size);
    jcr->write_part_after_job = write_part_after_job;
    jcr->fileset_md5 = get_pool_memory(PM_NAME);
    pm_strcpy(jcr->fileset_md5, fileset_md5);
index 6d7d711f7c192856e740281ad0c77a7021eed3a9..ac6843319f90823f236d910d50961c9a03521fbc 100644 (file)
@@ -1,6 +1,10 @@
               Technical notes on version 2.3
 
 General:
+30Sep07
+ebl  Add an option that permit to specify spool size in job
+     definition. (Applying patches/testing/spoolsize_per_job.patch).
+     You must upgrade SD and DIR at the same time.
 28Sep07
 kes  Fix race condition that drops final block written to volume.
      This happens in rare cases with multiple simultaneous jobs