]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.2.8-volstats.patch
ebl Add comments
[bacula/bacula] / bacula / patches / 2.2.8-volstats.patch
1
2  This patch fix a catalog query error while trying to update 
3  Volume information.  You can apply this patch if you have seen 
4  this error :
5
6  Error getting Volume info: 1990 Invalid Catalog Request: CatReq Job=ZOLTAN.2008-04-07_02.17.28 UpdateMedia 
7  VolName=IMG011 VolJobs=1 VolFiles=17 VolBlocks=247999 VolBytes=15998976000 VolMounts=2 VolErrors=0 
8  VolWrites=2609347 MaxVolBytes=0 EndTime=1207602760 VolStatus=Full Slot=2 relabel=0 InChanger=1 
9  VolReadTime=0 VolWriteTime=-2382413895 VolFirstWritten=0 VolParts=0 
10
11  Apply it to version 2.2.8 or earlier with:
12
13  cd <bacula-source>
14  patch -p0 <2.2.8-volstats.patch
15  ./configure <your-options>
16  make
17  ...
18  make install
19
20
21
22
23 Index: src/stored/askdir.c
24 ===================================================================
25 --- src/stored/askdir.c (rĂ©vision 6743)
26 +++ src/stored/askdir.c (copie de travail)
27 @@ -56,7 +56,7 @@
28     " VolBlocks=%lu VolBytes=%lld VolMounts=%lu VolErrors=%lu VolWrites=%lu"
29     " MaxVolBytes=%lld VolCapacityBytes=%lld VolStatus=%20s"
30     " Slot=%ld MaxVolJobs=%lu MaxVolFiles=%lu InChanger=%ld"
31 -   " VolReadTime=%lld VolWriteTime=%lld EndFile=%lu EndBlock=%lu"
32 +   " VolReadTime=%s VolWriteTime=%s EndFile=%lu EndBlock=%lu"
33     " VolParts=%lu LabelType=%ld MediaId=%lld\n";
34  
35  
36 @@ -167,6 +167,7 @@
37   */
38  static bool do_get_volume_info(DCR *dcr)
39  {
40 +    char ed_vrt[50], ed_vwt[50];
41      JCR *jcr = dcr->jcr;
42      BSOCK *dir = jcr->dir_bsock;
43      VOLUME_CAT_INFO vol;
44 @@ -187,7 +188,7 @@
45                 &vol.VolCatWrites, &vol.VolCatMaxBytes,
46                 &vol.VolCatCapacityBytes, vol.VolCatStatus,
47                 &vol.Slot, &vol.VolCatMaxJobs, &vol.VolCatMaxFiles,
48 -               &InChanger, &vol.VolReadTime, &vol.VolWriteTime,
49 +               &InChanger, ed_vrt, ed_vwt,
50                 &vol.EndFile, &vol.EndBlock, &vol.VolCatParts,
51                 &vol.LabelType, &vol.VolMediaId);
52      if (n != 22) {
53 @@ -196,6 +197,8 @@
54         Mmsg(jcr->errmsg, _("Error getting Volume info: %s"), dir->msg);
55         return false;
56      }
57 +    vol.VolReadTime = str_to_int64(ed_vrt);
58 +    vol.VolWriteTime = str_to_int64(ed_vwt);
59      vol.InChanger = InChanger;        /* bool in structure */
60      unbash_spaces(vol.VolCatName);
61      bstrncpy(dcr->VolumeName, vol.VolCatName, sizeof(dcr->VolumeName));
62 Index: src/dird/catreq.c
63 ===================================================================
64 --- src/dird/catreq.c   (rĂ©vision 6743)
65 +++ src/dird/catreq.c   (copie de travail)
66 @@ -56,7 +56,7 @@
67  static char Update_media[] = "CatReq Job=%127s UpdateMedia VolName=%s"
68     " VolJobs=%u VolFiles=%u VolBlocks=%u VolBytes=%" lld " VolMounts=%u"
69     " VolErrors=%u VolWrites=%u MaxVolBytes=%" lld " EndTime=%d VolStatus=%10s"
70 -   " Slot=%d relabel=%d InChanger=%d VolReadTime=%" lld " VolWriteTime=%" lld
71 +   " Slot=%d relabel=%d InChanger=%d VolReadTime=%s VolWriteTime=%s"
72     " VolFirstWritten=%" lld " VolParts=%u\n";
73  
74  static char Create_job_media[] = "CatReq Job=%127s CreateJobMedia "
75 @@ -103,6 +103,7 @@
76  
77  void catalog_request(JCR *jcr, BSOCK *bs)
78  {
79 +   char ed_vrt[50], ed_vwt[50];
80     MEDIA_DBR mr, sdmr;
81     JOBMEDIA_DBR jm;
82     char Job[MAX_NAME_LENGTH];
83 @@ -218,8 +219,11 @@
84        &sdmr.VolJobs, &sdmr.VolFiles, &sdmr.VolBlocks, &sdmr.VolBytes,
85        &sdmr.VolMounts, &sdmr.VolErrors, &sdmr.VolWrites, &sdmr.MaxVolBytes,
86        &sdmr.LastWritten, &sdmr.VolStatus, &sdmr.Slot, &label, &sdmr.InChanger,
87 -      &sdmr.VolReadTime, &sdmr.VolWriteTime, &VolFirstWritten,
88 +      ed_vrt, ed_vwt, &VolFirstWritten,
89        &sdmr.VolParts) == 19) {
90 +      
91 +      sdmr.VolReadTime = str_to_int64(ed_vrt);
92 +      sdmr.VolWriteTime = str_to_int64(ed_vwt);
93  
94        db_lock(jcr->db);
95        Dmsg3(400, "Update media %s oldStat=%s newStat=%s\n", sdmr.VolumeName,