continue;
}
/* Get Progress: files, bytes, bytes/sec */
- if (role==BSOCK_TYPE_FD && bs->msg[0] == 'P') { /* Progress report */
+ if (bs->msg[0] == 'P') { /* Progress report */
uint32_t files, bps;
uint64_t bytes;
if ((sscanf(bs->msg, "Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n",
}
wsd = wjcr->store_bsock;
+ /* Send progress information for the Storage Daemon Job, will fill
+ * information from "status dir"
+ */
+ wsd->fsend("sendprogress\n");
+
/*
* Start conversation with read Storage daemon
*/
goto bail_out;
}
sd = jcr->store_bsock;
+
+ /* Send progress information for the Storage Daemon Job, will fill
+ * information from "status dir"
+ */
+ sd->fsend("sendprogress\n");
+
if (jcr->client) {
jcr->sd_calls_client = jcr->client->sd_calls_client;
}
bctx.jcr = jcr;
- time_t now = time(NULL);
- if (jcr->last_stat_time == 0) {
- jcr->last_stat_time = now;
- jcr->stat_interval = 30; /* Default 30 seconds */
- } else if (now >= jcr->last_stat_time + jcr->stat_interval) {
- jcr->dir_bsock->fsend("Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n",
- jcr->JobId, jcr->JobFiles, jcr->JobBytes, jcr->LastRate);
- jcr->last_stat_time = now;
- }
+ jcr->sendProgressStatus();
if (jcr->is_canceled() || jcr->is_incomplete()) {
Dmsg0(100, "Job canceled by user or marked incomplete.\n");
/* TODO remove the ifdef as soon as the feature has been well tested */
jcr->set_killable(true);
#endif /*DEVELOPER*/
+ jcr->stat_interval = 0; /* Always send progress status */
jcr->sd_calls_client_bsock = NULL;
jcr->sd_calls_client = false;
jcr->ff = init_find_files();
Dsm_check(200);
while ((bget_ret = fdmsg->bget_msg(&bmsg)) >= 0 && !job_canceled(jcr)) {
- time_t now = time(NULL);
- if (jcr->last_stat_time == 0) {
- jcr->last_stat_time = now;
- jcr->stat_interval = 30; /* Default 30 seconds */
- } else if (now >= jcr->last_stat_time + jcr->stat_interval) {
- jcr->dir_bsock->fsend("Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n",
- jcr->JobId, jcr->JobFiles, jcr->JobBytes, jcr->LastRate);
- jcr->last_stat_time = now;
- }
+ jcr->sendProgressStatus();
/* Remember previous stream type */
rctx.prev_stream = rctx.stream;
* Get a record from the Storage daemon
*/
while ((bget_ret = fdmsg->bget_msg(&bmsg)) >= 0 && !job_canceled(jcr)) {
+ jcr->sendProgressStatus();
+
/* Remember previous stream type */
vctx.prev_stream = vctx.stream;
char *job_group; /* Specific permission for a job */
POOLMEM *StatusErrMsg; /* Error message displayed in the job report */
char StatusInfo[MAX_NAME_LENGTH]; /* Additionnal information about the error status */
+ time_t last_stat_time; /* Last time stats sent to Dir */
+ time_t stat_interval; /* Stats send interval default 30s, set to -1 to disable */
uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */
+ bool sendProgressStatus(); /* Send the progress status to the dir (SD/FD) */
/* Daemon specific part of JCR */
/* This should be empty in the library */
BXATTR *bxattr; /* Extended Attributes for backup/restore */
int32_t last_type; /* type of last file saved/verified */
int incremental; /* set if incremental for SINCE */
- time_t last_stat_time; /* Last time stats sent to Dir */
- time_t stat_interval; /* Stats send interval */
utime_t mtime; /* begin time for SINCE */
int listing; /* job listing in estimate */
long Ticket; /* Ticket */
jcr->setJobLevel(L_NONE);
jcr->setJobStatus(JS_Created); /* ready to run */
jcr->job_task = JOB_TASK_ZERO;
+ jcr->stat_interval = -1;
#ifndef HAVE_WIN32
struct sigaction sigtimer;
sigtimer.sa_flags = 0;
return priority;
}
+#define Job_Progress "Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n"
+/*
+ * Send Current progress status
+ */
+bool JCR::sendProgressStatus()
+{
+ if (stat_interval < 0) { /* Disabled */
+ return true;
+ }
+ if (dir_bsock) {
+ time_t now = time(NULL);
+ if (stat_interval == 0) {
+ stat_interval = 30; /* Default 30 seconds */
+ }
+ if (last_stat_time == 0) {
+ last_stat_time = now;
+
+ } else if (now >= last_stat_time + stat_interval) {
+ dir_bsock->fsend("Progress JobId=%ld files=%ld bytes=%lld bps=%ld\n",
+ JobId, JobFiles, JobBytes, LastRate);
+ last_stat_time = now;
+ }
+ }
+ return true;
+}
+
/*
* Send Job status to Director
* ATTN: Only the SD like components are expected to send there job status
rec.FileIndex, rec.VolSessionId,
stream_to_ascii(buf1, rec.Stream,rec.FileIndex),
rec.data_len);
+
+ jcr->sendProgressStatus();
+
/*
* Check for any last minute Storage daemon preparation
* of the files being backed up proir to doing so. E.g.
int Slot, int relabel);
static bool try_autoload_device(JCR *jcr, DCR *dcr, int slot, const char *VolName);
static void send_dir_busy_message(BSOCK *dir, DEVICE *dev);
+static bool sd_sendprogress_cmd(JCR *jcr);
bool user_shstore_lock(DCR *dcr);
void user_shstore_unlock(DCR *dcr);
bool dedup_cmd(JCR *jcr); /* BEEF */
{"run", run_cmd, 0},
{"statistics", collect_cmd, 0},
{"store_mngr", query_store, 0},
+ {"sendprogress", sd_sendprogress_cmd, 0},
// {"query", query_cmd, 0},
{NULL, NULL} /* list terminator */
};
}
}
+/* Send progress information to the director if needed (for copy/migration in general) */
+static bool sd_sendprogress_cmd(JCR *jcr)
+{
+ jcr->stat_interval = 60;
+ return true;
+}
+
+
#if COMMUNITY
bool user_shstore_lock(DCR *dcr) { return true; }
* Otherwise we do the commands that the client sends
* which are for normal backup or restore jobs.
*/
- Dmsg3(050, "==== JobType=%c run_job=%d sd_client=%d\n", jcr->getJobType(), jcr->JobId, jcr->sd_client);
+ Dmsg3(50, "==== JobType=%c run_job=%d sd_client=%d\n", jcr->getJobType(), jcr->JobId, jcr->sd_client);
if (jcr->is_JobType(JT_BACKUP) && jcr->sd_client) {
jcr->session_opened = true;
Dmsg0(050, "Do: receive for 3000 OK data then append\n");
FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId,
stream_to_ascii(buf2, rec->Stream, rec->FileIndex), rec->data_len);
+ jcr->sendProgressStatus();
return ok;
}