return db_write_batch_file_records(jcr); /* used by bulk batch file insert */
}
+
+/* Small helper to display very long jobid list
+ * The msg format should have a single %s
+ */
+void jmsg_large_jobid_list(JCR *jcr, const char *msg, const char *jobids)
+{
+ sellist sel;
+ char *p;
+
+ sel.set_expanded_limit(120);
+ sel.set_string(jobids, true);
+ p = sel.get_expanded_list();
+ Jmsg(jcr, M_INFO, 0, msg, p);
+
+ sel.free_expanded();
+ while ((p = sel.get_expanded_list()) && p[0]) {
+ Jmsg(jcr, M_INFO, 0, _(" %s\n"), p);
+ sel.free_expanded();
+ }
+}
goto ok_out;
}
- Jmsg(jcr, M_INFO, 0, _("The following %u JobId%s chosen to be %s: %s\n"),
- ids.count, (ids.count < 2) ? _(" was") : _("s were"),
- jcr->get_ActionName(1), ids.list);
+ Mmsg(query, _("The following %u JobId%s chosen to be %s: %%s\n"),
+ ids.count, (ids.count < 2) ? _(" was") : _("s were"),
+ jcr->get_ActionName(1));
+ /* Print the list, but make sure we don't have lines that are too long for Jmsg() */
+ jmsg_large_jobid_list(jcr, query.c_str(), ids.list);
Dmsg2(dbglevel, "Before loop count=%d ids=%s\n", ids.count, ids.list);
/*
extern bool response(JCR *jcr, BSOCK *fd, BSOCK_CLIENT_TYPE role, const char *resp, const char *cmd, e_prtmsg prtmsg);
/* job.c */
+extern void jmsg_large_jobid_list(JCR *jcr, const char *msg, const char *jobids);
extern bool allow_duplicate_job(JCR *jcr);
extern void set_jcr_defaults(JCR *jcr, JOB *job);
extern void create_unique_job_name(JCR *jcr, const char *base_name);
*/
static bool copy_object_list(JCR *jcr, const char *jobids, uint32_t JobId)
{
- /* The batch session is not used anymore at this point */
+ if (jcr->is_canceled()) {
+ return false;
+ }
db_lock(jcr->db_batch);
Mmsg(jcr->db_batch->cmd, copy_object[db_get_type_index(jcr->db_batch)], JobId, jobids, jobids);
if (!db_sql_query(jcr->db_batch, jcr->db_batch->cmd, NULL, NULL)) {
return false;
}
- Jmsg(jcr, M_INFO, 0, _("Using user supplied JobIds=%s\n"),
- jobids.list);
+ jmsg_large_jobid_list(jcr, _("Using user supplied JobIds=%s\n"), jobids.list);
/* Check status */
Mmsg(query,
/* Full by default, or might be Incr/Diff when jobid= is used */
jcr->jr.JobLevel = level_computed;
- Jmsg(jcr, M_INFO, 0, "Consolidating JobIds=%s\n", jobids.list);
+ /* Display the JobId selection and adjust the output for Jmsg */
+ jmsg_large_jobid_list(jcr, _("Consolidating JobIds=%s\n"), jobids.list);
/*
* Now we find the last job that ran and store it's info in
/* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */
wait_for_storage_daemon_termination(jcr);
jcr->setJobStatus(jcr->SDJobStatus);
+
+ /* At this point, the batch SQL link should be open */
+ if (!db_open_batch_connection(jcr, jcr->db)) {
+ Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connection");
+ return false;
+ }
+
if (!flush_file_records(jcr)) { /* cached attribute + batch insert */
Jmsg(jcr, M_ERROR, 0,
_("Unable to flush file records!\n"));
ua = new_ua_context(jcr);
purge_jobs_from_catalog(ua, jobids.list);
free_ua_context(ua);
- Jmsg(jcr, M_INFO, 0, _("Deleted consolidated JobIds=%s\n"), jobids.list);
+
+ jmsg_large_jobid_list(jcr, _("Delete consolidated JobIds=%s\n"), jobids.list);
}
vbackup_cleanup(jcr, jcr->JobStatus);