support_dbi=yes
db_type=DBI
DB_TYPE=dbi
+ uncomment_dbi=" "
else
AC_MSG_RESULT(no)
AC_SUBST(SQL_INCLUDE)
AC_SUBST(SQL_BINDIR)
AC_SUBST(DBI_DBD_DRIVERDIR)
+AC_SUBST(uncomment_dbi)
])
)
AC_SUBST(db_password)
+#
+# Pickup a database port
+#
+db_port=" "
+AC_ARG_WITH(db_port,
+ [ --with-db-port=DBPORT specify a database port (default null)],
+ [
+ if test "x$withval" != "x" ; then
+ db_port=$withval
+ fi
+ ]
+)
+AC_SUBST(db_port)
+
#
# Handle users and groups for each daemon
#
else
support_batch_insert=yes
fi])
- fi
+ fi
+else
+# If dbi was not chosen, let the comment in file
+uncomment_dbi="#"
fi
+AC_SUBST(uncomment_dbi)
+
if test $support_batch_insert = yes ; then
AC_DEFINE(HAVE_BATCH_FILE_INSERT, 1, [Set if DB batch insert code enabled])
fi
Statically Linked DIR: ${support_static_dir}
Statically Linked CONS: ${support_static_cons}
Database type: ${db_type}
+ Database port: ${db_port}
Database lib: ${DB_LIBS}
Database name: ${db_name}
Database user: ${db_user}
db_name
db_user
db_password
+db_port
dir_user
dir_group
sd_user
SQL_INCLUDE
SQL_BINDIR
DBI_DBD_DRIVERDIR
+uncomment_dbi
DB_PROG
DB_PROG_LIB
cats
--with-db-name=DBNAME specify database name (default bacula)
--with-db-user=UNAME specify database user (default bacula)
--with-db-password=UNAME specify database password (default *none*)
+ --with-db-port=DBPORT specify a database port (default null)
--with-dir-user=USER specify user for Director daemon
--with-dir-group=GROUP specify group for Director daemon
--with-sd-user=USER specify user for Storage daemon
+#
+# Pickup a database port
+#
+db_port=" "
+
+# Check whether --with-db_port was given.
+if test "${with_db_port+set}" = set; then
+ withval=$with_db_port;
+ if test "x$withval" != "x" ; then
+ db_port=$withval
+ fi
+
+
+fi
+
+
+
#
# Handle users and groups for each daemon
#
support_dbi=yes
db_type=DBI
DB_TYPE=dbi
+ uncomment_dbi=" "
else
{ echo "$as_me:$LINENO: result: no" >&5
+
db_found=no
db_prog=no
{ echo "$as_me:$LINENO: checking for DBI drivers support" >&5
fi
fi
+else
+# If dbi was not chosen, let the comment in file
+uncomment_dbi="#"
fi
+
+
if test $support_batch_insert = yes ; then
cat >>confdefs.h <<\_ACEOF
db_name!$db_name$ac_delim
db_user!$db_user$ac_delim
db_password!$db_password$ac_delim
+db_port!$db_port$ac_delim
dir_user!$dir_user$ac_delim
dir_group!$dir_group$ac_delim
sd_user!$sd_user$ac_delim
SQL_INCLUDE!$SQL_INCLUDE$ac_delim
SQL_BINDIR!$SQL_BINDIR$ac_delim
DBI_DBD_DRIVERDIR!$DBI_DBD_DRIVERDIR$ac_delim
+uncomment_dbi!$uncomment_dbi$ac_delim
DB_PROG!$DB_PROG$ac_delim
DB_PROG_LIB!$DB_PROG_LIB$ac_delim
cats!$cats$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 59; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 61; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Statically Linked DIR: ${support_static_dir}
Statically Linked CONS: ${support_static_cons}
Database type: ${db_type}
+ Database port: ${db_port}
Database lib: ${DB_LIBS}
Database name: ${db_name}
Database user: ${db_user}
Catalog {
Name = MyCatalog
# Uncomment the following line if you want the dbi driver
-# dbdriver = "dbi:mysql"; dbaddress = 127.0.0.1; dbport = 3306
+@uncomment_dbi@ dbdriver = "dbi:@DB_TYPE@"; dbaddress = 127.0.0.1; dbport = @db_port@
dbname = "@db_name@"; dbuser = "@db_user@"; dbpassword = "@db_password@"
}
/* check MaxWaitTime */
if (job_check_maxwaittime(jcr)) {
set_jcr_job_status(jcr, JS_Canceled);
- Jmsg(jcr, M_FATAL, 0, _("Max wait time exceeded. Job canceled.\n"));
+ Qmsg(jcr, M_FATAL, 0, _("Max wait time exceeded. Job canceled.\n"));
cancel = true;
/* check MaxRunTime */
} else if (job_check_maxruntime(jcr)) {
set_jcr_job_status(jcr, JS_Canceled);
- Jmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n"));
+ Qmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n"));
cancel = true;
/* check MaxRunSchedTime */
} else if (job_check_maxschedruntime(jcr)) {
set_jcr_job_status(jcr, JS_Canceled);
- Jmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n"));
+ Qmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n"));
cancel = true;
}
lock_jcr_chain();
jcr->dec_use_count(); /* decrement use count */
if (jcr->use_count() < 0) {
- Emsg2(M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"),
+ Jmsg2(jcr, M_ERROR, 0, _("JCR use_count=%d JobId=%d\n"),
jcr->use_count(), jcr->JobId);
}
if (jcr->JobId > 0) {
break;
default:
break;
-
}
+
if (jcr->daemon_free_jcr) {
jcr->daemon_free_jcr(jcr); /* call daemon free routine */
}
static void jcr_timeout_check(watchdog_t *self)
{
JCR *jcr;
- BSOCK *fd;
+ BSOCK *bs;
time_t timer_start;
Dmsg0(dbglvl, "Start JCR timeout checks\n");
if (jcr->JobId == 0) {
continue;
}
- fd = jcr->store_bsock;
- if (fd) {
- timer_start = fd->timer_start;
- if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
- fd->timer_start = 0; /* turn off timer */
- fd->set_timed_out();
- Jmsg(jcr, M_ERROR, 0, _(
+ bs = jcr->store_bsock;
+ if (bs) {
+ timer_start = bs->timer_start;
+ if (timer_start && (watchdog_time - timer_start) > bs->timeout) {
+ bs->timer_start = 0; /* turn off timer */
+ bs->set_timed_out();
+ Qmsg(jcr, M_ERROR, 0, _(
"Watchdog sending kill after %d secs to thread stalled reading Storage daemon.\n"),
watchdog_time - timer_start);
pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
}
}
- fd = jcr->file_bsock;
- if (fd) {
- timer_start = fd->timer_start;
- if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
- fd->timer_start = 0; /* turn off timer */
- fd->set_timed_out();
- Jmsg(jcr, M_ERROR, 0, _(
+ bs = jcr->file_bsock;
+ if (bs) {
+ timer_start = bs->timer_start;
+ if (timer_start && (watchdog_time - timer_start) > bs->timeout) {
+ bs->timer_start = 0; /* turn off timer */
+ bs->set_timed_out();
+ Qmsg(jcr, M_ERROR, 0, _(
"Watchdog sending kill after %d secs to thread stalled reading File daemon.\n"),
watchdog_time - timer_start);
pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
}
}
- fd = jcr->dir_bsock;
- if (fd) {
- timer_start = fd->timer_start;
- if (timer_start && (watchdog_time - timer_start) > fd->timeout) {
- fd->timer_start = 0; /* turn off timer */
- fd->set_timed_out();
- Jmsg(jcr, M_ERROR, 0, _(
+ bs = jcr->dir_bsock;
+ if (bs) {
+ timer_start = bs->timer_start;
+ if (timer_start && (watchdog_time - timer_start) > bs->timeout) {
+ bs->timer_start = 0; /* turn off timer */
+ bs->set_timed_out();
+ Qmsg(jcr, M_ERROR, 0, _(
"Watchdog sending kill after %d secs to thread stalled reading Director.\n"),
watchdog_time - timer_start);
pthread_kill(jcr->my_thread_id, TIMEOUT_SIGNAL);
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
return stat;
}
if (rwl->w_active <= 0) {
- Emsg0(M_ABORT, 0, _("rwl_writeunlock called too many times.\n"));
+ pthread_mutex_unlock(&rwl->mutex);
+ Jmsg0(NULL, M_ABORT, 0, _("rwl_writeunlock called too many times.\n"));
}
rwl->w_active--;
if (!pthread_equal(pthread_self(), rwl->writer_id)) {
- Emsg0(M_ABORT, 0, _("rwl_writeunlock by non-owner.\n"));
+ pthread_mutex_unlock(&rwl->mutex);
+ Jmsg0(NULL, M_ABORT, 0, _("rwl_writeunlock by non-owner.\n"));
}
if (rwl->w_active > 0) {
stat = 0; /* writers still active */
status = rwl_writelock(&data[element].lock);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Write lock failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Write lock failed. ERR=%s\n"), be.bstrerror(status));
}
data[element].data = self->thread_num;
data[element].writes++;
status = rwl_writeunlock(&data[element].lock);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Write unlock failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Write unlock failed. ERR=%s\n"), be.bstrerror(status));
}
} else {
/*
status = rwl_readlock(&data[element].lock);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Read lock failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Read lock failed. ERR=%s\n"), be.bstrerror(status));
}
self->reads++;
if (data[element].data == self->thread_num)
status = rwl_readunlock(&data[element].lock);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Read unlock failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Read unlock failed. ERR=%s\n"), be.bstrerror(status));
}
}
element++;
status = rwl_init (&data[data_count].lock);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Init rwlock failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Init rwlock failed. ERR=%s\n"), be.bstrerror(status));
}
}
NULL, thread_routine, (void*)&threads[count]);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Create thread failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Create thread failed. ERR=%s\n"), be.bstrerror(status));
}
}
status = pthread_join (threads[count].thread_id, NULL);
if (status != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Join thread failed. ERR=%s\n"), be.bstrerror(status));
+ Jmsg1(NULL, M_ABORT, 0, _("Join thread failed. ERR=%s\n"), be.bstrerror(status));
}
thread_writes += threads[count].writes;
printf (_("%02d: interval %d, writes %d, reads %d\n"),
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
if ((errstat=rwl_init(&lock)) != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("Unable to initialize watchdog lock. ERR=%s\n"),
+ Jmsg1(NULL, M_ABORT, 0, _("Unable to initialize watchdog lock. ERR=%s\n"),
be.bstrerror(errstat));
}
wd_queue = New(dlist(dummy, &dummy->link));
bool register_watchdog(watchdog_t *wd)
{
if (!wd_is_init) {
- Emsg0(M_ABORT, 0, _("BUG! register_watchdog called before start_watchdog\n"));
+ Jmsg0(NULL, M_ABORT, 0, _("BUG! register_watchdog called before start_watchdog\n"));
}
if (wd->callback == NULL) {
- Emsg1(M_ABORT, 0, _("BUG! Watchdog %p has NULL callback\n"), wd);
+ Jmsg1(NULL, M_ABORT, 0, _("BUG! Watchdog %p has NULL callback\n"), wd);
}
if (wd->interval == 0) {
- Emsg1(M_ABORT, 0, _("BUG! Watchdog %p has zero interval\n"), wd);
+ Jmsg1(NULL, M_ABORT, 0, _("BUG! Watchdog %p has zero interval\n"), wd);
}
wd_lock();
bool ok = false;
if (!wd_is_init) {
- Emsg0(M_ABORT, 0, _("BUG! unregister_watchdog_unlocked called before start_watchdog\n"));
+ Jmsg0(NULL, M_ABORT, 0, _("BUG! unregister_watchdog_unlocked called before start_watchdog\n"));
}
wd_lock();
int errstat;
if ((errstat=rwl_writelock(&lock)) != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("rwl_writelock failure. ERR=%s\n"),
+ Jmsg1(NULL, M_ABORT, 0, _("rwl_writelock failure. ERR=%s\n"),
be.bstrerror(errstat));
}
}
int errstat;
if ((errstat=rwl_writeunlock(&lock)) != 0) {
berrno be;
- Emsg1(M_ABORT, 0, _("rwl_writeunlock failure. ERR=%s\n"),
+ Jmsg1(NULL, M_ABORT, 0, _("rwl_writeunlock failure. ERR=%s\n"),
be.bstrerror(errstat));
}
}
#undef VERSION
#define VERSION "2.5.1"
-#define BDATE "02 July 2008"
-#define LSMDATE "02Jul08"
+#define BDATE "04 July 2008"
+#define LSMDATE "04Jul08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
General:
+04Jul08
+kes Add some SD debug code.
+kes Do find_a_volume() each time an unload is done.
+kes Apply Joao's DBI patch that adds easier configuration of DBI drivers,
+ and adds --with-db-port to ./configure.
+kes Use Qmsg() in job.c watchdog callback.
03Jul08
+kes Release main control rwlock if ABORTing.
+kes Make watchdog connect timeout queue messages rather than sending
+ directly to avoid lock conflicts with the real thread.
+kes Add const char in dbd.c to avoid compiler warnings.
kes Fix python compiler string warning. Note, IMO the GNU C++
compiler guys have made a *very* bad change to their compiler.
They now force all strings to be 'const' unless you explicitly