]> git.sur5r.net Git - bacula/bacula/commitdiff
- Fix a complier warning in files/backup.c
authorKern Sibbald <kern@sibbald.com>
Sat, 1 Jul 2006 12:32:42 +0000 (12:32 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 1 Jul 2006 12:32:42 +0000 (12:32 +0000)
- Cleanup NOT NULL vs DEFALT 0 in database creation.
- Tweak btape.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3101 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.39
bacula/src/cats/drop_postgresql_tables.in
bacula/src/cats/make_mysql_tables.in
bacula/src/cats/make_postgresql_tables.in
bacula/src/cats/make_sqlite3_tables.in
bacula/src/cats/make_sqlite_tables.in
bacula/src/filed/backup.c
bacula/src/stored/btape.c

index 41044815569cd8caf7f142991b234cab70abefa2..38eb560eb3ab66c6aef9e2597507c7ededb5d51b 100644 (file)
@@ -3,6 +3,9 @@
 
 General:
 30Jun06
+- Fix a complier warning in files/backup.c
+- Cleanup NOT NULL vs DEFALT 0 in database creation.
+- Tweak btape.
 - Robert committed his low impact changes.
 - I removed a size_t from the jcr.h definition.
 - Update the tape regression scripts (still to be tested).
@@ -44,7 +47,11 @@ General:
   using uint8_t * instead.
 - Harden authentication failure in FD by single threading errors
   and forcing a 6 second wait.
-- ========= Remove Accept Any Volume ========= directive.
+
+  ============= Warning ==================================
+       Removed  "Accept Any Volume" directive.
+  ===========================================================
+
 - Major cleanup and simplification of regress using shell functions
   (more tests to be converted to new format)   
 - Add detection of 64 bit Irix as indicated by user.
index 0d14bda04e3a065e8ffd1688abe72f95158a3bad..f59669e6f12527e399c2e83f91f79ba6eb5d92c6 100644 (file)
@@ -4,7 +4,7 @@
 
 bindir=@SQL_BINDIR@
 
-if $bindir/psql -f - -d bacula $* <<END-OF-DATA
+$bindir/psql -f - -d bacula $* <<END-OF-DATA
 drop table unsavedfiles;
 drop table basefiles;
 drop table jobmedia;
@@ -26,9 +26,11 @@ drop table Status;
 drop table MAC;
 drop table Location;
 END-OF-DATA
+pstat=$?
+if test $pstat = 0; 
 then
    echo "Deletion of Bacula PostgreSQL tables succeeded."
 else
    echo "Deletion of Bacula PostgreSQL tables failed."
 fi
-exit 0
+exit $pstat
index d0f7f3108d52d3502852c35a3bf4dc11542ca92f..43cd01410093484edca84b162e5b0228415e4402 100644 (file)
@@ -29,13 +29,13 @@ CREATE TABLE Path (
 
 CREATE TABLE File (
    FileId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
-   FileIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
+   FileIndex INTEGER UNSIGNED DEFAULT 0,
    JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
    PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
    FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
-   MarkId INTEGER UNSIGNED NOT NULL DEFAULT 0,
+   MarkId INTEGER UNSIGNED DEFAULT 0,
    LStat TINYBLOB NOT NULL,
-   MD5 TINYBLOB NOT NULL,
+   MD5 TINYBLOB,
    PRIMARY KEY(FileId),
    INDEX (JobId),
    INDEX (JobId, PathId, FilenameId)
@@ -69,8 +69,8 @@ CREATE TABLE Storage (
 CREATE TABLE Device (
    DeviceId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    Name TINYBLOB NOT NULL,
-   MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,
-   StorageId INTEGER UNSIGNED NOT NULL REFERENCES Storage,
+   MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,
+   StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,
    DevMounts INTEGER UNSIGNED DEFAULT 0,
    DevReadBytes BIGINT UNSIGNED DEFAULT 0,
    DevWriteBytes BIGINT UNSIGNED DEFAULT 0,
@@ -92,24 +92,24 @@ CREATE TABLE Job (
    Name TINYBLOB NOT NULL,
    Type BINARY(1) NOT NULL,
    Level BINARY(1) NOT NULL,
-   ClientId INTEGER NOT NULL DEFAULT 0 REFERENCES Client,
+   ClientId INTEGER DEFAULT 0 REFERENCES Client,
    JobStatus BINARY(1) NOT NULL,
-   SchedTime DATETIME NOT NULL,
-   StartTime DATETIME NOT NULL DEFAULT 0,
-   EndTime DATETIME NOT NULL DEFAULT 0,
-   RealEndTime DATETIME NOT NULL DEFAULT 0,
-   JobTDate BIGINT UNSIGNED NOT NULL,
-   VolSessionId INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolSessionTime INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   JobFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   JobBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   JobErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   JobMissingFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   PoolId INTEGER UNSIGNED NOT NULL DEFAULT 0 REFERENCES Pool,
-   FileSetId INTEGER UNSIGNED NOT NULL DEFAULT 0 REFERENCES FileSet,
+   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,
+   JobErrors INTEGER UNSIGNED DEFAULT 0,
+   JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
+   FileSetId INTEGER UNSIGNED DEFAULT 0 REFERENCES FileSet,
    PriorJobId INTEGER UNSIGNED DEFAULT 0 REFERENCES Job,
-   PurgedFiles TINYINT NOT NULL DEFAULT 0,
-   HasBase TINYINT NOT NULL DEFAULT 0,
+   PurgedFiles TINYINT DEFAULT 0,
+   HasBase TINYINT DEFAULT 0,
    PRIMARY KEY(JobId),
    INDEX (Name(128))
    );
@@ -118,7 +118,7 @@ CREATE TABLE Job (
 CREATE TABLE Location (
    LocationId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    Location TINYBLOB NOT NULL,
-   Cost INTEGER NOT NULL DEFAULT 0,
+   Cost INTEGER DEFAULT 0,
    PRIMARY KEY(LocationId)
    );
 
@@ -126,8 +126,8 @@ CREATE TABLE Location (
 CREATE TABLE FileSet (
    FileSetId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    FileSet TINYBLOB NOT NULL,
-   MD5 TINYBLOB NOT NULL,
-   CreateTime DATETIME NOT NULL,
+   MD5 TINYBLOB,
+   CreateTime DATETIME DEFAULT 0,
    PRIMARY KEY(FileSetId)
    );
 
@@ -135,15 +135,15 @@ CREATE TABLE JobMedia (
    JobMediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
    MediaId INTEGER UNSIGNED NOT NULL REFERENCES Media,
-   FirstIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   LastIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   StartFile INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   StartBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolIndex INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   Copy INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   Stripe INTEGER UNSIGNED NOT NULL DEFAULT 0,
+   FirstIndex INTEGER UNSIGNED DEFAULT 0,
+   LastIndex INTEGER UNSIGNED DEFAULT 0,
+   StartFile INTEGER UNSIGNED DEFAULT 0,
+   EndFile INTEGER UNSIGNED DEFAULT 0,
+   StartBlock INTEGER UNSIGNED DEFAULT 0,
+   EndBlock INTEGER UNSIGNED DEFAULT 0,
+   VolIndex INTEGER UNSIGNED DEFAULT 0,
+   Copy INTEGER UNSIGNED DEFAULT 0,
+   Stripe INTEGER UNSIGNED DEFAULT 0,
    PRIMARY KEY(JobMediaId),
    INDEX (JobId, MediaId)
    );
@@ -152,43 +152,43 @@ CREATE TABLE JobMedia (
 CREATE TABLE Media (
    MediaId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    VolumeName TINYBLOB NOT NULL,
-   Slot INTEGER NOT NULL DEFAULT 0,
-   PoolId INTEGER UNSIGNED NOT NULL REFERENCES Pool,
+   Slot INTEGER DEFAULT 0,
+   PoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
    MediaType TINYBLOB NOT NULL,
-   MediaTypeId INTEGER UNSIGNED NOT NULL REFERENCES MediaType,
-   LabelType TINYINT NOT NULL DEFAULT 0,
-   FirstWritten DATETIME NOT NULL DEFAULT 0,
-   LastWritten DATETIME NOT NULL DEFAULT 0,
-   LabelDate DATETIME NOT NULL DEFAULT 0,
-   VolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolBlocks INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolMounts INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   VolParts INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolErrors INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolWrites INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   VolCapacityBytes BIGINT UNSIGNED NOT NULL,
+   MediaTypeId INTEGER UNSIGNED DEFAULT 0 REFERENCES MediaType,
+   LabelType TINYINT DEFAULT 0,
+   FirstWritten DATETIME DEFAULT 0,
+   LastWritten DATETIME DEFAULT 0,
+   LabelDate DATETIME DEFAULT 0,
+   VolJobs INTEGER UNSIGNED DEFAULT 0,
+   VolFiles INTEGER UNSIGNED DEFAULT 0,
+   VolBlocks INTEGER UNSIGNED DEFAULT 0,
+   VolMounts INTEGER UNSIGNED DEFAULT 0,
+   VolBytes BIGINT UNSIGNED DEFAULT 0,
+   VolParts INTEGER UNSIGNED DEFAULT 0,
+   VolErrors INTEGER UNSIGNED DEFAULT 0,
+   VolWrites INTEGER UNSIGNED DEFAULT 0,
+   VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
    VolStatus ENUM('Full', 'Archive', 'Append', 'Recycle', 'Purged',
     'Read-Only', 'Disabled', 'Error', 'Busy', 'Used', 'Cleaning') NOT NULL,
    Enabled TINYINT DEFAULT 1,
-   Recycle TINYINT NOT NULL DEFAULT 0,
-   VolRetention BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   VolUseDuration BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   MaxVolBytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   InChanger TINYINT NOT NULL DEFAULT 0,
+   Recycle TINYINT DEFAULT 0,
+   VolRetention BIGINT UNSIGNED DEFAULT 0,
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+   InChanger TINYINT DEFAULT 0,
    StorageId INTEGER UNSIGNED DEFAULT 0 REFERENCES Storage,
    DeviceId INTEGER UNSIGNED DEFAULT 0 REFERENCES Device,
-   MediaAddressing TINYINT NOT NULL DEFAULT 0,
-   VolReadTime BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   VolWriteTime BIGINT UNSIGNED NOT NULL DEFAULT 0,
-   EndFile INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   EndBlock INTEGER UNSIGNED NOT NULL DEFAULT 0,
+   MediaAddressing TINYINT DEFAULT 0,
+   VolReadTime BIGINT UNSIGNED DEFAULT 0,
+   VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+   EndFile INTEGER UNSIGNED DEFAULT 0,
+   EndBlock INTEGER UNSIGNED DEFAULT 0,
    LocationId INTEGER UNSIGNED DEFAULT 0 REFERENCES Location,
    RecycleCount INTEGER UNSIGNED DEFAULT 0,
-   InitialWrite DATETIME NOT NULL DEFAULT 0,
+   InitialWrite DATETIME DEFAULT 0,
    ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
    RecyclePoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
    PRIMARY KEY(MediaId),
@@ -202,20 +202,20 @@ CREATE INDEX inx8 ON Media (PoolId);
 CREATE TABLE Pool (
    PoolId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    Name TINYBLOB NOT NULL,
-   NumVols INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   MaxVols INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   UseOnce TINYINT NOT NULL,
-   UseCatalog TINYINT NOT NULL,
+   NumVols INTEGER UNSIGNED DEFAULT 0,
+   MaxVols INTEGER UNSIGNED DEFAULT 0,
+   UseOnce TINYINT DEFAULT 0,
+   UseCatalog TINYINT DEFAULT 0,
    AcceptAnyVolume TINYINT DEFAULT 0,
-   VolRetention BIGINT UNSIGNED NOT NULL,
-   VolUseDuration BIGINT UNSIGNED NOT NULL,
-   MaxVolJobs INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   MaxVolFiles INTEGER UNSIGNED NOT NULL DEFAULT 0,
-   MaxVolBytes BIGINT UNSIGNED NOT NULL,
+   VolRetention BIGINT UNSIGNED DEFAULT 0,
+   VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+   MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+   MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+   MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
    AutoPrune TINYINT DEFAULT 0,
    Recycle TINYINT DEFAULT 0,
    PoolType ENUM('Backup', 'Copy', 'Cloned', 'Archive', 'Migration', 'Scratch') NOT NULL,
-   LabelType TINYINT NOT NULL DEFAULT 0,
+   LabelType TINYINT DEFAULT 0,
    LabelFormat TINYBLOB,
    Enabled TINYINT DEFAULT 1,
    ScratchPoolId INTEGER UNSIGNED DEFAULT 0 REFERENCES Pool,
@@ -234,8 +234,8 @@ CREATE TABLE Client (
    Name TINYBLOB NOT NULL,
    Uname TINYBLOB NOT NULL,      /* full uname -a of client */
    AutoPrune TINYINT DEFAULT 0,
-   FileRetention BIGINT UNSIGNED NOT NULL,
-   JobRetention  BIGINT UNSIGNED NOT NULL,
+   FileRetention BIGINT UNSIGNED DEFAULT 0,
+   JobRetention  BIGINT UNSIGNED DEFAULT 0,
    UNIQUE (Name(128)),
    PRIMARY KEY(ClientId)
    );
@@ -261,9 +261,9 @@ CREATE TABLE UnsavedFiles (
 
 CREATE TABLE Counters (
    Counter TINYBLOB NOT NULL,
-   MinValue INTEGER,
-   MaxValue INTEGER,
-   CurrentValue INTEGER,
+   MinValue INTEGER DEFAULT 0,
+   MaxValue INTEGER DEFAULT 0,
+   CurrentValue INTEGER DEFAULT 0,
    WrapCounter TINYBLOB NOT NULL,
    PRIMARY KEY (Counter(128))
    );
index 37fb52813e098bd5195fa49bed790997dbf59e05..88c276642469336d58034a1eeba944194f39a10b 100644 (file)
@@ -4,7 +4,7 @@
 #
 bindir=@SQL_BINDIR@
 
-if $bindir/psql -f - -d bacula $* <<END-OF-DATA
+$bindir/psql -f - -d bacula $* <<END-OF-DATA
 
 CREATE TABLE filename
 (
@@ -55,24 +55,24 @@ CREATE TABLE job
     name             text        not null,
     type             char(1)     not null,
     level            char(1)     not null,
-    clientid         integer,
+    clientid         integer     default 0,
     jobstatus        char(1)     not null,
-    schedtime        timestamp   without time zone not null,
+    schedtime        timestamp   without time zone,
     starttime        timestamp   without time zone,
     endtime          timestamp   without time zone,
     realendtime       timestamp   without time zone,
-    jobtdate         bigint      not null,
-    volsessionid      integer    not null default 0,
-    volsessiontime    integer    not null default 0,
-    jobfiles         integer     not null default 0,
-    jobbytes         bigint      not null default 0,
-    joberrors        integer     not null default 0,
-    jobmissingfiles   integer    not null default 0,
-    poolid           integer,
-    filesetid        integer,
-    purgedfiles       smallint   not null default 0,
-    hasbase          smallint    not null default 0,
-    priorjobid       integer     not null default 0,
+    jobtdate         bigint      default 0,
+    volsessionid      integer    default 0,
+    volsessiontime    integer    default 0,
+    jobfiles         integer     default 0,
+    jobbytes         bigint      default 0,
+    joberrors        integer     default 0,
+    jobmissingfiles   integer    default 0,
+    poolid           integer     default 0,
+    filesetid        integer     default 0,
+    purgedfiles       smallint   default 0,
+    hasbase          smallint    default 0,
+    priorjobid       integer     default 0,
     primary key (jobid)
 );
 
@@ -81,7 +81,7 @@ CREATE INDEX job_name_idx on job (name);
 CREATE TABLE Location (
    LocationId        serial      not null,
    Location          text        not null,
-   Cost              integer     not null default 0,
+   Cost              integer     default 0,
    primary key (LocationId)
 );
 
@@ -102,14 +102,14 @@ CREATE TABLE jobmedia
     jobmediaid       serial      not null,
     jobid            integer     not null,
     mediaid          integer     not null,
-    firstindex       integer     not null default 0,
-    lastindex        integer     not null default 0,
-    startfile        integer     not null default 0,
-    endfile          integer     not null default 0,
-    startblock       bigint      not null default 0,
-    endblock         bigint      not null default 0,
-    volindex         integer     not null default 0,
-    copy             integer     not null default 0,
+    firstindex       integer     default 0,
+    lastindex        integer     default 0,
+    startfile        integer     default 0,
+    endfile          integer     default 0,
+    startblock       bigint      default 0,
+    endblock         bigint      default 0,
+    volindex         integer     default 0,
+    copy             integer     default 0,
     primary key (jobmediaid)
 );
 
@@ -119,47 +119,47 @@ CREATE TABLE media
 (
     mediaid          serial      not null,
     volumename       text        not null,
-    slot             integer     not null default 0,
-    poolid           integer     not null,
+    slot             integer     default 0,
+    poolid           integer     default 0,
     mediatype        text        not null,
-    mediatypeid       integer    not null,
-    labeltype        integer     not null default 0,
+    mediatypeid       integer    default 0,
+    labeltype        integer     default 0,
     firstwritten      timestamp   without time zone,
     lastwritten       timestamp   without time zone,
     labeldate        timestamp   without time zone,
-    voljobs          integer     not null default 0,
-    volfiles         integer     not null default 0,
-    volblocks        integer     not null default 0,
-    volmounts        integer     not null default 0,
-    volbytes         bigint      not null default 0,
-    volparts         integer     not null default 0,
-    volerrors        integer     not null default 0,
-    volwrites        integer     not null default 0,
-    volcapacitybytes  bigint     not null default 0,
+    voljobs          integer     default 0,
+    volfiles         integer     default 0,
+    volblocks        integer     default 0,
+    volmounts        integer     default 0,
+    volbytes         bigint      default 0,
+    volparts         integer     default 0,
+    volerrors        integer     default 0,
+    volwrites        integer     default 0,
+    volcapacitybytes  bigint     default 0,
     volstatus        text        not null
        check (volstatus in ('Full','Archive','Append',
              'Recycle','Purged','Read-Only','Disabled',
              'Error','Busy','Used','Cleaning','Scratch')),
-    enabled          smallint    not null default 1,
-    recycle          smallint    not null default 0,
-    volretention      bigint     not null default 0,
-    voluseduration    bigint     not null default 0,
-    maxvoljobs       integer     not null default 0,
-    maxvolfiles       integer    not null default 0,
-    maxvolbytes       bigint     not null default 0,
-    inchanger        smallint    not null default 0,
-    StorageId        integer              default 0,
-    DeviceId         integer              default 0,
-    mediaaddressing   smallint   not null default 0,
-    volreadtime       bigint     not null default 0,
-    volwritetime      bigint     not null default 0,
-    endfile          integer     not null default 0,
-    endblock         bigint      not null default 0,
-    LocationId       integer              default 0,
-    recyclecount      integer    not null default 0,
+    enabled          smallint    default 1,
+    recycle          smallint    default 0,
+    volretention      bigint     default 0,
+    voluseduration    bigint     default 0,
+    maxvoljobs       integer     default 0,
+    maxvolfiles       integer    default 0,
+    maxvolbytes       bigint     default 0,
+    inchanger        smallint    default 0,
+    StorageId        integer     default 0,
+    DeviceId         integer     default 0,
+    mediaaddressing   smallint   default 0,
+    volreadtime       bigint     default 0,
+    volwritetime      bigint     default 0,
+    endfile          integer     default 0,
+    endblock         bigint      default 0,
+    LocationId       integer     default 0,
+    recyclecount      integer    default 0,
     initialwrite      timestamp   without time zone,
-    scratchpoolid     integer default 0,
-    recyclepoolid     integer default 0,
+    scratchpoolid     integer    default 0,
+    recyclepoolid     integer    default 0,
     primary key (mediaid)
 );
 
@@ -194,7 +194,7 @@ CREATE TABLE Device (
    DevWriteTime BIGINT NOT NULL DEFAULT 0,
    DevReadTimeSinceCleaning BIGINT NOT NULL DEFAULT 0,
    DevWriteTimeSinceCleaning BIGINT NOT NULL DEFAULT 0,
-   CleaningDate TIMESTAMP WITHOUT TIME ZONE,
+   CleaningDate timestamp without time zone,
    CleaningPeriod BIGINT NOT NULL DEFAULT 0,
    PRIMARY KEY(DeviceId)
    );
@@ -204,29 +204,29 @@ CREATE TABLE pool
 (
     poolid           serial      not null,
     name             text        not null,
-    numvols          integer     not null default 0,
-    maxvols          integer     not null default 0,
-    useonce          smallint    not null default 0,
-    usecatalog       smallint    not null default 0,
-    acceptanyvolume   smallint   not null default 0,
-    volretention      bigint     not null default 0,
-    voluseduration    bigint     not null default 0,
-    maxvoljobs       integer     not null default 0,
-    maxvolfiles       integer    not null default 0,
-    maxvolbytes       bigint     not null default 0,
-    autoprune        smallint    not null default 0,
-    recycle          smallint    not null default 0,
+    numvols          integer     default 0,
+    maxvols          integer     default 0,
+    useonce          smallint    default 0,
+    usecatalog       smallint    default 0,
+    acceptanyvolume   smallint   default 0,
+    volretention      bigint     default 0,
+    voluseduration    bigint     default 0,
+    maxvoljobs       integer     default 0,
+    maxvolfiles       integer    default 0,
+    maxvolbytes       bigint     default 0,
+    autoprune        smallint    default 0,
+    recycle          smallint    default 0,
     pooltype         text                          
       check (pooltype in ('Backup','Copy','Cloned','Archive','Migration','Scratch')),
-    labeltype        integer     not null default 0,
+    labeltype        integer     default 0,
     labelformat       text       not null,
-    enabled          smallint    not null default 1,
-    scratchpoolid     integer default 0,
-    recyclepoolid     integer default 0,
-    NextPoolId       integer default 0,
-    MigrationHighBytes BIGINT DEFAULT 0,
-    MigrationLowBytes  BIGINT DEFAULT 0,
-    MigrationTime      BIGINT DEFAULT 0,
+    enabled          smallint    default 1,
+    scratchpoolid     integer    default 0,
+    recyclepoolid     integer    default 0,
+    NextPoolId       integer     default 0,
+    MigrationHighBytes BIGINT    DEFAULT 0,
+    MigrationLowBytes  BIGINT    DEFAULT 0,
+    MigrationTime      BIGINT    DEFAULT 0,
     primary key (poolid)
 );
 
@@ -238,8 +238,8 @@ CREATE TABLE client
     name             text        not null,
     uname            text        not null,
     autoprune        smallint    default 0,
-    fileretention     bigint     not null,
-    jobretention      bigint     not null,
+    fileretention     bigint     default 0,
+    jobretention      bigint     default 0,
     primary key (clientid)
 );
 
@@ -249,9 +249,9 @@ create unique index client_name_idx on client (name);
 CREATE TABLE counters
 (
     counter          text        not null,
-    minvalue         integer,
-    maxvalue         integer,
-    currentvalue      integer,
+    minvalue         integer     default 0,
+    maxvalue         integer     default 0,
+    currentvalue      integer    default 0,
     wrapcounter       text       not null,
     primary key (counter)
 );
@@ -342,9 +342,11 @@ INSERT INTO Version (VersionId) VALUES (10);
 
 
 END-OF-DATA
+pstat=$?
+if test $pstat = 0; 
 then
    echo "Creation of Bacula PostgreSQL tables succeeded."
 else
    echo "Creation of Bacula PostgreSQL tables failed."
 fi
-exit 0
+exit $pstat
index 12c635fd5585f14771f51cc90b5b7e47b002aa63..f397fbd86fb1bbd1050df9ef20ae29e2534a31c5 100644 (file)
@@ -113,7 +113,7 @@ CREATE TABLE Media (
    MediaId INTEGER,
    VolumeName VARCHAR(128) NOT NULL,
    Slot INTEGER DEFAULT 0,
-   PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+   PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
    MediaType VARCHAR(128) NOT NULL,
    MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
    LabelType TINYINT DEFAULT 0,
index 12c635fd5585f14771f51cc90b5b7e47b002aa63..f397fbd86fb1bbd1050df9ef20ae29e2534a31c5 100644 (file)
@@ -113,7 +113,7 @@ CREATE TABLE Media (
    MediaId INTEGER,
    VolumeName VARCHAR(128) NOT NULL,
    Slot INTEGER DEFAULT 0,
-   PoolId INTEGER UNSIGNED REFERENCES Pool NOT NULL,
+   PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
    MediaType VARCHAR(128) NOT NULL,
    MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
    LabelType TINYINT DEFAULT 0,
index 16659dc66a5f0e9fe3c2ce2f8af78a4eb836082b..450a65578a6b0b77816e7c5da3fba02b37ebfb31 100644 (file)
@@ -527,7 +527,7 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level)
       Dmsg1(300, "bfiled>stored:header %s\n", sd->msg);
 
       /* Grow the bsock buffer to fit our message if necessary */
-      if (sizeof_pool_memory(sd->msg) < size) {
+      if (sizeof_pool_memory(sd->msg) < (int32_t)size) {
          sd->msg = realloc_pool_memory(sd->msg, size);
       }
 
index 4575531848e001703c9ce6c8337b846e0bb8581c..0198ed0687773d4b95fc0f50ad3637e4b46e7f2b 100644 (file)
@@ -96,6 +96,7 @@ static char *argv[MAX_CMD_ARGS];
 static int argc;
 
 static int quickie_count = 0;
+static uint64_t write_count = 0;
 static BSR *bsr = NULL;
 static int signals = TRUE;
 static bool ok;
@@ -1958,7 +1959,9 @@ static void fillcmd()
 
       /* Get out after writing 10 blocks to the second tape */
       if (BlockNumber > 10 && stop != 0) {      /* get out */
-         Pmsg0(-1, "Done writing ...\n");
+         char ed1[50];
+         Pmsg1(-1, "Done writing %s records ...\n", 
+             edit_uint64_with_commas(write_count, ed1));
          break;
       }
    }
@@ -2108,17 +2111,18 @@ static void do_unfill()
          dev->close();
          get_cmd(_("Mount first tape. Press enter when ready: "));
       }
-      free_restore_volume_list(jcr);
-      jcr->dcr = new_dcr(jcr, dev);
-      set_volume_name("TestVolume1", 1);
-      jcr->bsr = NULL;
-      create_restore_volume_list(jcr);
-      dev->close();
-      dev->num_writers = 0;
-      if (!acquire_device_for_read(dcr)) {
-         Pmsg1(-1, "%s", dev->errmsg);
-         goto bail_out;
-      }
+   }
+
+   free_restore_volume_list(jcr);
+   jcr->dcr = new_dcr(jcr, dev);
+   set_volume_name("TestVolume1", 1);
+   jcr->bsr = NULL;
+   create_restore_volume_list(jcr);
+   dev->close();
+   dev->num_writers = 0;
+   if (!acquire_device_for_read(dcr)) {
+      Pmsg1(-1, "%s", dev->errmsg);
+      goto bail_out;
    }
    /*
     * We now have the first tape mounted.
@@ -2722,7 +2726,8 @@ static bool my_mount_next_read_volume(DCR *dcr)
    DEV_BLOCK *block = dcr->block;
 
    Dmsg0(20, "Enter my_mount_next_read_volume\n");
-   Pmsg1(000, _("End of Volume \"%s\"\n"), dcr->VolumeName);
+   Pmsg2(000, _("End of Volume \"%s\" %d records.\n"), dcr->VolumeName,
+      quickie_count);
 
    if (LastBlock != block->BlockNumber) {
       VolBytes += block->block_len;