AC_DEFINE(HAVE_THREAD_SAFE_MYSQL)
fi
SQL_BINDIR=$MYSQL_BINDIR
+ SQL_LIB=$MYSQL_LIBDIR/libmysqlclient_r.a
AC_DEFINE(HAVE_MYSQL)
AC_MSG_RESULT(yes)
SQL_INCLUDE=-I$MYSQL_INCDIR
SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqld -lz -lm -lcrypt"
SQL_BINDIR=$MYSQL_BINDIR
+ SQL_LIB=$MYSQL_LIBDIR/libmysqld.a
AC_DEFINE(HAVE_MYSQL)
AC_DEFINE(HAVE_EMBEDDED_MYSQL)
SQL_INCLUDE=-I$SQLITE_INCDIR
SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite"
SQL_BINDIR=$SQLITE_BINDIR
+ SQL_LIB=$SQLITE_LIBDIR/libsqlite.a
AC_DEFINE(HAVE_SQLITE)
AC_MSG_RESULT(yes)
SQL_INCLUDE=-I$SQLITE_INCDIR
SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite3"
SQL_BINDIR=$SQLITE_BINDIR
+ SQL_LIB=$SQLITE_LIBDIR/libsqlite3.a
AC_DEFINE(HAVE_SQLITE3)
AC_MSG_RESULT(yes)
SQL_INCLUDE=-I$POSTGRESQL_INCDIR
SQL_LFLAGS=$POSTGRESQL_LFLAGS
SQL_BINDIR=$POSTGRESQL_BINDIR
+ SQL_LIB=$POSTGRESQL_LIBDIR/libpq.a
+
AC_DEFINE(HAVE_POSTGRESQL)
AC_MSG_RESULT(yes)
db_found=yes
/* Define if OPENSSL is available */
#undef HAVE_OPENSSL
-/* Define if the OpenSSL library is export-constrained to 128bit ciphers */
-#undef HAVE_OPENSSL_EXPORT_LIBRARY
-
/* Define if comm encryption should be enabled */
#undef HAVE_TLS
/* Set if Bacula bat Qt4 GUI support enabled */
#undef HAVE_BAT
+/* Set if DB batch insert code enabled */
+#undef HAVE_BATCH_INSERT
+
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
/* Define if OpenSSL library is available */
#undef HAVE_OPENSSL
+/* Define if the OpenSSL library is export-contrained to 128bit ciphers */
+#undef HAVE_OPENSSL_EXPORT_LIBRARY
+
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
]
)
-
-
-
AC_SUBST(dir_user)
AC_SUBST(dir_group)
AC_SUBST(sd_user)
# ------------------------------------------------
# Bacula check for various SQL database engines
# ------------------------------------------------
+SQL_LIB=
BA_CHECK_POSTGRESQL_DB
BA_CHECK_MYSQL_DB
AC_SUBST(cats)
AC_SUBST(DB_TYPE)
+# -------------------------------------------
+# enable batch attribute DB insert (default on)
+# -------------------------------------------
+support_batch_insert=no
+A=`nm $SQL_LIB | grep pthread_mutex_lock`
+pkg=$?
+if test $pkg = 0; then
+ support_batch_insert=yes
+ AC_ARG_ENABLE(batch-insert,
+ [ --enable-batch-insert enable the DB batch insert code [disabled]],
+ [if test x$enableval = xno; then
+ support_batch_insert=no
+ else
+ AC_DEFINE(HAVE_BATCH_INSERT, 1, [Set if DB batch insert code enabled])
+ support_batch_insert=yes
+ fi])
+fi
+
+
+
+
AC_DEFINE(PROTOTYPES)
dnl# --------------------------------------------------------------------------
build-stored: ${build_stored}
ACL support: ${have_acl}
Python support: ${support_python} ${PYTHON_LIBS}
+ Batch insert enabled: ${support_batch_insert}
" > config.out
--disable-readline disable readline support disable
+ --enable-batch-insert enable the DB batch insert code disabled
--disable-largefile omit support for large files
Optional Packages:
-
-
-
#
# allow setting default executable permissions
#
# ------------------------------------------------
# Bacula check for various SQL database engines
# ------------------------------------------------
+SQL_LIB=
db_found=no
{ echo "$as_me:$LINENO: checking for PostgreSQL support" >&5
SQL_INCLUDE=-I$POSTGRESQL_INCDIR
SQL_LFLAGS=$POSTGRESQL_LFLAGS
SQL_BINDIR=$POSTGRESQL_BINDIR
+ SQL_LIB=$POSTGRESQL_LIBDIR/libpq.a
+
cat >>confdefs.h <<\_ACEOF
#define HAVE_POSTGRESQL 1
_ACEOF
fi
SQL_BINDIR=$MYSQL_BINDIR
+ SQL_LIB=$MYSQL_LIBDIR/libmysqlclient_r.a
cat >>confdefs.h <<\_ACEOF
#define HAVE_MYSQL 1
SQL_INCLUDE=-I$MYSQL_INCDIR
SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqld -lz -lm -lcrypt"
SQL_BINDIR=$MYSQL_BINDIR
+ SQL_LIB=$MYSQL_LIBDIR/libmysqld.a
cat >>confdefs.h <<\_ACEOF
#define HAVE_MYSQL 1
SQL_INCLUDE=-I$SQLITE_INCDIR
SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite3"
SQL_BINDIR=$SQLITE_BINDIR
+ SQL_LIB=$SQLITE_LIBDIR/libsqlite3.a
cat >>confdefs.h <<\_ACEOF
#define HAVE_SQLITE3 1
SQL_INCLUDE=-I$SQLITE_INCDIR
SQL_LFLAGS="-L$SQLITE_LIBDIR -lsqlite"
SQL_BINDIR=$SQLITE_BINDIR
+ SQL_LIB=$SQLITE_LIBDIR/libsqlite.a
cat >>confdefs.h <<\_ACEOF
#define HAVE_SQLITE 1
+# -------------------------------------------
+# enable batch attribute DB insert (default on)
+# -------------------------------------------
+support_batch_insert=no
+A=`nm $SQL_LIB | grep pthread_mutex_lock`
+pkg=$?
+if test $pkg = 0; then
+ support_batch_insert=yes
+ # Check whether --enable-batch-insert was given.
+if test "${enable_batch_insert+set}" = set; then
+ enableval=$enable_batch_insert; if test x$enableval = xno; then
+ support_batch_insert=no
+ else
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BATCH_INSERT 1
+_ACEOF
+
+ support_batch_insert=yes
+ fi
+fi
+
+fi
+
+
+
+
cat >>confdefs.h <<\_ACEOF
#define PROTOTYPES 1
_ACEOF
build-stored: ${build_stored}
ACL support: ${have_acl}
Python support: ${support_python} ${PYTHON_LIBS}
+ Batch insert enabled: ${support_batch_insert}
" > config.out
INSERT INTO Version (VersionId) VALUES (10);
-PRAGMA default_synchronous = OFF;
-PRAGMA default_cache_size = 10000;
+PRAGMA default_cache_size = 100000;
+PRAGMA synchronous = NORMAL;
END-OF-DATA
mdb->num_rows = sql_affected_rows(mdb);
if (mdb->num_rows < 1) {
char ed1[30];
- m_msg(file, line, &mdb->errmsg, _("Update problem: affected_rows=%s\n"),
- edit_uint64(mdb->num_rows, ed1));
+ m_msg(file, line, &mdb->errmsg, _("Update failed: affected_rows=%s for %s\n"),
+ edit_uint64(mdb->num_rows, ed1), cmd);
if (verbose) {
// j_msg(file, line, jcr, M_INFO, 0, "%s\n", cmd);
}
} else {
mdb->sqlite_errmsg = NULL;
}
+#ifdef SQLITE3_INIT_QUERY
+ db_sql_query(mdb, SQLITE3_INIT_QUERY, NULL, NULL);
+#endif
#else
mdb->db = sqlite_open(
}
void db_thread_cleanup()
-{ }
+{
+#ifdef HAVE_SQLITE3
+ sqlite3_thread_cleanup();
+#endif
+}
/*
* Return the next unique index (auto-increment) for
*/
int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index)
{
-#ifdef xxxx
- SQL_ROW row;
-
- db_lock(mdb);
-
- Mmsg(mdb->cmd,
-"SELECT id FROM NextId WHERE TableName=\"%s\"", table);
- if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
- Mmsg(mdb->errmsg, _("next_index query error: ERR=%s\n"), sql_strerror(mdb));
- db_unlock(mdb);
- return 0;
- }
- if ((row = sql_fetch_row(mdb)) == NULL) {
- Mmsg(mdb->errmsg, _("Error fetching index: ERR=%s\n"), sql_strerror(mdb));
- db_unlock(mdb);
- return 0;
- }
- bstrncpy(index, row[0], 28);
- sql_free_result(mdb);
-
- Mmsg(mdb->cmd,
-"UPDATE NextId SET id=id+1 WHERE TableName=\"%s\"", table);
- if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
- Mmsg(mdb->errmsg, _("next_index update error: ERR=%s\n"), sql_strerror(mdb));
- db_unlock(mdb);
- return 0;
- }
- sql_free_result(mdb);
-
- db_unlock(mdb);
-#endif
strcpy(index, "NULL");
return 1;
}
#undef VERSION
#define VERSION "2.1.11"
-#define BDATE "02 June 2007"
-#define LSMDATE "02Jun07"
+#define BDATE "04 June 2007"
+#define LSMDATE "04Jun07"
#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
#define BYEAR "2007" /* year for copyright messages in progs */
#define SMCHECK
#endif
+/*
+ * for fastest speed but you must have a UPS to avoid unwanted shutdowns
+ */
+#define SQLITE3_INIT_QUERY "PRAGMA synchronous = OFF"
+
+/*
+ * for more safety, but is 30 times slower than above
+ */
+//#define SQLITE3_INIT_QUERY "PRAGMA synchronous = NORMAL"
+
/*
* This should always be on. It enables data encryption code
* providing it is configured.
*/
#define USE_BSNPRINTF 1
-/*
- * Turn on the following flag to enable batch attribute inserts
- * in the catalog. This gives a large speedup.
- */
-#define HAVE_BATCH_FILE_INSERT 1
-
-
/* Debug flags not normally turned on */
/* #define TRACE_JCR_CHAIN 1 */
Technical notes on version 2.1
General:
+03Jun07
+kes Implement --with-batch-insert in configure and detection of thread
+ safe libraries. It is on by default, but turned off if no thread
+ safe library (e.g. SQLite 2) is available.
02Jun07
kes Fix Bacula PostgreSQL buffer overruns.
kes Do better checking for NULL results returned from PostgreSQL;