~ubuntu-branches/ubuntu/maverick/bacula/maverick

« back to all changes in this revision

Viewing changes to patches/2.4.x/2.4.0-recycle.patch

  • Committer: Bazaar Package Importer
  • Author(s): Ante Karamatic
  • Date: 2009-01-10 04:57:41 UTC
  • mfrom: (3.1.4 lenny)
  • Revision ID: james.westby@ubuntu.com-20090110045741-s6k86vdrivghtfyd
Tags: 2.4.4-1ubuntu1
* Upload fixes LP #269251, LP: #308903 and LP: #293515
* debian/rules:
  - added bat_icon.png and bat.desktop for bacula-console-qt (LP: #314746)
  - added bacula-tray-monitor.xpm icon, fix Exec path in .desktop
* debian/bacula-traymonitor.install
  - remove bacula-tray-monitor.xpm, add bacula-tray-monitor.desktop
* Merge from debian unstable, remaining changes:
  * Store sd|fd|director passwords in debconf (LP: #222558)
    - added debian/bacula-common.templates
    - modified debian/bacula-common.postinst:
      + generate random passwords and store them in debconf
    - modified debian/bacula-[sd|fd|director-mysql|director-pgsql].postinst
      + read and set passwords from debconf
  * Daemons listen on all interfaces (LP: #286643)
  * Start daemons on installation
  * Build with generic XXX_*_XXX username, password and database name
    and replace it with dbconfig's settings in postinstall scripts
  * Drop mt-st to suggests. So that bacula goes back to main. (LP: #286528)
  * debian/rules: Disable fortify source since it was causing
    bacula-director to segfault.
  * debian/control:
    - Added libdbi-perl and libdb-mysql-perl to depends for
      bacula-director-mysql
      due to new postinst configuration.
    - Cleaned up bacula-director-pgsql dependenices and recommends.
    - Made mysql the default director to install bacula-director-{mysql|pgsql}
      added database handling to postinstall scripts and templates, modifiied
      postinstall script's sed expressions.
    - Removed libwgtk-2.6-dev as a build dependency; as a result
      bacula-console-wx isn't built anymore.
    - Install gawk if not installed. (LP: #207527)
  * debian/make_catalog_backup_awk.[mysql|pgsql|sqlite3|sqlite]:
    - New scripts for catalog backup. (CVE-2007-5626)
  * debian/bacula-console-wx:
    - Dropped since we are not building them anymore.
  * debian/bacula-director-common.bacula-director.init,
    debian/bacula-fd.init, debian/bacula-sd.init
    - Made more LSB specific.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
 This patch should fix (not tested) the recycling bug #1106 when using
 
3
 two autochangers.  There is a much smaller chance that it also fixes
 
4
 bug #1103 where a volume is recycled when it is full.    
 
5
 
 
6
 Apply the patch to version 2.4.0 with:
 
7
 
 
8
 cd <bacula-source>
 
9
 patch -p0 <2.4.0-recycle.patch
 
10
 ./configure <your-options>
 
11
 make
 
12
 ...
 
13
 make install
 
14
 
 
15
  
 
16
 
 
17
Index: src/dird/autoprune.c
 
18
===================================================================
 
19
--- src/dird/autoprune.c        (revision 7178)
 
20
+++ src/dird/autoprune.c        (working copy)
 
21
@@ -96,7 +96,7 @@
 
22
    POOL_MEM query(PM_MESSAGE);
 
23
    UAContext *ua;
 
24
    bool ok = false;
 
25
-   char ed1[50], ed2[100];
 
26
+   char ed1[50], ed2[100], ed3[50];
 
27
    POOL_DBR spr;
 
28
 
 
29
    Dmsg1(050, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
 
30
@@ -138,10 +138,18 @@
 
31
     *  RecyclePoolId is the current pool or the scratch pool
 
32
     */
 
33
    const char *select = "SELECT DISTINCT MediaId,LastWritten FROM Media WHERE "
 
34
-        "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' "
 
35
+        "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' %s"
 
36
         "ORDER BY LastWritten ASC,MediaId";
 
37
 
 
38
-   Mmsg(query, select, ed1, ed2, mr->MediaType);
 
39
+   if (InChanger) {
 
40
+      char changer[100];
 
41
+      /* Ensure it is in this autochanger */
 
42
+      bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
 
43
+         edit_int64(mr->StorageId, ed3));
 
44
+      Mmsg(query, select, ed1, ed2, mr->MediaType, changer);
 
45
+   } else {
 
46
+      Mmsg(query, select, ed1, ed2, mr->MediaType, "");
 
47
+   }
 
48
 
 
49
    Dmsg1(050, "query=%s\n", query.c_str());
 
50
    if (!db_get_query_dbids(ua->jcr, ua->db, query, ids)) {
 
51
Index: src/dird/recycle.c
 
52
===================================================================
 
53
--- src/dird/recycle.c  (revision 7178)
 
54
+++ src/dird/recycle.c  (working copy)
 
55
@@ -83,12 +83,19 @@
 
56
    const char *select =
 
57
           "SELECT MediaId,LastWritten FROM Media "
 
58
           "WHERE PoolId=%s AND Recycle=1 AND VolStatus='Purged' "
 
59
-          "AND Enabled=1 AND MediaType='%s' "
 
60
+          "AND Enabled=1 AND MediaType='%s' %s"
 
61
           "ORDER BY LastWritten ASC,MediaId LIMIT 1";
 
62
 
 
63
    Dmsg0(100, "Enter recycle_oldest_purged_volume\n");
 
64
    oldest.MediaId = 0;
 
65
-   Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType);
 
66
+   if (InChanger) {
 
67
+      char changer[100];
 
68
+      bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
 
69
+         edit_int64(mr->StorageId, ed1));
 
70
+      Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer);
 
71
+   } else {
 
72
+      Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");
 
73
+   }
 
74
 
 
75
    if (!db_sql_query(jcr->db, query, oldest_handler, (void *)&oldest)) {
 
76
       Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));