2 This patch will fix a subtle bug that was introduced in 1.36.2
3 which causes Bacula to be very slow restoring a few files. This
4 is because it reads completely to the end of the Volume rather
5 than stopping when all the files on the Volume are loaded. The
6 introduction of the bug was caused by a patch that fixed
7 Bacula truncating tapes after a restore.
9 Apply the patch to 1.36.2 with the following:
12 patch -p0 <1.36.2-restore-speed.patch
16 Note that all source files will be rebuilt during the make.
19 ===================================================================
20 RCS file: /cvsroot/bacula/bacula/src/jcr.h,v
21 retrieving revision 1.76.4.1
22 diff -u -u -b -r1.76.4.1 jcr.h
23 --- src/jcr.h 27 Feb 2005 21:53:28 -0000 1.76.4.1
24 +++ src/jcr.h 17 Mar 2005 14:14:18 -0000
27 /* Parmaters for Open Read Session */
28 BSR *bsr; /* Bootstrap record -- has everything */
29 + bool mount_next_volume; /* set to cause next volume mount */
30 uint32_t read_VolSessionId;
31 uint32_t read_VolSessionTime;
32 uint32_t read_StartFile;
33 Index: src/stored/read_record.c
34 ===================================================================
35 RCS file: /cvsroot/bacula/bacula/src/stored/read_record.c,v
36 retrieving revision 1.47.4.1
37 diff -u -u -b -r1.47.4.1 read_record.c
38 --- src/stored/read_record.c 15 Feb 2005 11:51:04 -0000 1.47.4.1
39 +++ src/stored/read_record.c 17 Mar 2005 14:14:18 -0000
41 * archive. It uses a callback to pass you each record in turn,
42 * as well as a callback for mounting the next tape. It takes
43 * care of reading blocks, applying the bsr, ...
44 + * Note, this routine is really the heart of the restore routines,
45 + * and we are *really* bit pushing here so be careful about making
46 + * any modifications.
48 * Kern E. Sibbald, August MMII
54 - Copyright (C) 2000-2004 Kern Sibbald and John Walker
55 + Copyright (C) 2000-2005 Kern Sibbald
57 This program is free software; you can redistribute it and/or
58 modify it under the terms of the GNU General Public License as
61 recs = New(dlist(rec, &rec->link));
62 position_to_first_file(jcr, dev);
63 + jcr->mount_next_volume = false;
65 for ( ; ok && !done; ) {
66 if (job_canceled(jcr)) {
68 if (!read_block_from_device(dcr, CHECK_BLOCK_NUMBERS)) {
70 DEV_RECORD *trec = new_record();
72 Jmsg(jcr, M_INFO, 0, "End of Volume at file %u on device %s, Volume \"%s\"\n",
73 dev->file, dev_name(dev), dcr->VolumeName);
75 Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
77 + ok = false; /* Stop everything */
79 * Create EOT Label so that Media record may
80 * be properly updated because this is the last
82 trec->File = dev->file;
83 ok = record_cb(dcr, trec);
85 + if (jcr->mount_next_volume) {
86 + jcr->mount_next_volume = false;
87 + dev->state &= ~ST_EOT;
91 + jcr->mount_next_volume = false;
93 * We just have a new tape up, now read the label (first record)
94 * and pass it off to the callback routine, then continue
96 display_tape_error_status(jcr, dev);
97 if (forge_on || jcr->ignore_label_errors) {
98 fsr_dev(dev, 1); /* try skipping bad record */
99 - Dmsg0(000, "Did fsr\n");
100 + Pmsg0(000, "Did fsr\n");
101 continue; /* try to continue */
104 + ok = false; /* stop everything */
109 Dmsg2(300, "Current postion (file:block) %d:%d\n",
110 dev->file, dev->block_num);
111 jcr->bsr->mount_next_volume = false;
112 -// dev->state |= ST_EOT;
113 + if (!dev->at_eot()) {
114 + /* Set EOT flag to force mount of next Volume */
115 + jcr->mount_next_volume = true;
116 + dev->state |= ST_EOT;