char *bdb_strerror() { return errmsg; };
bool bdb_check_version(JCR *jcr);
bool bdb_check_settings(JCR *jcr, int64_t *starttime, int val1, int64_t val2);
- bool bdb_open_batch_connexion(JCR *jcr);
+ bool bdb_open_batch_connection(JCR *jcr);
bool bdb_check_max_connections(JCR *jcr, uint32_t max_concurrent_jobs);
virtual const char *search_op(JCR *jcr, const char *table_col, char *value, POOLMEM **esc, POOLMEM **dest);
void bdb_debug_print(JCR *jcr, FILE *fp);
void db_free_restoreobject_record(JCR *jcr, ROBJECT_DBR *rr);
-#define db_open_batch_connexion(jcr, mdb) \
- mdb->bdb_open_batch_connexion(jcr)
+#define db_open_batch_connection(jcr, mdb) \
+ mdb->bdb_open_batch_connection(jcr)
#define db_strerror(mdb) \
mdb->bdb_strerror()
#define db_debug_print(jcr, fp) \
json_list_end(send, ctx, 0, "");
return mdb->sql_num_rows();
}
-
+
/*
- * Open a new connexion to mdb catalog. This function is used
+ * Open a new connection to mdb catalog. This function is used
* by batch and accurate mode.
*/
-bool BDB::bdb_open_batch_connexion(JCR *jcr)
+bool BDB::bdb_open_batch_connection(JCR *jcr)
{
bool multi_db;
/* Open the dedicated connexion */
if (!jcr->batch_started) {
- if (!bdb_open_batch_connexion(jcr)) {
+ if (!bdb_open_batch_connection(jcr)) {
return false; /* error already printed */
}
if (!jcr->db_batch->sql_batch_start(jcr)) {
Dmsg2(200, "jobids=%s nb=%s\n", jobids.list, nb.list);
jcr->file_bsock->fsend("accurate files=%s\n", nb.list);
- if (!db_open_batch_connexion(jcr, jcr->db)) {
- Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connexion");
+ if (!db_open_batch_connection(jcr, jcr->db)) {
+ Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connection");
return false; /* Fail */
}
}
}
- /* TODO: close the batch connection ? (can be used very soon) */
jcr->file_bsock->signal(BNET_EOD);
+
+ /* The connection can be used very soon, but it's taking a lot of resources */
+ dir_close_batch_connection(jcr);
return true;
}
free_and_null_pool_memory(jcr->media_type);
}
+/* Close an existing batch connection */
+void dir_close_batch_connection(JCR *jcr)
+{
+ if (jcr->db_batch) {
+ db_close_database(jcr, jcr->db_batch);
+ jcr->db_batch = NULL;
+ jcr->batch_started = false;
+ }
+}
+
/*
* Free the Job Control Record if no one is still using it.
* Called from main free_jcr() routine in src/lib/jcr.c so
pthread_cond_destroy(&jcr->term_wait);
jcr->term_wait_inited = false;
}
- if (jcr->db_batch) {
- db_close_database(jcr, jcr->db_batch);
- jcr->db_batch = NULL;
- jcr->batch_started = false;
- }
+ dir_close_batch_connection(jcr);
if (jcr->db) {
db_close_database(jcr, jcr->db);
jcr->db = NULL;
}
-
free_and_null_pool_memory(jcr->stime);
free_and_null_pool_memory(jcr->fname);
free_and_null_pool_memory(jcr->pool_source);
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);
+void dir_close_batch_connection(JCR *jcr);
/* jobq.c */
extern bool inc_read_store(JCR *jcr);
#define new_get_file_list
#ifdef new_get_file_list
- if (!db_open_batch_connexion(jcr, jcr->db)) {
- Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connexion");
+ if (!db_open_batch_connection(jcr, jcr->db)) {
+ Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connection");
return false;
}
/* If the new Job is a Full, we don't need to keep deleted records,
jcr->ExpectedFiles);
free_ua_context(ua);
free_bsr(rx.bsr_list);
+ dir_close_batch_connection(jcr);
return jcr->ExpectedFiles==0?false:true;
}