#include <pthread.h>
#include "citadel.h"
#include "server.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
#include "citserver.h"
#include "database.h"
#include "msgbase.h"
if (pthread_getspecific(tsdkey) != NULL)
return;
- tsd = mallok(sizeof *tsd);
+ tsd = mallok(sizeof(struct cdbtsd));
tsd->tid = NULL;
MAX_CHECKPOINT_KBYTES,
MAX_CHECKPOINT_MINUTES,
0);
+
+/* The DB_INCOMPLETE error is no longer possible (or even defined) as of
+ * Berkeley DB v4.1. When we get to the point where v4.0 and earlier are no
+ * longer supported, we can remove this ifdef.
+ */
+#ifdef DB_INCOMPLETE
if ( (ret != 0) && (ret != DB_INCOMPLETE) ) {
- lprintf(1, "cdb_checkpoint: txn_checkpoint: %s\n", db_strerror(ret));
+ lprintf(1, "cdb_checkpoint: txn_checkpoint: %s\n",
+ db_strerror(ret));
abort();
}
-
if (ret == DB_INCOMPLETE) {
lprintf(3, "WARNING: txn_checkpoint: %s\n", db_strerror(ret));
}
+#else /* DB_INCOMPLETE */
+ if (ret != 0) {
+ lprintf(1, "cdb_checkpoint: txn_checkpoint: %s\n",
+ db_strerror(ret));
+ abort();
+ }
+#endif /* DB_INCOMPLETE */
/* Cull the logs if we haven't done so for 24 hours */
if ((time(NULL) - last_cull) > 86400L) {
snprintf(dbfilename, sizeof dbfilename, "cdb.%02x", i);
ret = dbp[i]->open(dbp[i],
+#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
+ NULL, /* new parameter */
+#endif
dbfilename,
NULL,
DB_BTREE,
- DB_CREATE|DB_THREAD,
+ DB_CREATE|DB_THREAD
+#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
+ |DB_AUTO_COMMIT
+#endif
+ ,
0600);
if (ret) {
lprintf(1, "cdb_*: db_open[%d]: %s\n", i, db_strerror(ret));