);
CREATE TABLE RestoreObject (
- RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT;
+ RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Fname BLOB NOT NULL,
Path BLOB NOT NULL,
RestoreObject BLOB NOT NULL,
CREATE TABLE file
(
- fileid bigserial not null,
+ fileid bigserial not null,
fileindex integer not null default 0,
jobid integer not null,
pathid integer not null,
-- CREATE INDEX file_pathid_idx on file(pathid);
-- CREATE INDEX file_filenameid_idx on file(filenameid);
+CREATE TABLE RestoreObject (
+ RestoreObjectId SERIAL NOT NULL,
+ Fname TEXT NOT NULL,
+ Path TEXT NOT NULL,
+ RestoreObject TEXT NOT NULL,
+ PluginName TEXT NOT NULL,
+ ObjectIndex INTEGER DEFAULT 0,
+ ObjectType INTEGER DEFAULT 0,
+ FileIndex INTEGER UNSIGNED DEFAULT 0,
+ JobId INTEGER UNSIGNED,
+ PRIMARY KEY(RestoreObjectId),
+ );
+CREATE INDEX restore_jobid_idx on file(JobId);
+
+
CREATE TABLE Job
(
- JobId serial not null,
- Job text not null,
- Name text not null,
- Type char(1) not null,
- Level char(1) not null,
- ClientId integer default 0,
- JobStatus char(1) not null,
- SchedTime timestamp without time zone,
- StartTime timestamp without time zone,
- EndTime timestamp without time zone,
+ JobId serial not null,
+ Job text not null,
+ Name text not null,
+ Type char(1) not null,
+ Level char(1) not null,
+ ClientId integer default 0,
+ JobStatus char(1) not null,
+ SchedTime timestamp without time zone,
+ StartTime timestamp without time zone,
+ EndTime timestamp without time zone,
RealEndTime timestamp without time zone,
- JobTDate bigint default 0,
- VolSessionId integer default 0,
- volSessionTime integer default 0,
- JobFiles integer default 0,
- JobBytes bigint default 0,
- ReadBytes bigint default 0,
- JobErrors integer default 0,
- JobMissingFiles integer default 0,
- PoolId integer default 0,
- FilesetId integer default 0,
- PriorJobid integer default 0,
- PurgedFiles smallint default 0,
- HasBase smallint default 0,
- HasCache smallint default 0,
- Reviewed smallint default 0,
- Comment text,
+ JobTDate bigint default 0,
+ VolSessionId integer default 0,
+ volSessionTime integer default 0,
+ JobFiles integer default 0,
+ JobBytes bigint default 0,
+ ReadBytes bigint default 0,
+ JobErrors integer default 0,
+ JobMissingFiles integer default 0,
+ PoolId integer default 0,
+ FilesetId integer default 0,
+ PriorJobid integer default 0,
+ PurgedFiles smallint default 0,
+ HasBase smallint default 0,
+ HasCache smallint default 0,
+ Reviewed smallint default 0,
+ Comment text,
primary key (jobid)
);
'Error','Busy','Used','Cleaning','Scratch')),
enabled smallint default 1,
recycle smallint default 0,
- ActionOnPurge smallint default 0,
+ ActionOnPurge smallint default 0,
volretention bigint default 0,
voluseduration bigint default 0,
maxvoljobs integer default 0,
maxvolbytes bigint default 0,
autoprune smallint default 0,
recycle smallint default 0,
- ActionOnPurge smallint default 0,
+ ActionOnPurge smallint default 0,
pooltype text
check (pooltype in ('Backup','Copy','Cloned','Archive','Migration','Scratch')),
labeltype integer default 0,
);
CREATE INDEX pathhierarchy_ppathid
- ON PathHierarchy (PPathId);
+ ON PathHierarchy (PPathId);
CREATE TABLE PathVisibility
(
CONSTRAINT pathvisibility_pkey PRIMARY KEY (JobId, PathId)
);
CREATE INDEX pathvisibility_jobid
- ON PathVisibility (JobId);
+ ON PathVisibility (JobId);
CREATE TABLE version
(
MD5 VARCHAR(255) NOT NULL,
PRIMARY KEY(FileId)
);
-
CREATE INDEX inx3 ON File (JobId);
CREATE INDEX file_jpf_idx ON File (JobId, PathId, FilenameId);
--
-- CREATE INDEX inx4 ON File (PathId);
-- CREATE INDEX inx5 ON File (FileNameId);
+
+CREATE TABLE RestoreObject (
+ RestoreObjectId INTEGER,
+ Fname TEXT DEFAULT '',
+ Path TEXT DEFAULT '',
+ RestoreObject TEXT DEFAULT '',
+ PluginName TEXT DEFAULT '',
+ ObjectIndex INTEGER DEFAULT 0,
+ ObjectType INTEGER DEFAULT 0,
+ FileIndex INTEGER UNSIGNED DEFAULT 0,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ PRIMARY KEY(RestoreObjectId),
+ INDEX (JobId)
+ );
+CREATE INDEX restore_jobid_idx ON RestoreObject (JobId);
+
+
CREATE TABLE Job (
JobId INTEGER,
Job VARCHAR(128) NOT NULL,
VolStatus VARCHAR(20) NOT NULL,
Enabled TINYINT DEFAULT 1,
Recycle TINYINT DEFAULT 0,
- ActionOnPurge TINYINT DEFAULT 0,
+ ActionOnPurge TINYINT DEFAULT 0,
VolRetention BIGINT UNSIGNED DEFAULT 0,
VolUseDuration BIGINT UNSIGNED DEFAULT 0,
MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
AutoPrune TINYINT DEFAULT 0,
Recycle TINYINT DEFAULT 0,
- ActionOnPurge TINYINT DEFAULT 0,
+ ActionOnPurge TINYINT DEFAULT 0,
PoolType VARCHAR(20) NOT NULL,
LabelType TINYINT DEFAULT 0,
LabelFormat VARCHAR(128) NOT NULL,
);
CREATE INDEX pathhierarchy_ppathid
- ON PathHierarchy (PPathId);
+ ON PathHierarchy (PPathId);
CREATE TABLE PathVisibility
(
);
CREATE INDEX pathvisibility_jobid
- ON PathVisibility (JobId);
+ ON PathVisibility (JobId);
CREATE TABLE Status (
JobStatus CHAR(1) NOT NULL,
Dmsg1(dbglevel, "Fname=%s\n", ro->fname);
Dmsg0(dbglevel, "put_object_into_catalog\n");
- split_path_and_file(jcr, mdb, ro->fname);
+ split_path_and_file(jcr, mdb, ro->full_fname);
mdb->esc_name = check_pool_memory_size(mdb->esc_name, mdb->fnl*2+1);
db_escape_string(jcr, mdb, mdb->esc_name, mdb->fname, mdb->fnl);
db_escape_string(jcr, mdb, esc_obj, ro->object, ro->object_len);
Mmsg(mdb->cmd,
- "INSERT INTO RestoreObject (Fname,Path,PluginName,RestoreObject"
+ "INSERT INTO RestoreObject (Fname,Path,PluginName,RestoreObject,"
"ObjectIndex,ObjectType,FileIndex,JobId) VALUES"
"('%s','%s','%s','%s',%d,%d,%d,%u)",
- ro->fname, ro->path, ro->plugin_name, esc_obj, ro->object_len,
+ mdb->esc_name, mdb->esc_path, mdb->esc_path, esc_obj, ro->object_len,
ro->ObjectIndex, FT_RESTORE_FIRST, ro->FileIndex, ro->JobId);
ro->RestoreObjectId = sql_insert_id(mdb, mdb->cmd, NT_("RestoreObject"));
uint32_t VolSessionId, VolSessionTime;
int32_t Stream;
uint32_t FileIndex;
- uint32_t data_len;
char *p;
int len;
char *fname, *attr;
ATTR_DBR *ar = NULL;
+ uint32_t reclen;
/* Start transaction allocates jcr->attr and jcr->ar if needed */
db_start_transaction(jcr, jcr->db); /* start transaction if not already open */
unser_uint32(VolSessionTime); /* VolSessionTime */
unser_int32(FileIndex); /* FileIndex */
unser_int32(Stream); /* Stream */
- unser_uint32(data_len); /* Record length */
+ unser_uint32(reclen); /* Record length */
p += unser_length(p); /* Raw record follows */
/*
*/
Dmsg1(400, "UpdCat msg=%s\n", msg);
- Dmsg5(400, "UpdCat VolSessId=%d VolSessT=%d FI=%d Strm=%d data_len=%d\n",
- VolSessionId, VolSessionTime, FileIndex, Stream, data_len);
+ Dmsg5(400, "UpdCat VolSessId=%d VolSessT=%d FI=%d Strm=%d reclen=%d\n",
+ VolSessionId, VolSessionTime, FileIndex, Stream, reclen);
if (Stream == STREAM_UNIX_ATTRIBUTES || Stream == STREAM_UNIX_ATTRIBUTES_EX) {
if (jcr->cached_attribute) {
ROBJECT_DBR ro;
POOLMEM *attrEx = get_pool_memory(PM_MESSAGE);
char *p;
+ memset(&ro, 0, sizeof(ro));
ro.full_fname = fname;
ro.Stream = Stream;
ro.FileType = ar->FileType;
while (*p++ != 0) /* skip link */
{ }
/* We have an object, so do a binary copy */
- ro.object_len = msglen + ar->attr - p;
+ ro.object_len = msglen + jcr->attr - p;
attrEx = check_pool_memory_size(attrEx, ro.object_len + 1);
memcpy(attrEx, p, ro.object_len);
ro.object = attrEx;
/* Add a EOS for those who attempt to print the object */
p = attrEx + ro.object_len;
*p = 0;
+ Dmsg7(000, "fname=%s stream=%d FT=%d FI=%d JobId=%d, obj_len=%d\nobj=\"%s\"\n",
+ ro.full_fname, ro.Stream, ro.FileType, ro.FileIndex, ro.JobId,
+ ro.object_len, attrEx);
/* Send it */
if (!db_create_restore_object_record(jcr, jcr->db, &ro)) {
Jmsg1(jcr, M_FATAL, 0, _("Restore object create error. %s"), db_strerror(jcr->db));
sd->bstrerror());
return false;
}
- Dmsg1(50, "send: %s\n", sd->msg);
+ Dmsg1(50, "send plugin name hdr: %s\n", sd->msg);
if (start) {
/* Send data -- not much */
sd->bstrerror());
return false;
}
- Dmsg1(dbglvl, "send: %s\n", sd->msg);
+ Dmsg1(dbglvl, "send plugin start/end: %s\n", sd->msg);
sd->signal(BNET_EOD); /* indicate end of plugin name data */
return true;
}
if (!blast_data_to_storage_daemon(jcr, NULL)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
bnet_suppress_error_messages(sd, 1);
- bget_msg(sd); /* Read final response from append_data */
Dmsg0(110, "Error in blast_data.\n");
} else {
set_jcr_job_status(jcr, JS_Terminated);
bool ok = true;
if (errors || is_terminated() || msglen > 1000000) {
+ if (!m_suppress_error_msgs) {
+ Qmsg6(m_jcr, M_ERROR, 0,
+ _("Socket has errors=%d; is_terminated=%d; or has insane msglen=%d on call to %s:%s:%d\n"),
+ errors, is_terminated(), msglen, m_who,
+ m_host, m_port);
+ }
return false;
}
if (m_use_locking) P(m_mutex);
}
time_t now = time(NULL);
sp->fname = p_ctx->fname;
+ sp->object = (char *)"This is test data for the restore object.";
+ sp->object_len = strlen(sp->object);
+ sp->index = 2;
sp->type = FT_RESTORE_FIRST;
sp->statp.st_mode = 0700 | S_IFREG;
sp->statp.st_ctime = now;
sp->statp.st_mtime = now;
sp->statp.st_atime = now;
- sp->statp.st_size = -1;
+ sp->statp.st_size = sp->object_len;
sp->statp.st_blksize = 4096;
sp->statp.st_blocks = 1;
- sp->object = (char *)"This is test data for the restore object.";
- sp->object_len = strlen(sp->object);
- sp->index = 2;
p_ctx->backup = true;
printf("test-plugin-fd: startBackupFile\n");
return bRC_OK;
*/
static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
{
- printf("test-plugin-fd: pluginIO\n");
- return bRC_Error;
+ struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
+ if (!p_ctx) {
+ return bRC_Error;
+ }
+
+ io->status = 0;
+ io->io_errno = 0;
+ return bRC_OK;
}
/*
label storage=File1 volume=TestVolume001
setdebug level=150 client=$CLIENT
estimate job=$JobName level=Full
-setdebug level=50 client=$CLIENT
+@#setdebug level=150 client=$CLIENT
+@#setdebug level=150 storage=File1
run job=$JobName storage=File1 yes
wait
status client=$CLIENT