BDB 4.1 (Re: How to determine format of .db files)
Mika Iisakkila
mika.iisakkila at pingrid.fi
Thu Sep 19 08:14:11 EDT 2002
Mika Iisakkila wrote:
> Any hopes for updates to current stable SASL2 and Cyrus 2.1
> to accommodate BDB 4.1?
Boy, was that easy; patches attached. I have no idea if
these actually realize any of the performance gains, but
at least both sasl2 and imapd compile and run.
I can't give any promises regarding correctness or
backwards compatibility with DB4.0. Probably configure
should also explicitly look for 4.1, but I'm not going to
touch that :-)
--mika
-------------- next part --------------
diff -Naur cyrus-sasl-2.1.7-orig/sasldb/db_berkeley.c cyrus-sasl-2.1.7/sasldb/db_berkeley.c
--- cyrus-sasl-2.1.7-orig/sasldb/db_berkeley.c 2002-07-05 18:45:13.000000000 +0300
+++ cyrus-sasl-2.1.7/sasldb/db_berkeley.c 2002-09-19 14:44:53.000000000 +0300
@@ -85,12 +85,16 @@
ret = db_create(mbdb, NULL, 0);
if (ret == 0 && *mbdb != NULL)
{
- ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, flags, 0660);
- if (ret != 0)
- {
- (void) (*mbdb)->close(*mbdb, 0);
- *mbdb = NULL;
- }
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, flags, 0660);
+#else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, flags, 0660);
+#endif
+ if (ret != 0)
+ {
+ (void) (*mbdb)->close(*mbdb, 0);
+ *mbdb = NULL;
+ }
}
#endif /* DB_VERSION_MAJOR < 3 */
diff -Naur cyrus-sasl-2.1.7-orig/utils/dbconverter-2.c cyrus-sasl-2.1.7/utils/dbconverter-2.c
--- cyrus-sasl-2.1.7-orig/utils/dbconverter-2.c 2002-07-05 18:44:43.000000000 +0300
+++ cyrus-sasl-2.1.7/utils/dbconverter-2.c 2002-09-19 14:46:13.000000000 +0300
@@ -214,12 +214,16 @@
ret = db_create(mbdb, NULL, 0);
if (ret == 0 && *mbdb != NULL)
{
- ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, DB_CREATE, 0664);
- if (ret != 0)
- {
- (void) (*mbdb)->close(*mbdb, 0);
- *mbdb = NULL;
- }
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
+ ret = (*mbdb)->open(*mbdb, NULL, path, NULL, DB_HASH, DB_CREATE, 0664);
+#else
+ ret = (*mbdb)->open(*mbdb, path, NULL, DB_HASH, DB_CREATE, 0664);
+#endif
+ if (ret != 0)
+ {
+ (void) (*mbdb)->close(*mbdb, 0);
+ *mbdb = NULL;
+ }
}
#endif /* DB_VERSION_MAJOR < 3 */
-------------- next part --------------
diff -Naur cyrus-imapd-2.1.9-orig/lib/cyrusdb_db3.c cyrus-imapd-2.1.9/lib/cyrusdb_db3.c
--- cyrus-imapd-2.1.9-orig/lib/cyrusdb_db3.c 2002-08-06 19:55:03.000000000 +0300
+++ cyrus-imapd-2.1.9/lib/cyrusdb_db3.c 2002-09-19 14:41:32.000000000 +0300
@@ -232,13 +232,17 @@
assert(dbinit);
+#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
do {
+#endif
#if (DB_VERSION_MAJOR > 3) || ((DB_VERSION_MAJOR == 3) && (DB_VERSION_MINOR > 0))
r = txn_checkpoint(dbenv, 0, 0, 0);
#else
r = txn_checkpoint(dbenv, 0, 0);
#endif
- } while (r == DB_INCOMPLETE);
+#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
+ } while (r == DB_INCOMPLETE); /* Never returned by BDB 4.1 */
+#endif
if (r) {
syslog(LOG_ERR, "DBERROR: couldn't checkpoint: %s",
db_strerror(r));
@@ -347,7 +351,11 @@
}
/* xxx set comparator! */
+#if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
+ r = db->open(db, NULL, fname, NULL, DB_BTREE, DB_CREATE, 0664);
+#else
r = db->open(db, fname, NULL, DB_BTREE, DB_CREATE, 0664);
+#endif
if (r != 0) {
syslog(LOG_ERR, "DBERROR: opening %s: %s", fname, db_strerror(r));
return CYRUSDB_IOERROR;
More information about the Info-cyrus
mailing list