/* Commands sent to File daemon */
static char backupcmd[] = "backup\n";
static char storaddr[] = "storage address=%s port=%d ssl=%d\n";
-static char levelcmd[] = "level = %s%s\n";
+static char levelcmd[] = "level = %s%s mtime_only=%d\n";
/* Responses received from File daemon */
-static char OKbackup[] = "2000 OK backup\n";
-static char OKstore[] = "2000 OK storage\n";
-static char OKlevel[] = "2000 OK level\n";
-static char EndBackup[] = "2801 End Backup Job TermCode=%d JobFiles=%u "
- "ReadBytes=%" lld " JobBytes=%" lld " Errors=%u\n";
+static char OKbackup[] = "2000 OK backup\n";
+static char OKstore[] = "2000 OK storage\n";
+static char OKlevel[] = "2000 OK level\n";
+static char EndJob[] = "2800 End Job TermCode=%d JobFiles=%u "
+ "ReadBytes=%" lld " JobBytes=%" lld " Errors=%u\n";
/* Forward referenced functions */
static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr);
-static int wait_for_job_termination(JCR *jcr);
/* External functions */
}
jcr->jr.FileSetId = fsr.FileSetId;
if (fsr.created) {
- Jmsg(jcr, M_INFO, 0, _("Created new FileSet record \"%s\" at %s\n"),
+ Jmsg(jcr, M_INFO, 0, _("Created new FileSet record \"%s\" %s\n"),
fsr.FileSet, fsr.cCreateTime);
}
Dmsg2(119, "Created FileSet %s record %u\n", jcr->fileset->hdr.name,
jcr->jr.JobId = 0;
if (!db_find_job_start_time(jcr, jcr->db, &jcr->jr, &jcr->stime)) {
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. Doing FULL backup.\n"));
bsnprintf(since, sizeof(since), " (upgraded from %s)",
level_to_str(jcr->jr.Level));
jcr->JobLevel = jcr->jr.Level = L_FULL;
*/
switch (jcr->JobLevel) {
case L_BASE:
- bnet_fsend(fd, levelcmd, "base", " ");
+ bnet_fsend(fd, levelcmd, "base", " ", 0);
break;
case L_FULL:
- bnet_fsend(fd, levelcmd, "full", " ");
+ bnet_fsend(fd, levelcmd, "full", " ", 0);
break;
case L_DIFFERENTIAL:
case L_INCREMENTAL:
- bnet_fsend(fd, levelcmd, "since ", jcr->stime);
- free_pool_memory(jcr->stime);
- jcr->stime = NULL;
+ bnet_fsend(fd, levelcmd, "since ", jcr->stime, 0);
break;
case L_SINCE:
default:
return 1;
bail_out:
- if (jcr->stime) {
- free_pool_memory(jcr->stime);
- jcr->stime = NULL;
- }
backup_cleanup(jcr, JS_ErrorTerminated, since, &fsr);
return 0;
-
}
/*
* Here we wait for the File daemon to signal termination,
* then we wait for the Storage daemon. When both
* are done, we return the job status.
+ * Also used by restore.c
*/
-static int wait_for_job_termination(JCR *jcr)
+int wait_for_job_termination(JCR *jcr)
{
int32_t n = 0;
BSOCK *fd = jcr->file_bsock;
int fd_ok = FALSE;
+ uint32_t JobFiles, Errors;
+ uint64_t ReadBytes, JobBytes;
set_jcr_job_status(jcr, JS_Running);
/* Wait for Client to terminate */
while ((n = bget_dirmsg(fd)) >= 0) {
- if (sscanf(fd->msg, EndBackup, &jcr->FDJobStatus, &jcr->JobFiles,
- &jcr->ReadBytes, &jcr->JobBytes, &jcr->Errors) == 5) {
+ if (!fd_ok && sscanf(fd->msg, EndJob, &jcr->FDJobStatus, &JobFiles,
+ &ReadBytes, &JobBytes, &Errors) == 5) {
fd_ok = TRUE;
set_jcr_job_status(jcr, jcr->FDJobStatus);
Dmsg1(100, "FDStatus=%c\n", (char)jcr->JobStatus);
}
}
if (is_bnet_error(fd)) {
- Jmsg(jcr, M_FATAL, 0, _("Network error with FD during BACKUP: ERR=%s\n"),
- bnet_strerror(fd));
+ Jmsg(jcr, M_FATAL, 0, _("Network error with FD during %s: ERR=%s\n"),
+ job_type_to_str(jcr->JobType), bnet_strerror(fd));
}
bnet_sig(fd, BNET_TERMINATE); /* tell Client we are terminating */
+ /* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/Errors */
wait_for_storage_daemon_termination(jcr);
- /* Return the first error status we find FD or SD */
- if (fd_ok && jcr->JobStatus != JS_Terminated) {
- return jcr->JobStatus;
+ /* Return values from FD */
+ if (fd_ok) {
+ jcr->JobFiles = JobFiles;
+ jcr->Errors = Errors;
+ jcr->ReadBytes = ReadBytes;
+ jcr->JobBytes = JobBytes;
}
+
+// Dmsg4(000, "fd_ok=%d FDJS=%d JS=%d SDJS=%d\n", fd_ok, jcr->FDJobStatus,
+// jcr->JobStatus, jcr->SDJobStatus);
+
+ /* Return the first error status we find Dir, FD, or SD */
if (!fd_ok || is_bnet_error(fd)) {
- return JS_ErrorTerminated;
+ jcr->FDJobStatus = JS_ErrorTerminated;
+ }
+ if (jcr->JobStatus != JS_Terminated) {
+ return jcr->JobStatus;
+ }
+ if (jcr->FDJobStatus != JS_Terminated) {
+ return jcr->FDJobStatus;
}
return jcr->SDJobStatus;
}
Bytes Written: %s\n\
Rate: %.1f KB/s\n\
Software Compression: %s\n\
-Volume names(s): %s\n\
+Volume name(s): %s\n\
Volume Session Id: %d\n\
Volume Session Time: %d\n\
Last Volume Bytes: %s\n\