From: Kern Sibbald Date: Wed, 2 Mar 2005 14:40:59 +0000 (+0000) Subject: - Fix a few problems with the MySQL table create in 1.37. X-Git-Tag: Release-1.38.0~620 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6b6b30d5b4dba4db13840c649eb1e12725053aba;p=bacula%2Fbacula - Fix a few problems with the MySQL table create in 1.37. - Delete the new tables in the table delete files. - Increase the number of items permitted in a conf table. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1857 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 186742d3e2..9e798b2759 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -27,6 +27,13 @@ Suggestions for Preben: - Optimized bootstrap. Autochangers: +- Fix + Please use the "label" command to create a new Volume for: + Storage: DDS-4-changer + Media type: + Pool: Default + label + The defined Storage resources are: - Copy Changer Device and Changer Command from Autochanger to Device resource in SD if none given in Device resource. - Doc the following @@ -1267,4 +1274,3 @@ Block Position: 0 - Bootstrap from JobMedia records. - Implement WildFile and WildDir to solve problem of saving only *.doc files. - diff --git a/bacula/src/cats/drop_mysql_tables.in b/bacula/src/cats/drop_mysql_tables.in index 3c5fc9aaba..c9fe22ed1a 100644 --- a/bacula/src/cats/drop_mysql_tables.in +++ b/bacula/src/cats/drop_mysql_tables.in @@ -9,6 +9,9 @@ USE bacula; DROP TABLE IF EXISTS Filename; DROP TABLE IF EXISTS Path; DROP TABLE IF EXISTS LongName; +DROP TABLE IF EXISTS Device; +DROP TABLE IF EXISTS Storage; +DROP TABLE IF EXISTS MediaType; DROP TABLE IF EXISTS File; DROP TABLE IF EXISTS Client; DROP TABLE IF EXISTS Job; diff --git a/bacula/src/cats/drop_postgresql_tables.in b/bacula/src/cats/drop_postgresql_tables.in index ad3ec4a935..93fe437f73 100644 --- a/bacula/src/cats/drop_postgresql_tables.in +++ b/bacula/src/cats/drop_postgresql_tables.in @@ -19,6 +19,9 @@ drop table filename; drop table counters; drop table version; drop table CDImages; +drop table Devices; +drop table Storage; +drop table MediaType; END-OF-DATA then echo "Deletion of Bacula PostgreSQL tables succeeded." diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index 41ef3eff80..e1ce1ad9d4 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -46,6 +46,40 @@ CREATE TABLE File ( # INDEX (JobId, PathId, FilenameId) # +CREATE TABLE MediaType ( + MediaTypeId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + MediaType VARCHAR(128) NOT NULL, + ReadOnly TINYINT DEFAULT 0, + PRIMARY KEY(MediaTypeId) + ); + +CREATE TABLE Storage ( + StorageId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name VARCHAR(128) NOT NULL, + AutoChanger TINYINT DEFAULT 0, + PRIMARY KEY(StorageId) + ); + +CREATE TABLE Device ( + DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, + Name VARCHAR(128) NOT NULL, + MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType, + StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage, + DevMounts INTEGER UNSIGNED DEFAULT 0, + DevReadBytes BIGINT UNSIGNED DEFAULT 0, + DevWriteBytes BIGINT UNSIGNED DEFAULT 0, + DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevReadTime BIGINT UNSIGNED DEFAULT 0, + DevWriteTime BIGINT UNSIGNED DEFAULT 0, + DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, + CleaningDate DATETIME DEFAULT 0, + CleaningPeriod BIGINT UNSIGNED DEFAULT 0, + PRIMARY KEY(DeviceId) + ); + + CREATE TABLE Job ( JobId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Job TINYBLOB NOT NULL, @@ -125,7 +159,7 @@ CREATE TABLE Media ( MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0, MaxVolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0, InChanger TINYINT NOT NULL DEFAULT 0, - StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage, + StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage, MediaAddressing TINYINT NOT NULL DEFAULT 0, VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0, VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0, @@ -137,38 +171,6 @@ CREATE TABLE Media ( CREATE INDEX inx8 ON Media (PoolId); -CREATE TABLE MediaType ( - MediaTypeId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - MediaType VARCHAR(128) NOT NULL, - ReadOnly TINYINT DEFAULT 0, - PRIMARY KEY(MediaTypeId) - ); - -CREATE TABLE Storage ( - StorageId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - Name VARCHAR(128) NOT NULL, - AutoChanger TINYINT DEFAULT 0, - PRIMARY KEY(StorageId) - ); - -CREATE TABLE Device ( - DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - Name VARCHAR(128) NOT NULL, - MediaTypeId INTEGER UNSIGNED REFERENCES MediaType NOT NULL, - StorageId INTEGER UNSIGNED REFERENCES Storage, - DevMounts INTEGER UNSIGNED DEFAULT 0, - DevReadBytes BIGINT UNSIGNED DEFAULT 0, - DevWriteBytes BIGINT UNSIGNED DEFAULT 0, - DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, - DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0, - DevReadTime BIGINT UNSIGNED DEFAULT 0, - DevWriteTime BIGINT UNSIGNED DEFAULT 0, - DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, - DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0, - CleaningDate DATETIME DEFAULT 0, - CleaningPeriod BIGINT UNSIGNED DEFAULT 0, - PRIMARY KEY(DeviceId) - ); CREATE TABLE Pool ( diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 3e9199a1e4..dce673fd4a 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -150,7 +150,7 @@ bool update_device_res(JCR *jcr, DEVICE *dev) */ int start_storage_daemon_job(JCR *jcr, alist *store, int append) { - bool ok; + bool ok = false; STORE *storage; BSOCK *sd; char auth_key[100]; @@ -228,7 +228,6 @@ int start_storage_daemon_job(JCR *jcr, alist *store, int append) } } else { POOL_MEM err_msg; - ok = false; pm_strcpy(err_msg, sd->msg); /* save message */ Jmsg(jcr, M_WARNING, 0, _("\n" " Storage daemon didn't accept Device \"%s\" because:\n %s"), diff --git a/bacula/src/lib/parse_conf.h b/bacula/src/lib/parse_conf.h index 1bb1684b70..18a22261da 100644 --- a/bacula/src/lib/parse_conf.h +++ b/bacula/src/lib/parse_conf.h @@ -41,7 +41,7 @@ struct RES_ITEM { /* For storing name_addr items in res_items table */ #define ITEM(x) ((void **)&res_all.x) -#define MAX_RES_ITEMS 50 /* maximum resource items per RES */ +#define MAX_RES_ITEMS 70 /* maximum resource items per RES */ /* This is the universal header that is * at the beginning of every resource