From: Kern Sibbald Date: Sat, 22 Jul 2006 12:50:23 +0000 (+0000) Subject: - Tweak catalog make scripts. X-Git-Tag: Release-7.0.0~7851 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a3a62ac76a17b760763ce764d36589c41264e5a4;p=bacula%2Fbacula - Tweak catalog make scripts. - Fix catalog upgrade scripts so that they work. - Correct despooling debug code to eliminate race condition. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3167 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 9b6b693c71..3a1c4d1e6d 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -19,6 +19,10 @@ Document: workaround: specify absolute working and pid directory in bacula-fd.conf (e.g. c:\bacula\working instead of \bacula\working). +- Document techniques for restoring large numbers of files. +- Document setting my.cnf to big file usage. +- Add example of proper index output to doc. + show index from File; Priority: @@ -26,14 +30,7 @@ For 1.39: - Remove queue.c code. - Correct the Include syntax in the m4.xxx files in examples/conf - Get Perl replacement for bregex.c -- Make base64.c (bin_to_base64) take a buffer length - argument to avoid overruns. - and verify that other buffers cannot overrun. -- Implement VolumeState as discussed with Arno. -- Document techniques for restoring large numbers of files. -- Document setting my.cnf to big file usage. -- Add example of proper index output to doc. - show index from File; +- Fix auth compatibility with 1.38 - Fix re-read of last block to check if job has actually written a block, and check if block was written by a different job (i.e. multiple simultaneous jobs writing). @@ -42,15 +39,6 @@ For 1.39: Volume marked as purged. - Print warning message if LANG environment variable does not specify UTF-8. -- Add LocationId to update volume -- Add LocationLog - LogId - Date - User text - MediaId - LocationId - NewState??? -- Add Comment to Media record - New dot commands from Arno. .update volume [enabled|disabled|*see below] > However, I could easily imagine an option to "update slots" that says @@ -1621,3 +1609,17 @@ Block Position: 0 - Make Dir and SD authentication errors single threaded. - Install man pages - Fix catreq.c digestbuf at line 411 in src/dird/catreq.c +- Make base64.c (bin_to_base64) take a buffer length + argument to avoid overruns. + and verify that other buffers cannot overrun. +- Implement VolumeState as discussed with Arno. +- Add LocationId to update volume +- Add LocationLog + LogId + Date + User text + MediaId + LocationId + NewState??? +- Add Comment to Media record + diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 07c415b40f..c616351a8c 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,14 +2,18 @@ Kern Sibbald General: -19July06 +22Jul06 +- Tweak catalog make scripts. +- Fix catalog upgrade scripts so that they work. +- Correct despooling debug code to eliminate race condition. +19Jul06 - Add additional fields as specified by Arno to LocationLog. - Add comment field to the Media record. - Add Time field to the Log record. - Correct migration SQL (thanks to Bill Moran) so that it runs with PostgreSQL also. - Add spooling/despooling info in status output of SD. -17July06 +17Jul06 - Spend a lot of time integrating mkcdrec with the rescue disk. - Add VOLMGMT message class for volume management messages (none yet). - Add CATALOG as a destination. It goes into the LOG table. diff --git a/bacula/src/cats/drop_mysql_tables.in b/bacula/src/cats/drop_mysql_tables.in index f828ef0af0..fbe8727407 100644 --- a/bacula/src/cats/drop_mysql_tables.in +++ b/bacula/src/cats/drop_mysql_tables.in @@ -28,7 +28,9 @@ DROP TABLE IF EXISTS UnsavedFiles; DROP TABLE IF EXISTS CDImages; DROP TABLE IF EXISTS Status; DROP TABLE IF EXISTS MAC; +DROP TABLE IF EXISTS Log; DROP TABLE IF EXISTS Location; +DROP TABLE IF EXISTS LocationLog; END-OF-DATA then echo "Deletion of Bacula MySQL tables succeeded." diff --git a/bacula/src/cats/drop_postgresql_tables.in b/bacula/src/cats/drop_postgresql_tables.in index f59669e6f1..ab5f59a137 100644 --- a/bacula/src/cats/drop_postgresql_tables.in +++ b/bacula/src/cats/drop_postgresql_tables.in @@ -24,7 +24,9 @@ drop table Storage; drop table MediaType; drop table Status; drop table MAC; +drop table log; drop table Location; +drop table locationlog; END-OF-DATA pstat=$? if test $pstat = 0; diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index b9899fff6d..0c1ce16324 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -127,8 +127,8 @@ CREATE TABLE LocationLog ( LocLogId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Date DATETIME DEFAULT 0, Comment BLOB NOT NULL, - MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media; - LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES LocationId; + MediaId INTEGER UNSIGNED DEFAULT 0 REFERENCES Media, + LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location, NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, NewEnabled TINYINT, @@ -257,7 +257,7 @@ CREATE TABLE Client ( CREATE TABLE Log ( LogId INTEGER UNSIGNED AUTO_INCREMENT, - JobId INTEGER INTEGER UNSIGNED DEFAULT 0 REFERENCES JobId, + JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job, Time DATETIME DEFAULT 0, LogText BLOB NOT NULL, PRIMARY KEY(LogId), diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index a10925554d..6f24d6b377 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -264,7 +264,7 @@ CREATE TABLE LocationLog ( MediaId INTEGER DEFAULT 0, LocationId INTEGER DEFAULT 0, newvolstatus text not null - check (volstatus in ('Full','Archive','Append', + check (newvolstatus in ('Full','Archive','Append', 'Recycle','Purged','Read-Only','Disabled', 'Error','Busy','Used','Cleaning','Scratch')), newenabled smallint, diff --git a/bacula/src/cats/make_sqlite3_tables.in b/bacula/src/cats/make_sqlite3_tables.in index 4583b85557..4df3610ed2 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -76,7 +76,7 @@ CREATE INDEX inx6 ON Job (Name); CREATE TABLE Location ( LocationId INTEGER, - Location TINYBLOB NOT NULL, + Location TEXT NOT NULL, Cost INTEGER DEFAULT 0, Enabled TINYINT, PRIMARY KEY(LocationId) diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index 4583b85557..4df3610ed2 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -76,7 +76,7 @@ CREATE INDEX inx6 ON Job (Name); CREATE TABLE Location ( LocationId INTEGER, - Location TINYBLOB NOT NULL, + Location TEXT NOT NULL, Cost INTEGER DEFAULT 0, Enabled TINYINT, PRIMARY KEY(LocationId) diff --git a/bacula/src/cats/update_mysql_tables.in b/bacula/src/cats/update_mysql_tables.in index 52271b92d8..bdb5a213e1 100755 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -3,7 +3,8 @@ # Shell script to update MySQL tables from version 1.38 to 1.39 # echo " " -echo "This script will update a Bacula MySQL database from version 9 to 9" +echo "This script will update a Bacula SQLite database from version 9 to 10" +echo " which is needed to convert from Bacula version 1.38.x to 1.39.x or higher" echo "Depending on the size of your database," echo "this script may take several minutes to run." echo " " @@ -12,50 +13,55 @@ bindir=@SQL_BINDIR@ if $bindir/mysql $* -f <db, &jcr->jr, &jcr->stime)) { /* No job found, so upgrade this one to Full */ Jmsg(jcr, M_INFO, 0, "%s", db_strerror(jcr->db)); - Jmsg(jcr, M_INFO, 0, _("No prior or suitable Full backup found. Doing FULL backup.\n")); + Jmsg(jcr, M_INFO, 0, _("No prior or suitable Full backup found in catalog. Doing FULL backup.\n")); bsnprintf(since, since_len, _(" (upgraded from %s)"), level_to_str(jcr->JobLevel)); jcr->JobLevel = jcr->jr.JobLevel = L_FULL; } else { if (jcr->job->rerun_failed_levels) { if (db_find_failed_job_since(jcr, jcr->db, &jcr->jr, jcr->stime, JobLevel)) { - Jmsg(jcr, M_INFO, 0, _("Prior failed job found. Upgrading to %s.\n"), + Jmsg(jcr, M_INFO, 0, _("Prior failed job found in catalog. Upgrading to %s.\n"), level_to_str(JobLevel)); bsnprintf(since, since_len, _(" (upgraded from %s)"), level_to_str(jcr->JobLevel)); diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index f7c26c9180..929726b7b8 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -400,6 +400,7 @@ public: bool spool_data; /* set to spool data */ bool spooling; /* set when actually spooling */ bool despooling; /* set when despooling */ + bool despool_wait; /* waiting for despooling */ bool dev_locked; /* set if dev already locked */ bool NewVol; /* set if new Volume mounted */ bool WroteVol; /* set if Volume written */ diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index dd22f26bb1..62675c67c2 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -207,9 +207,11 @@ static bool despool_data(DCR *dcr, bool commit) Jmsg(jcr, M_INFO, 0, _("Writing spooled data to Volume. Despooling %s bytes ...\n"), edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1)); } + dcr->despool_wait = true; dcr->spooling = false; - dcr->despooling = true; lock_device(dcr->dev); + dcr->despool_wait = false; + dcr->despooling = true; dcr->dev_locked = true; /* @@ -282,10 +284,10 @@ static bool despool_data(DCR *dcr, bool commit) rdcr->jcr = NULL; free_dcr(rdcr); free(rdev); - unlock_device(dcr->dev); dcr->dev_locked = false; dcr->spooling = true; /* turn on spooling again */ dcr->despooling = false; + unlock_device(dcr->dev); return ok; } diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 2a951e6cbb..404f47ae02 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -307,8 +307,8 @@ static void list_running_jobs(BSOCK *user) dcr->pool_name, dcr->dev?dcr->dev->print_name(): dcr->device->device_name); - bnet_fsend(user, _(" spooling=%d despooling=%d devblocked=%d\n"), - dcr->spooling, dcr->despooling, dcr->dev->dev_blocked); + bnet_fsend(user, _(" spooling=%d despooling=%d despool_wait=%d\n"), + dcr->spooling, dcr->despooling, dcr->despool_wait); } sec = time(NULL) - jcr->run_time; if (sec <= 0) { diff --git a/bacula/src/version.h b/bacula/src/version.h index ff7aca9b55..54eac9bcda 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.16" -#define BDATE "19 July 2006" -#define LSMDATE "19Jul06" +#define BDATE "22 July 2006" +#define LSMDATE "22Jul06" /* Debug flags */ #undef DEBUG