}
if ( dbstat != 0 ) {
- Mmsg3(&mdb->errmsg, _("Unable to connect to DBI interface.\n"
- "Type=%s Database=%s User=%s\n"
- "It is probably not running or your password is incorrect.\n"),
- mdb->db_driver, mdb->db_name, mdb->db_user);
+ Mmsg3(&mdb->errmsg, _("Unable to connect to DBI interface. Type=%s Database=%s User=%s\n"
+ "Possible causes: SQL server not running; password incorrect; max_connections exceeded.\n"),
+ mdb->db_driver, mdb->db_name, mdb->db_user);
V(mutex);
return 0;
}
mdb->db_password==NULL?"(NULL)":mdb->db_password);
if (PQstatus(mdb->db) != CONNECTION_OK) {
- Mmsg2(&mdb->errmsg, _("Unable to connect to PostgreSQL server.\n"
- "Database=%s User=%s\n"
- "It is probably not running or your password is incorrect.\n"),
- mdb->db_name, mdb->db_user);
+ Mmsg2(&mdb->errmsg, _("Unable to connect to PostgreSQL server. Database=%s User=%s\n"
+ "Possible causes: SQL server not running; password incorrect; max_connections exceeded.\n"),
+ mdb->db_name, mdb->db_user);
V(mutex);
return 0;
}
*/
bool db_open_batch_connexion(JCR *jcr, B_DB *mdb)
{
- int multi_db=false;
-
#ifdef HAVE_BATCH_FILE_INSERT
- multi_db=true; /* we force a new connexion only if batch insert is enabled */
+ const int multi_db = true; /* we force a new connection only if batch insert is enabled */
+#else
+ const int multi_db = false;
#endif
if (!jcr->db_batch) {
mdb->db_socket,
multi_db /* multi_db = true when using batch mode */);
if (!jcr->db_batch) {
- Jmsg0(jcr, M_FATAL, 0, "Could not init batch connexion");
+ Mmsg0(&mdb->errmsg, _("Could not init database batch connection"));
+ Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return false;
}
if (!db_open_database(jcr, jcr->db_batch)) {
- POOLMEM *errmsg = get_pool_memory(PM_MESSAGE);
- Mmsg2(&errmsg, _("Could not open database \"%s\": ERR=%s\n"),
+ Mmsg2(&mdb->errmsg, _("Could not open database \"%s\": ERR=%s\n"),
jcr->db_batch->db_name, db_strerror(jcr->db_batch));
- Jmsg1(jcr, M_FATAL, 0, "%s", errmsg);
- free_pool_memory(errmsg);
+ Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return false;
}
Dmsg3(100, "initdb ref=%d connected=%d db=%p\n", jcr->db_batch->ref_count,
* is a single FileName record and a single Path record, no matter
* how many times it occurs. This is this subroutine, we separate
* the file and the path and fill temporary tables with this three records.
+ *
+ * Note: all routines that call this expect to be able to call
+ * db_strerror(mdb) to get the error message, so the error message
+ * MUST be edited into mdb->errmsg before returning an error status.
*/
bool db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
{
/* Open the dedicated connexion */
if (!jcr->batch_started) {
-
if (!db_open_batch_connexion(jcr, mdb)) {
- return false;
+ return false; /* error already printed */
}
if (!sql_batch_start(jcr, jcr->db_batch)) {
Mmsg1(&mdb->errmsg,
"Can't start batch mode: ERR=%s", db_strerror(jcr->db_batch));
- Jmsg1(jcr, M_FATAL, 0, "%s", mdb->errmsg);
+ Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return false;
}
jcr->batch_started = true;
{"status", status_cmd, 1},
{".status", qstatus_cmd, 1},
{"unmount", unmount_cmd, 0},
- {"action_on_purge", action_on_purge_cmd, 0},
+ {"action_on_purge", action_on_purge_cmd, 0},
{"use storage=", use_cmd, 0},
{"run", run_cmd, 0},
// {"query", query_cmd, 0},
Dmsg1(100, "JobId=%u broadcast wait_device_release\n", (uint32_t)jcr->JobId);
pthread_cond_broadcast(&wait_device_release);
}
- Jmsg(jcr, M_INFO, 0, _("Job %s marked to be canceled.\n"), jcr->Job);
+ Jmsg(jcr, M_INFO, 0, _("JobId=%d Job=\"%s\" marked to be canceled.\n"),
+ (int)jcr->JobId, jcr->Job);
dir->fsend(_("3000 Job %s marked to be canceled.\n"), jcr->Job);
free_jcr(jcr);
}
}
}
if (!found) { /* command not found */
- Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg);
- Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
+ if (!job_canceled(jcr)) {
+ Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg);
+ Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
+ }
fd->fsend(ferrmsg);
break;
}