From bcaf435f5b1811182b4092d7316ef305766c890f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 19 Jul 2006 11:03:20 +0000 Subject: [PATCH] 19July06 - 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 - 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. - Implement the Log table in the DB. - Implement the Location Log table in the DB (for user use). - At Eric's request add a run_scripts() just after blast_data in src/filed/job.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3161 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 18 ++++++++++++- bacula/kes-1.39 | 15 +++++++++++ bacula/src/cats/make_mysql_tables.in | 19 +++++++++++++- bacula/src/cats/make_postgresql_tables.in | 21 ++++++++++++++-- bacula/src/cats/make_sqlite3_tables.in | 28 ++++++++++++++++----- bacula/src/cats/make_sqlite_tables.in | 28 ++++++++++++++++----- bacula/src/cats/update_mysql_tables.in | 19 +++++++++++++- bacula/src/cats/update_postgresql_tables.in | 22 ++++++++++++++-- bacula/src/cats/update_sqlite3_tables.in | 19 ++++++++++++-- bacula/src/cats/update_sqlite_tables.in | 19 ++++++++++++-- bacula/src/dird/migrate.c | 8 +++--- bacula/src/filed/job.c | 4 +-- bacula/src/lib/message.c | 5 ++-- bacula/src/lib/parse_conf.c | 3 +++ bacula/src/stored/dev.h | 1 + bacula/src/stored/spool.c | 11 +++++--- bacula/src/stored/status.c | 2 ++ bacula/src/version.h | 4 +-- 18 files changed, 210 insertions(+), 36 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index adf57fb016..9b6b693c71 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,5 +1,5 @@ Kern's ToDo List - 20 June 2006 + 16 July 2006 Major development: Project Developer @@ -42,8 +42,23 @@ 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 + > "enable=yes|no" that would automatically enable or disable all the Volumes + > found in the autochanger. This will permit the user to optionally mark all + > the Volumes in the magazine disabled prior to taking them offsite, and mark + > them all enabled when bringing them back on site. Coupled with the options + > to the slots keyword, you can apply the enable/disable to any or all volumes. .show device=xxx lists information from one storage device, including devices (I'm not even sure that information exists in the DIR...) .move eject device=xxx mostly the same as 'unmount xxx' but perhaps with @@ -52,6 +67,7 @@ For 1.39: target slot. The catalog should be updated accordingly. .move transfer device=xxx fromslot=yyy toslot=zzz + - Given all the problems with FIFOs, I think the solution is to do something a little different, though I will look at the code and see if there is not some simple solution (i.e. some bug that was introduced). What might be a better diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index 06aa058c64..07c415b40f 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,6 +2,21 @@ Kern Sibbald General: +19July06 +- 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 +- 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. +- Implement the Log table in the DB. +- Implement the Location Log table in the DB (for user use). +- At Eric's request add a run_scripts() just after blast_data in + src/filed/job.c 10Jul06 - Add Enabled column to Location, correct some typos in DB schemas. - Correct bug I introduced into RunScripts enum. diff --git a/bacula/src/cats/make_mysql_tables.in b/bacula/src/cats/make_mysql_tables.in index 63e074fe17..b9899fff6d 100644 --- a/bacula/src/cats/make_mysql_tables.in +++ b/bacula/src/cats/make_mysql_tables.in @@ -123,6 +123,19 @@ CREATE TABLE Location ( PRIMARY KEY(LocationId) ); +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; + NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', + 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, + NewEnabled TINYINT, + PRIMARY KEY(LocLogId) +); + + # CREATE TABLE FileSet ( FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, @@ -192,6 +205,7 @@ CREATE TABLE Media ( InitialWrite DATETIME DEFAULT 0, ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool, + Comment BLOB, PRIMARY KEY(MediaId), INDEX (PoolId) ); @@ -242,8 +256,11 @@ CREATE TABLE Client ( ); CREATE TABLE Log ( - JobId INTEGER UNSIGNED DEFAULT 0 REFERENCES JobId, + LogId INTEGER UNSIGNED AUTO_INCREMENT, + JobId INTEGER INTEGER UNSIGNED DEFAULT 0 REFERENCES JobId, + Time DATETIME DEFAULT 0, LogText BLOB NOT NULL, + PRIMARY KEY(LogId), INDEX (JobId) ); diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index 261227bd26..a10925554d 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -161,6 +161,7 @@ CREATE TABLE media initialwrite timestamp without time zone, scratchpoolid integer default 0, recyclepoolid integer default 0, + comment text, primary key (mediaid) ); @@ -248,12 +249,28 @@ create unique index client_name_idx on client (name); CREATE TABLE Log ( - JobId serial not null, + LogId serial not null, + JobId integer not null, + Time timestamp without time zone, LogText text not null, + primary key (LogId) ); - create index log_name_idx on Log (JobId); +CREATE TABLE LocationLog ( + LocLogId SERIAL NOT NULL, + Date timestamp without time zone, + Comment TEXT NOT NULL, + MediaId INTEGER DEFAULT 0, + LocationId INTEGER DEFAULT 0, + newvolstatus text not null + check (volstatus in ('Full','Archive','Append', + 'Recycle','Purged','Read-Only','Disabled', + 'Error','Busy','Used','Cleaning','Scratch')), + newenabled smallint, + PRIMARY KEY(LocLogId) +); + CREATE TABLE counters diff --git a/bacula/src/cats/make_sqlite3_tables.in b/bacula/src/cats/make_sqlite3_tables.in index 7e49d713a2..4583b85557 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -72,7 +72,6 @@ CREATE TABLE Job ( HasBase TINYINT DEFAULT 0, PRIMARY KEY(JobId) ); - CREATE INDEX inx6 ON Job (Name); CREATE TABLE Location ( @@ -83,6 +82,27 @@ CREATE TABLE Location ( PRIMARY KEY(LocationId) ); +CREATE TABLE LocationLog ( + LocLogId INTEGER, + Date DATETIME NOT NULL, + Comment TEXT NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0, + NewVolStatus VARCHAR(20) NOT NULL, + NewEnabled TINYINT NOT NULL, + PRIMARY KEY(LocLogId) +); + + +CREATE TABLE Log ( + LogId INTEGER, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + Time DATETIME NOT NULL, + LogText TEXT NOT NULL, + PRIMARY KEY(LogId) + ); +CREATE INDEX LogInx1 ON File (JobId); + CREATE TABLE FileSet ( FileSetId INTEGER, @@ -151,6 +171,7 @@ CREATE TABLE Media ( InitialWrite DATETIME DEFAULT 0, ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, PRIMARY KEY(MediaId) ); @@ -255,11 +276,6 @@ CREATE TABLE NextId ( PRIMARY KEY (TableName) ); -CREATE TABLE Log - JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, - LogText TEXT NOT NULL, - KEY (JobId) - ); -- Initialize JobId to start at 1 diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index 7e49d713a2..4583b85557 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -72,7 +72,6 @@ CREATE TABLE Job ( HasBase TINYINT DEFAULT 0, PRIMARY KEY(JobId) ); - CREATE INDEX inx6 ON Job (Name); CREATE TABLE Location ( @@ -83,6 +82,27 @@ CREATE TABLE Location ( PRIMARY KEY(LocationId) ); +CREATE TABLE LocationLog ( + LocLogId INTEGER, + Date DATETIME NOT NULL, + Comment TEXT NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0, + NewVolStatus VARCHAR(20) NOT NULL, + NewEnabled TINYINT NOT NULL, + PRIMARY KEY(LocLogId) +); + + +CREATE TABLE Log ( + LogId INTEGER, + JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + Time DATETIME NOT NULL, + LogText TEXT NOT NULL, + PRIMARY KEY(LogId) + ); +CREATE INDEX LogInx1 ON File (JobId); + CREATE TABLE FileSet ( FileSetId INTEGER, @@ -151,6 +171,7 @@ CREATE TABLE Media ( InitialWrite DATETIME DEFAULT 0, ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, PRIMARY KEY(MediaId) ); @@ -255,11 +276,6 @@ CREATE TABLE NextId ( PRIMARY KEY (TableName) ); -CREATE TABLE Log - JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, - LogText TEXT NOT NULL, - KEY (JobId) - ); -- Initialize JobId to start at 1 diff --git a/bacula/src/cats/update_mysql_tables.in b/bacula/src/cats/update_mysql_tables.in index c59e46f86e..52271b92d8 100755 --- a/bacula/src/cats/update_mysql_tables.in +++ b/bacula/src/cats/update_mysql_tables.in @@ -20,6 +20,7 @@ ALTER TABLE Media ADD COLUMN InitialWrite DATETIME DEFAULT 0; ALTER TABLE Media ADD COLUMN ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool; ALTER TABLE Media ADD COLUMN RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool; ALTER TABLE Media ADD COLUMN Enabled TINYINT DEFAULT 1; +ALTER TABLE Media ADD COLUMN Comment BLOB; ALTER TABLE JobMedia DROP ADD COLUMN Stripe; @@ -27,14 +28,30 @@ ALTER TABLE Job ADD COLUMN PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job; ALTER TABLE Job ADD COLUMN RealEndTime DATETIME DEFAULT 0; CREATE TABLE Log ( + LogId INTEGER UNSIGNED AUTO_INCREMENT, JobId INTEGER INTEGER UNSIGNED DEFAULT 0 REFERENCES JobId, + Time DATETIME DEFAULT 0, LogText BLOB NOT NULL, + PRIMARY KEY(LogId), INDEX (JobId) ); +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; + NewVolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged', + 'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL, + NewEnabled TINYINT, + PRIMARY KEY(LocLogId) +); + + CREATE TABLE Location ( LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, - Location TINYBLOB NOT NULL, + Location BLOB NOT NULL, Cost INTEGER DEFAULT 0, Enabled TINYINT, PRIMARY KEY(LocationId) diff --git a/bacula/src/cats/update_postgresql_tables.in b/bacula/src/cats/update_postgresql_tables.in index afb05793e6..7c3cebbcbd 100755 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -27,6 +27,7 @@ ALTER TABLE media ADD COLUMN recyclepoolid integer; UPDATE media SET recyclepoolid=0; ALTER TABLE media ADD COLUMN enabled integer; UPDATE media SET enabled=1; +ALTER TABLE media ADD COLUMN Comment TEXT; ALTER TABLE job ADD COLUMN RealEndTime timestamp without time zone; UPDATE job SET RealEndTime=0; @@ -43,12 +44,29 @@ CREATE TABLE Location ( PRIMARY KEY (LocationId) ); +CREATE TABLE LocationLog ( + LocLogId SERIAL NOT NULL, + Date timestamp without time zone, + Comment TEXT NOT NULL, + MediaId INTEGER DEFAULT 0, + LocationId INTEGER DEFAULT 0, + newvolstatus text not null + check (volstatus in ('Full','Archive','Append', + 'Recycle','Purged','Read-Only','Disabled', + 'Error','Busy','Used','Cleaning','Scratch')), + newenabled smallint, + PRIMARY KEY(LocLogId) +); + + CREATE TABLE Log ( - JobId serial not null, + LogId serial not null, + JobId integer not null, + Time timestamp without time zone, LogText text not null, + primary key (LogId) ); - create index log_name_idx on Log (JobId); diff --git a/bacula/src/cats/update_sqlite3_tables.in b/bacula/src/cats/update_sqlite3_tables.in index 399497bae0..c2d427ab61 100755 --- a/bacula/src/cats/update_sqlite3_tables.in +++ b/bacula/src/cats/update_sqlite3_tables.in @@ -115,6 +115,7 @@ CREATE TABLE Media ( InitialWrite DATETIME DEFAULT 0, ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, PRIMARY KEY(MediaId) ); @@ -213,11 +214,25 @@ INSERT INTO Job SELECT DROP TABLE Job_backup; -CREATE TABLE Log +CREATE TABLE LocationLog ( + LocLogId INTEGER, + Date DATETIME NOT NULL, + Comment TEXT NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0, + NewVolStatus VARCHAR(20) NOT NULL, + NewEnabled TINYINT NOT NULL, + PRIMARY KEY(LocLogId) +); + +CREATE TABLE Log ( + LogId INTEGER, JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + Time DATETIME NOT NULL, LogText TEXT NOT NULL, - KEY (JobId) + PRIMARY KEY(LogId) ); +CREATE INDEX LogInx1 ON File (JobId); CREATE TABLE Location ( LocationId INTEGER, diff --git a/bacula/src/cats/update_sqlite_tables.in b/bacula/src/cats/update_sqlite_tables.in index 399497bae0..c2d427ab61 100755 --- a/bacula/src/cats/update_sqlite_tables.in +++ b/bacula/src/cats/update_sqlite_tables.in @@ -115,6 +115,7 @@ CREATE TABLE Media ( InitialWrite DATETIME DEFAULT 0, ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0, + Comment TEXT, PRIMARY KEY(MediaId) ); @@ -213,11 +214,25 @@ INSERT INTO Job SELECT DROP TABLE Job_backup; -CREATE TABLE Log +CREATE TABLE LocationLog ( + LocLogId INTEGER, + Date DATETIME NOT NULL, + Comment TEXT NOT NULL, + MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0, + LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0, + NewVolStatus VARCHAR(20) NOT NULL, + NewEnabled TINYINT NOT NULL, + PRIMARY KEY(LocLogId) +); + +CREATE TABLE Log ( + LogId INTEGER, JobId INTEGER UNSIGNED REFERENCES Job NOT NULL, + Time DATETIME NOT NULL, LogText TEXT NOT NULL, - KEY (JobId) + PRIMARY KEY(LogId) ); +CREATE INDEX LogInx1 ON File (JobId); CREATE TABLE Location ( LocationId INTEGER, diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 24e8b11325..e30fb29650 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -345,7 +345,7 @@ const char *sql_job = /* Get JobIds from regex'ed Job names */ const char *sql_jobids_from_job = - "SELECT DISTINCT Job.JobId FROM Job,Pool" + "SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool" " WHERE Job.Name='%s' AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId" " ORDER by Job.StartTime"; @@ -357,7 +357,7 @@ const char *sql_client = /* Get JobIds from regex'ed Client names */ const char *sql_jobids_from_client = - "SELECT DISTINCT Job.JobId FROM Job,Pool" + "SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool" " WHERE Client.Name='%s' AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId" " AND Job.ClientId=Client.ClientId " " ORDER by Job.StartTime"; @@ -370,7 +370,7 @@ const char *sql_vol = /* Get JobIds from regex'ed Volume names */ const char *sql_jobids_from_vol = - "SELECT DISTINCT Job.JobId FROM Media,JobMedia,Job" + "SELECT DISTINCT Job.JobId,Job.StartTime FROM Media,JobMedia,Job" " WHERE Media.VolumeName='%s' AND Media.MediaId=JobMedia.MediaId" " AND JobMedia.JobId=Job.JobId" " ORDER by Job.StartTime"; @@ -392,7 +392,7 @@ const char *sql_oldest_vol = " ORDER BY LastWritten ASC LIMIT 1"; const char *sql_jobids_from_mediaid = - "SELECT DISTINCT Job.JobId FROM JobMedia,Job" + "SELECT DISTINCT Job.JobId,Job.StartTime FROM JobMedia,Job" " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId=%s" " ORDER by Job.StartTime"; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 367a3ca8cb..3d3828e3b5 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1329,11 +1329,11 @@ static int backup_cmd(JCR *jcr) bnet_suppress_error_messages(sd, 1); bget_msg(sd); /* Read final response from append_data */ Dmsg0(110, "Error in blast_data.\n"); + /* run shortly after end of data transmission */ + run_scripts(jcr, jcr->RunScripts, "ClientAfterJobShort"); } else { set_jcr_job_status(jcr, JS_Terminated); - /* run shortly after end of data transmission */ - run_scripts(jcr, jcr->RunScripts, "ClientAfterJobShort"); if (jcr->JobStatus != JS_Terminated) { bnet_suppress_error_messages(sd, 1); diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 18ae8aab8b..1bd6f8eb90 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -602,8 +602,9 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) } if (p_sql_query) { POOL_MEM cmd(PM_MESSAGE); - Mmsg(cmd, "INSERT INTO Log (JobId, LogText) VALUES (%s, '%s')", - edit_int64(jcr->JobId, ed1), msg); + bstrftimes(dt, sizeof(dt), mtime); + Mmsg(cmd, "INSERT INTO Log (JobId, Time, LogText) VALUES (%s,'%s','%s')", + edit_int64(jcr->JobId, ed1), dt, msg); p_sql_query(jcr, cmd.c_str()); } break; diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 1ad44371e6..d5a0ceafda 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -95,6 +95,7 @@ RES_ITEM msgs_items[] = { {"director", store_msgs, ITEM(res_msgs), MD_DIRECTOR, 0, 0}, {"console", store_msgs, ITEM(res_msgs), MD_CONSOLE, 0, 0}, {"operator", store_msgs, ITEM(res_msgs), MD_OPERATOR, 0, 0}, + {"catalog", store_msgs, ITEM(res_msgs), MD_CATALOG, 0, 0}, {NULL, NULL, {0}, 0, 0, 0} }; @@ -118,6 +119,7 @@ static struct s_mtypes msg_types[] = { {"restored", M_RESTORED}, {"security", M_SECURITY}, {"alert", M_ALERT}, + {"volmgmt", M_VOLMGMT}, {"all", M_MAX+1}, {NULL, 0} }; @@ -228,6 +230,7 @@ void store_msgs(LEX *lc, RES_ITEM *item, int index, int pass) case MD_STDERR: case MD_SYSLOG: /* syslog */ case MD_CONSOLE: + case MD_CATALOG: scan_types(lc, (MSGS *)(item->value), item->code, NULL, NULL); break; case MD_OPERATOR: /* send to operator */ diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index e52f19e0c0..f7c26c9180 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -399,6 +399,7 @@ public: int spool_fd; /* fd if spooling */ bool spool_data; /* set to spool data */ bool spooling; /* set when actually spooling */ + bool despooling; /* set when 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 e57326ccc1..dd22f26bb1 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -6,7 +6,7 @@ * Version $Id$ */ /* - Copyright (C) 2004-2005 Kern Sibbald + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -195,16 +195,20 @@ static bool despool_data(DCR *dcr, bool commit) char ec1[50]; Dmsg0(100, "Despooling data\n"); + /* Commit means that the job is done, so we commit, otherwise, we + * are despooling because of user spool size max or some error + * (e.g. filesystem full). + */ if (commit) { Jmsg(jcr, M_INFO, 0, _("Committing spooled data to Volume \"%s\". Despooling %s bytes ...\n"), jcr->dcr->VolumeName, edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1)); - } - else { + } else { 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->spooling = false; + dcr->despooling = true; lock_device(dcr->dev); dcr->dev_locked = true; @@ -281,6 +285,7 @@ static bool despool_data(DCR *dcr, bool commit) unlock_device(dcr->dev); dcr->dev_locked = false; dcr->spooling = true; /* turn on spooling again */ + dcr->despooling = false; return ok; } diff --git a/bacula/src/stored/status.c b/bacula/src/stored/status.c index 5edd913ac1..2a951e6cbb 100644 --- a/bacula/src/stored/status.c +++ b/bacula/src/stored/status.c @@ -307,6 +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); } sec = time(NULL) - jcr->run_time; if (sec <= 0) { diff --git a/bacula/src/version.h b/bacula/src/version.h index 98f0106858..ff7aca9b55 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.16" -#define BDATE "9 July 2006" -#define LSMDATE "09Jul06" +#define BDATE "19 July 2006" +#define LSMDATE "19Jul06" /* Debug flags */ #undef DEBUG -- 2.39.2