]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/spoolsize_per_job.patch
ebl Add a patch to add a Product column to Version table
[bacula/bacula] / bacula / patches / testing / spoolsize_per_job.patch
1 Index: src/dird/msgchan.c
2 ===================================================================
3 --- src/dird/msgchan.c  (revision 5108)
4 +++ src/dird/msgchan.c  (working copy)
5 @@ -51,7 +51,7 @@
6  /* Commands sent to Storage daemon */
7  static char jobcmd[]     = "JobId=%s job=%s job_name=%s client_name=%s "
8     "type=%d level=%d FileSet=%s NoAttr=%d SpoolAttr=%d FileSetMD5=%s "
9 -   "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d\n";
10 +   "SpoolData=%d SpoolSize=%s WritePartAfterJob=%d PreferMountedVols=%d\n";
11  static char use_storage[] = "use storage=%s media_type=%s pool_name=%s "
12     "pool_type=%s append=%d copy=%d stripe=%d\n";
13  static char use_device[] = "use device=%s\n";
14 @@ -157,7 +157,7 @@
15     POOL_MEM job_name, client_name, fileset_name;
16     int copy = 0;
17     int stripe = 0;
18 -   char ed1[30];
19 +   char ed1[30], ed2[30];
20  
21     sd = jcr->store_bsock;
22     /*
23 @@ -186,8 +186,9 @@
24                job_name.c_str(), client_name.c_str(), 
25                jcr->JobType, jcr->JobLevel,
26                fileset_name.c_str(), !jcr->pool->catalog_files,
27 -              jcr->job->SpoolAttributes, jcr->fileset->MD5, jcr->spool_data, 
28 -              jcr->write_part_after_job, jcr->job->PreferMountedVolumes);
29 +              jcr->job->SpoolAttributes, jcr->fileset->MD5, jcr->spool_data,
30 +              edit_int64(jcr->spool_size, ed2), jcr->write_part_after_job, 
31 +              jcr->job->PreferMountedVolumes);
32     Dmsg1(100, ">stored: %s\n", sd->msg);
33     if (bget_dirmsg(sd) > 0) {
34         Dmsg1(100, "<stored: %s", sd->msg);
35 Index: src/dird/job.c
36 ===================================================================
37 --- src/dird/job.c      (revision 5108)
38 +++ src/dird/job.c      (working copy)
39 @@ -927,6 +927,7 @@
40     jcr->fileset = job->fileset;
41     jcr->messages = job->messages;
42     jcr->spool_data = job->spool_data;
43 +   jcr->spool_size = job->spool_size;
44     jcr->write_part_after_job = job->write_part_after_job;
45     if (jcr->RestoreBootstrap) {
46        free(jcr->RestoreBootstrap);
47 Index: src/dird/dird_conf.c
48 ===================================================================
49 --- src/dird/dird_conf.c        (revision 5108)
50 +++ src/dird/dird_conf.c        (working copy)
51 @@ -295,6 +295,7 @@
52     {"enabled",     store_bool, ITEM(res_job.enabled), 0, ITEM_DEFAULT, true},
53     {"spoolattributes",store_bool, ITEM(res_job.SpoolAttributes), 0, ITEM_DEFAULT, false},
54     {"spooldata",   store_bool, ITEM(res_job.spool_data), 0, ITEM_DEFAULT, false},
55 +   {"spoolsize",   store_size, ITEM(res_job.spool_size), 0, 0, 0},
56     {"rerunfailedlevels",   store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
57     {"prefermountedvolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
58     {"runbeforejob", store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
59 @@ -600,6 +601,9 @@
60           res->res_job.RescheduleOnError, res->res_job.RescheduleTimes,
61           edit_uint64_with_commas(res->res_job.RescheduleInterval, ed1),
62           res->res_job.spool_data, res->res_job.write_part_after_job);
63 +      if (res->res_job.spool_size) {
64 +         sendit(sock, _("     SpoolSize=%s\n"),        edit_uint64(res->res_job.spool_size, ed1));
65 +      }
66        if (res->res_job.JobType == JT_MIGRATE) {
67           sendit(sock, _("     SelectionType=%d\n"), res->res_job.selection_type);
68        }
69 Index: src/dird/dird_conf.h
70 ===================================================================
71 --- src/dird/dird_conf.h        (revision 5108)
72 +++ src/dird/dird_conf.h        (working copy)
73 @@ -380,6 +380,7 @@
74     utime_t RescheduleInterval;        /* Reschedule interval */
75     utime_t JobRetention;              /* job retention period in seconds */
76     uint32_t MaxConcurrentJobs;        /* Maximum concurrent jobs */
77 +   int64_t spool_size;                /* Size of spool file for this job */
78     int RescheduleTimes;               /* Number of times to reschedule job */
79     bool RescheduleOnError;            /* Set to reschedule on error */
80     bool PrefixLinks;                  /* prefix soft links with Where path */
81 Index: src/stored/job.c
82 ===================================================================
83 --- src/stored/job.c    (revision 5108)
84 +++ src/stored/job.c    (working copy)
85 @@ -49,7 +49,7 @@
86  /* Requests from the Director daemon */
87  static char jobcmd[] = "JobId=%d job=%127s job_name=%127s client_name=%127s "
88        "type=%d level=%d FileSet=%127s NoAttr=%d SpoolAttr=%d FileSetMD5=%127s "
89 -      "SpoolData=%d WritePartAfterJob=%d PreferMountedVols=%d\n";
90 +      "SpoolData=%d SpoolSize=%s WritePartAfterJob=%d PreferMountedVols=%d\n";
91  
92  
93  /* Responses sent to Director daemon */
94 @@ -73,6 +73,7 @@
95  {
96     int JobId;
97     char auth_key[100];
98 +   char spool_size[30];
99     BSOCK *dir = jcr->dir_bsock;
100     POOL_MEM job_name, client_name, job, fileset_name, fileset_md5;
101     int JobType, level, spool_attributes, no_attributes, spool_data;
102 @@ -87,9 +88,9 @@
103     stat = sscanf(dir->msg, jobcmd, &JobId, job.c_str(), job_name.c_str(),
104                client_name.c_str(),
105                &JobType, &level, fileset_name.c_str(), &no_attributes,
106 -              &spool_attributes, fileset_md5.c_str(), &spool_data, 
107 +              &spool_attributes, fileset_md5.c_str(), &spool_data, spool_size,
108                &write_part_after_job, &PreferMountedVols);
109 -   if (stat != 13) {
110 +   if (stat != 14) {
111        pm_strcpy(jcr->errmsg, dir->msg);
112        bnet_fsend(dir, BAD_job, stat, jcr->errmsg);
113        Dmsg1(100, ">dird: %s", dir->msg);
114 @@ -124,6 +125,7 @@
115     jcr->no_attributes = no_attributes;
116     jcr->spool_attributes = spool_attributes;
117     jcr->spool_data = spool_data;
118 +   jcr->spool_size = str_to_int64(spool_size);
119     jcr->write_part_after_job = write_part_after_job;
120     jcr->fileset_md5 = get_pool_memory(PM_NAME);
121     pm_strcpy(jcr->fileset_md5, fileset_md5);
122 Index: src/stored/acquire.c
123 ===================================================================
124 --- src/stored/acquire.c        (revision 5108)
125 +++ src/stored/acquire.c        (working copy)
126 @@ -609,7 +609,12 @@
127        if (dcr->attached_to_dev) {
128           detach_dcr_from_dev(dcr);
129        }
130 -      dcr->max_job_spool_size = dev->device->max_job_spool_size;
131 +      /* Use job spoolsize prior to device spoolsize*/
132 +      if (jcr->spool_size) {
133 +        dcr->max_job_spool_size = jcr->spool_size;
134 +      } else {
135 +        dcr->max_job_spool_size = dev->device->max_job_spool_size;
136 +      }
137        dcr->device = dev->device;
138        dcr->dev = dev;
139        attach_dcr_to_dev(dcr);
140 Index: src/jcr.h
141 ===================================================================
142 --- src/jcr.h   (revision 5108)
143 +++ src/jcr.h   (working copy)
144 @@ -246,6 +246,7 @@
145     int replace;                       /* Replace option */
146     int NumVols;                       /* Number of Volume used in pool */
147     int reschedule_count;              /* Number of times rescheduled */
148 +   int64_t spool_size;                /* Spool size for this job */
149     bool spool_data;                   /* Spool data in SD */
150     bool acquired_resource_locks;      /* set if resource locks acquired */
151     bool term_wait_inited;             /* Set when cond var inited */
152 @@ -323,6 +324,7 @@
153     bool spool_attributes;             /* set if spooling attributes */
154     bool no_attributes;                /* set if no attributes wanted */
155     bool spool_data;                   /* set to spool data */
156 +   int64_t spool_size;                /* Spool size for this job */
157     int CurVol;                        /* Current Volume count */
158     DIRRES* director;                  /* Director resource */
159     alist *write_store;                /* list of write storage devices sent by DIR */