/* Inserting path records for JobId */
Mmsg(mdb->cmd, "INSERT INTO PathVisibility (PathId, JobId) "
"SELECT DISTINCT PathId, JobId "
- "FROM (SELECT PathId, JobId FROM File WHERE JobId = %s AND FileIndex <> 0 "
+ "FROM (SELECT PathId, JobId FROM File WHERE JobId = %s AND FileIndex > 0 "
"UNION "
"SELECT PathId, BaseFiles.JobId "
"FROM BaseFiles JOIN File AS F USING (FileId) "
int order; /* 0 ASC, 1 DESC */
int limit; /* limit records to display */
faddr_t rec_addr;
- uint32_t FileIndex; /* added during Verify */
+ int32_t FileIndex; /* added during Verify */
int CorrNbJob; /* used by dbd_get_job_statistics() */
int CorrJobBytes; /* used by dbd_get_job_statistics() */
char *fname; /* full path & filename */
char *link; /* link if any */
char *attr; /* attributes statp */
- uint32_t FileIndex;
+ int32_t FileIndex;
uint32_t Stream;
uint32_t FileType;
uint32_t DeltaSeq;
uint32_t object_full_len;
uint32_t object_index;
int32_t object_compression;
- uint32_t FileIndex;
+ int32_t FileIndex;
uint32_t Stream;
uint32_t FileType;
JobId_t JobId;
/* File record -- same format as database */
struct FILE_DBR {
FileId_t FileId;
- uint32_t FileIndex;
- uint32_t FileIndex2;
+ int32_t FileIndex;
+ int32_t FileIndex2;
JobId_t JobId;
DBId_t FilenameId;
DBId_t PathId;
-- FileNameId can link to Filename.Name='' for directories
CREATE TABLE File (
FileId BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
- FileIndex INTEGER UNSIGNED DEFAULT 0,
+ FileIndex INTEGER DEFAULT 0,
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
ObjectFullLength INTEGER DEFAULT 0,
ObjectIndex INTEGER DEFAULT 0,
ObjectType INTEGER DEFAULT 0,
- FileIndex INTEGER UNSIGNED DEFAULT 0,
+ FileIndex INTEGER DEFAULT 0,
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
ObjectCompression INTEGER DEFAULT 0,
PRIMARY KEY(RestoreObjectId),
BaseJobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
FileId BIGINT UNSIGNED NOT NULL REFERENCES File,
- FileIndex INTEGER UNSIGNED,
+ FileIndex INTEGER DEFAULT 0,
PRIMARY KEY(BaseId)
);
baseid bigserial not null,
jobid integer not null,
fileid bigint not null,
- fileindex integer ,
+ fileindex integer default 0,
basejobid integer ,
primary key (baseid)
);
-- FileNameId can link to Filename.Name='' for directories
CREATE TABLE File (
FileId INTEGER,
- FileIndex INTEGER UNSIGNED NOT NULL,
+ FileIndex INTEGER DEFAULT 0,
JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
PathId INTEGER UNSIGNED REFERENCES Path NOT NULL,
FilenameId INTEGER UNSIGNED REFERENCES Filename NOT NULL,
ObjectFullLength INTEGER DEFAULT 0,
ObjectIndex INTEGER DEFAULT 0,
ObjectType INTEGER DEFAULT 0,
- FileIndex INTEGER UNSIGNED DEFAULT 0,
+ FileIndex INTEGER DEFAULT 0,
ObjectCompression INTEGER DEFAULT 0,
JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
PRIMARY KEY(RestoreObjectId)
BaseJobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
FileId INTEGER UNSIGNED REFERENCES File NOT NULL,
- FileIndex INTEGER UNSIGNED,
+ FileIndex INTEGER DEFAULT 0,
PRIMARY KEY(BaseId)
);
*/
if (mdb->changes == 0) {
Mmsg(cmd, "INSERT INTO batch VALUES "
- "(%u,%s,'%s','%s','%s','%s',%u)",
+ "(%d,%s,'%s','%s','%s','%s',%u)",
ar->FileIndex, edit_int64(ar->JobId,ed1), mdb->esc_path,
mdb->esc_name, ar->attr, digest, ar->DeltaSeq);
mdb->changes++;
* We use the esc_obj for temporary storage otherwise
* we keep on copying data.
*/
- Mmsg(mdb->esc_obj, ",(%u,%s,'%s','%s','%s','%s',%u)",
+ Mmsg(mdb->esc_obj, ",(%d,%s,'%s','%s','%s','%s',%u)",
ar->FileIndex, edit_int64(ar->JobId,ed1), mdb->esc_path,
mdb->esc_name, ar->attr, digest, ar->DeltaSeq);
pm_strcat(mdb->cmd, mdb->esc_obj);
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
- Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
/* Must create it */
Mmsg(cmd,
"INSERT INTO File (FileIndex,JobId,PathId,FilenameId,"
- "LStat,MD5,DeltaSeq) VALUES (%u,%u,%u,%u,'%s','%s',%u)",
+ "LStat,MD5,DeltaSeq) VALUES (%d,%u,%u,%u,'%s','%s',%u)",
ar->FileIndex, ar->JobId, ar->PathId, ar->FilenameId,
ar->attr, digest, ar->DeltaSeq);
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2017 Kern Sibbald
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
case L_VERIFY_VOLUME_TO_CATALOG:
Mmsg(cmd,
"SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%s AND File.PathId=%s AND "
-"File.FilenameId=%s AND File.FileIndex=%u",
+"File.FilenameId=%s AND File.FileIndex=%d",
edit_int64(fdbr->JobId, ed1),
edit_int64(fdbr->PathId, ed2),
edit_int64(fdbr->FilenameId,ed3),
switch (deleted) {
case 0: /* Show only actual files */
- opt = " AND FileIndex <> 0 ";
+ opt = " AND FileIndex > 0 ";
break;
case 1: /* Show only deleted files */
- opt = " AND FileIndex = 0 ";
+ opt = " AND FileIndex <= 0 ";
break;
default: /* Show everything */
opt = "";
USE ${db_name};
ALTER TABLE Device
MODIFY CleaningDate DATETIME DEFAULT NULL;
+ALTER TABLE File
+ MODIFY FileIndex INTEGER DEFAULT 0;
+ALTER TABLE RestoreObject
+ MODIFY FileIndex INTEGER DEFAULT 0;
+ALTER TABLE BaseFiles
+ MODIFY FileIndex INTEGER DEFAULT 0;
ALTER TABLE Media
MODIFY FirstWritten DATETIME DEFAULT NULL,
MODIFY LastWritten DATETIME DEFAULT NULL,
ALTER TABLE basefiles_temp RENAME TO BaseFiles;
CREATE INDEX job_jobtdate_inx ON job (JobTDate);
-ALTER TABLE Pool ADD COLUMN CacheRetention BIGINT DEFAULT 0;
+ALTER TABLE Pool ADD COLUMN CacheRetention BIGINT DEFAULT 0;
+ALTER TABLE File MODIFY FileIndex INTEGER DEFAULT 0;
+ALTER TABLE RestoreObject MODIFY FileIndex INTEGER DEFAULT 0;
+ALTER TABLE BaseFiles MODIFY FileIndex INTEGER DEFAULT 0;
+
UPDATE Version SET VersionId=16;
COMMIT;
if (findex == 0) {
return; /* probably a dummy directory */
}
+ if (findex < 0) findex = -findex;
bsr2.JobId = JobId;
/* Walk down list of bsrs until we find the JobId */
unser_declare;
uint32_t VolSessionId, VolSessionTime;
int32_t Stream;
- uint32_t FileIndex;
+ int32_t FileIndex;
char *p;
int len;
char *fname, *attr;
Dmsg0(120, "bdird: waiting to receive file attributes\n");
/* Pickup file attributes and digest */
while (!fd->errors && (n = bget_dirmsg(fd)) > 0) {
- uint32_t file_index;
+ int32_t file_index;
int stream, len;
char *p, *fn;
char Digest[MAXSTRING]; /* either Verify opts or MD5/SHA1 digest */
* At the end, we have to add the last file
*/
} else if (crypto_digest_stream_type(stream) != CRYPTO_DIGEST_NONE) {
- if (jcr->FileIndex != (uint32_t)file_index) {
+ if (jcr->FileIndex != file_index) {
Jmsg3(jcr, M_ERROR, 0, _("%s index %d not same as attributes %d\n"),
stream_to_ascii(stream), file_index, jcr->FileIndex);
continue;
* When ever we get a digest it MUST have been
* preceded by an attributes record, which sets attr_file_index
*/
- if (jcr->FileIndex != (uint32_t)file_index) {
+ if (jcr->FileIndex != file_index) {
Jmsg2(jcr, M_FATAL, 0, _("MD5/SHA1 index %d not same as attributes %d\n"),
file_index, jcr->FileIndex);
free_pool_memory(fname);
struct f_link *next;
dev_t dev; /* device */
ino_t ino; /* inode with device is unique */
- uint32_t FileIndex; /* Bacula FileIndex of this file */
+ int32_t FileIndex; /* Bacula FileIndex of this file */
int32_t digest_stream; /* Digest type if needed */
uint32_t digest_len; /* Digest len if needed */
char *digest; /* Checksum of the file if needed */
volatile int32_t FDJobStatus; /* File daemon Job Status */
uint32_t ExpectedFiles; /* Expected restore files */
uint32_t MediaId; /* DB record IDs associated with this job */
- uint32_t FileIndex; /* Last FileIndex processed */
+ int32_t FileIndex; /* Last FileIndex processed */
utime_t MaxRunSchedTime; /* max run time in seconds from Initial Scheduled time */
POOLMEM *fname; /* name to put into catalog */
POOLMEM *component_fname; /* Component info file name */
first_block = dup_block(block); /* first block second tape */
}
if (verbose) {
- Pmsg3(000, _("Block not written: FileIndex=%u blk_block=%u Size=%u\n"),
- (unsigned)file_index, block->BlockNumber, block->block_len);
+ Pmsg3(000, _("Block not written: FileIndex=%d blk_block=%u Size=%u\n"),
+ file_index, block->BlockNumber, block->block_len);
dump_block(dev, last_block, _("Last block written"));
Pmsg0(-1, "\n");
dump_block(dev, block, _("Block not written"));
uint32_t VolFirstIndex; /* First file index this Volume */
uint32_t VolLastIndex; /* Last file index this Volume */
- uint32_t FileIndex; /* Current File Index */
+ int32_t FileIndex; /* Current File Index */
uint64_t StartAddr; /* Starting write addr */
uint64_t EndAddr; /* Ending write addr */
int64_t VolMediaId; /* MediaId */