Your message dated Thu, 21 Apr 2011 08:55:49 +0200
with message-id <20110421065548.ga22...@co.mobile.jhr-online.de>
and subject line Re: [pkg-bacula-devel] Bug#606262: Bug#606262: 
bacula-director-mysql lenny to squeeze database upgrade fail
has caused the Debian Bug report #606262,
regarding bacula-director-mysql lenny to squeeze database upgrade fail
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
606262: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=606262
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: bacula-director-mysql
Version: 5.0.2-2, 5.0.2-1

The included script upgrades from database format version 11 to version 12. Unfortunately Debian lenny has bacula 2.4.4, which is version 10. We were able to get around this by downloading the source to bacula 3.0 and running the version 10 to 11 script manually ourselves.

/usr/share/bacula-director/update_mysql_tables
echo " "
echo "This script will update a Bacula MySQL database from version 11 to 12"
echo " which is needed to convert from Bacula Enterprise 2.6 to 4.0 or "
echo " Standard version 3.0 to 5.0"
echo " "
What is needed is a script that upgrades 10 to 12. I'm including the one I wrote. The upgrade for the bacula-director-mysql should really call this script or something similar.


#!/bin/sh
#
# Shell script to update MySQL tables from version 2.0 to 5.0
#
echo " "
echo "This script will update a Bacula MySQL database from version 10 to 12"
echo " which is needed to convert from Bacula version 2.0.x to 5.0"
echo " "
bindir=@SQL_BINDIR@
db_name=@db_name@

if $bindir/mysql $* -f <<END-OF-DATA
USE ${db_name};

-- Fix bad index on Media table
DROP INDEX inx8 ON Media;
CREATE UNIQUE INDEX inx8 ON Media (VolumeName(128));
ALTER TABLE File CHANGE FileId FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE BaseFiles CHANGE FileId FileId BIGINT UNSIGNED NOT NULL;
ALTER TABLE Job ADD ReadBytes BIGINT UNSIGNED DEFAULT 0 AFTER JobBytes; 
ALTER TABLE Media ADD ActionOnPurge TINYINT DEFAULT 0 AFTER Recycle;
ALTER TABLE Pool ADD ActionOnPurge TINYINT DEFAULT 0 AFTER Recycle;

-- If you have already this table, you can remove it with:
-- DROP TABLE JobHistory;

-- Create a table like Job for long term statistics
CREATE TABLE JobHisto (
   JobId INTEGER UNSIGNED NOT NULL,
   Job TINYBLOB NOT NULL,
   Name TINYBLOB NOT NULL,
   Type BINARY(1) NOT NULL,
   Level BINARY(1) NOT NULL,
   ClientId INTEGER DEFAULT 0,
   JobStatus BINARY(1) NOT NULL,
   SchedTime DATETIME DEFAULT 0,
   StartTime DATETIME DEFAULT 0,
   EndTime DATETIME DEFAULT 0,
   RealEndTime DATETIME DEFAULT 0,
   JobTDate BIGINT UNSIGNED DEFAULT 0,
   VolSessionId INTEGER UNSIGNED DEFAULT 0,
   VolSessionTime INTEGER UNSIGNED DEFAULT 0,
   JobFiles INTEGER UNSIGNED DEFAULT 0,
   JobBytes BIGINT UNSIGNED DEFAULT 0,
   ReadBytes BIGINT UNSIGNED DEFAULT 0,
   JobErrors INTEGER UNSIGNED DEFAULT 0,
   JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
   PoolId INTEGER UNSIGNED DEFAULT 0,
   FileSetId INTEGER UNSIGNED DEFAULT 0,
   PriorJobId INTEGER UNSIGNED DEFAULT 0,
   PurgedFiles TINYINT DEFAULT 0,
   HasBase TINYINT DEFAULT 0,
   INDEX (StartTime)
   );

ALTER TABLE JobMedia DROP Copy ;
ALTER TABLE Job ADD COLUMN HasCache tinyint default 0 after HasBase;
ALTER TABLE Job ADD COLUMN Reviewed tinyint default 0 after HasCache;
ALTER TABLE Job ADD COLUMN Comment BLOB AFTER Reviewed;
ALTER TABLE JobHisto ADD COLUMN HasCache tinyint default 0 after HasBase;
ALTER TABLE JobHisto ADD COLUMN Reviewed tinyint default 0 after HasCache;
ALTER TABLE JobHisto ADD COLUMN Comment BLOB AFTER Reviewed;

ALTER TABLE Status ADD COLUMN Severity int;
UPDATE Status SET Severity = 15;
UPDATE Status SET Severity = 100 where JobStatus = 'f';
UPDATE Status SET Severity = 90 where JobStatus = 'A';
UPDATE Status SET Severity = 10 where JobStatus = 'T';
UPDATE Status SET Severity = 20 where JobStatus = 'e';
UPDATE Status SET Severity = 25 where JobStatus = 'E';

CREATE TABLE PathHierarchy
(
     PathId integer NOT NULL,
     PPathId integer NOT NULL,
     CONSTRAINT pathhierarchy_pkey PRIMARY KEY (PathId)
);

CREATE INDEX pathhierarchy_ppathid 
          ON PathHierarchy (PPathId);

CREATE TABLE PathVisibility
(
      PathId integer NOT NULL,
      JobId integer NOT NULL,
      Size int8 DEFAULT 0,
      Files int4 DEFAULT 0,
      CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
);
CREATE INDEX pathvisibility_jobid
             ON PathVisibility (JobId);

CREATE INDEX basefiles_jobid_idx ON BaseFiles ( JobId );

DELETE FROM Version;
INSERT INTO Version (VersionId) VALUES (12);

END-OF-DATA
then
   echo "Update of Bacula MySQL tables succeeded."
else
   echo "Update of Bacula MySQL tables failed."
fi
exit 0

--- End Message ---
--- Begin Message ---
On Wed, Apr 20, 2011 at 07:51:11PM -0300, Julien Savoie wrote:
> All that said, it maybe better 'fall mode' behavior, or at least present
> us with a better error message.  Especially since dbc_dbadmin and
> dbc_dbname were set properly.  The upgrade runs as dbc_dbuser as I
> understand though.  It's an entirely moot point though, but in theory it
> could have run the upgrade as dbc_dbadmin rather than dbc_dbuser. 
> Anyways, this is a separate issue and my bug that the upgrade script
> doesn't work was in error.

Thanks for your answer!

Since I'm about to "rewrite" how config files are created and installed
in bacula packages anyways, I guess (and hope) that such issues won't
arise that easily anymore. Unfortunately, dbconfig-common is a PITA in
some corner cases but serves for a great deal of cases. Let's see if we
can improve the situation in later packages.

Good to see the upgrade path is clear, though.

Hauke

-- 
 .''`.   Jan Hauke Rahm <j...@debian.org>               www.jhr-online.de
: :'  :  Debian Developer                                 www.debian.org
`. `'`   Member of the Linux Foundation                    www.linux.com
  `-     Fellow of the Free Software Foundation Europe      www.fsfe.org

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to