void BDB_MYSQL::bdb_end_transaction(JCR *jcr)
{
- if (jcr && jcr->cached_attribute) {
- Dmsg0(400, "Flush last cached attribute.\n");
- if (!bdb_create_attributes_record(jcr, jcr->ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror());
- }
- jcr->cached_attribute = false;
- }
}
/*
{
BDB_POSTGRESQL *mdb = this;
- if (jcr && jcr->cached_attribute) {
- Dmsg0(dbglvl_info, "Flush last cached attribute.\n");
- if (!bdb_create_attributes_record(jcr, jcr->ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror());
- }
- jcr->cached_attribute = false;
- }
-
if (!mdb->m_allow_transactions) {
return;
}
if (!mdb->m_transaction) {
sql_query("BEGIN"); /* begin transaction */
Dmsg0(400, "Start SQLite transaction\n");
- mdb->m_transaction = true;
+ mdb->m_transaction = true;
}
bdb_unlock();
}
void BDB_SQLITE::bdb_end_transaction(JCR *jcr)
{
BDB_SQLITE *mdb = this;
-
- if (jcr && jcr->cached_attribute) {
- Dmsg0(400, "Flush last cached attribute.\n");
- if (!bdb_create_attributes_record(jcr, jcr->ar)) {
- Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror());
- }
- jcr->cached_attribute = false;
- }
-
if (!mdb->m_allow_transactions) {
return;
}
/* Pickup Job termination data */
stat = wait_for_job_termination(jcr);
- db_write_batch_file_records(jcr); /* used by bulk batch file insert */
+
+ flush_file_records(jcr); /* cached attribute + batch insert */
if (jcr->HasBase) {
db_commit_base_file_attributes_record(jcr, jcr->db);
free_jcr(ljcr);
return ok;
}
+
+bool flush_file_records(JCR *jcr)
+{
+ if (jcr->cached_attribute) {
+ Dmsg0(400, "Flush last cached attribute.\n");
+ if (!db_create_attributes_record(jcr, jcr->db, jcr->ar)) {
+ Jmsg1(jcr, M_FATAL, 0, _("Attribute create error. %s"), jcr->db->bdb_strerror());
+ }
+ jcr->cached_attribute = false;
+ }
+
+ return db_write_batch_file_records(jcr); /* used by bulk batch file insert */
+}
wjcr->setJobStatus(wjcr->SDJobStatus);
wait_for_storage_daemon_termination(jcr);
jcr->setJobStatus(jcr->SDJobStatus);
- db_write_batch_file_records(wjcr); /* used by bulk batch file insert */
+
+ flush_file_records(wjcr); /* cached attribute + batch insert */
ok = jcr->is_JobStatus(JS_Terminated) && wjcr->is_JobStatus(JS_Terminated);
extern bool run_console_command(JCR *jcr, const char *cmd);
extern void sd_msg_thread_send_signal(JCR *jcr, int sig);
void terminate_sd_msg_chan_thread(JCR *jcr);
+bool flush_file_records(JCR *jcr);
/* jobq.c */
extern bool inc_read_store(JCR *jcr);
/* Note, the SD stores in jcr->JobFiles/ReadBytes/JobBytes/JobErrors */
wait_for_storage_daemon_termination(jcr);
jcr->setJobStatus(jcr->SDJobStatus);
- db_write_batch_file_records(jcr); /* used by bulk batch file insert */
+ flush_file_records(jcr); /* cached attribute + batch insert */
+
if (jcr->JobStatus != JS_Terminated) {
return false;
}
jcr->SDJobStatus = JS_Terminated;
get_attributes_and_put_in_catalog(jcr);
db_end_transaction(jcr, jcr->db); /* terminate any open transaction */
- db_write_batch_file_records(jcr);
+ flush_file_records(jcr); /* cached attribute + batch insert */
break;
case L_VERIFY_DATA: