[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Fwd: Re: DB_LOG_AUTOREMOVE: how does it work?



Kurt D. Zeilenga wrote:

Maybe we can commit the back-bdb patch behind an ifdef,
and place the BerkeleyBDB patch in build/berkeleydb42.patch?


OK, here's another idea for the back-bdb/cache.c patch - if using BDB 4.2.52 it tries the alternate flag first. If it fails, it logs the failure and reverts to running without the alternate flag. Or, we can just let it fail and have slapd shutdown instead, and require people to patch their BDB library.

diff -u -r1.92 cache.c
--- cache.c     20 Feb 2005 03:59:29 -0000      1.92
+++ cache.c     20 Mar 2005 10:24:37 -0000
@@ -37,6 +37,14 @@

static int bdb_txn_get( Operation *op, DB_ENV *env, DB_TXN **txn, int reset );

+/* 4.2.52 */
+#if DB_VERSION_FULL == 0x04020034
+#define READ_TXN_FLAG ReadFlag
+static int ReadFlag = DB_TXN_NOT_DURABLE;
+#else
+#define READ_TXN_FLAG 0
+#endif
+
static EntryInfo *
bdb_cache_entryinfo_new( Cache *cache )
{
@@ -1258,7 +1266,17 @@
if ( ldap_pvt_thread_pool_getkey( ctx, ((char *)env)+1, &data, NULL ) ||
data == NULL ) {
for ( i=0, rc=1; rc != 0 && i<4; i++ ) {
- rc = TXN_BEGIN( env, NULL, txn, 0 );
+ rc = TXN_BEGIN( env, NULL, txn, READ_TXN_FLAG );
+#if DB_VERSION_FULL == 0x04020034
+ if ( rc == EINVAL && READ_TXN_FLAG ) {
+ READ_TXN_FLAG = 0;
+ Debug( LDAP_DEBUG_ANY,
+ "bdb_txn_get: BerkeleyDB library needs TXN patch!\n",
+ 0, 0, 0 );
+ i--;
+ continue;
+ }
+#endif
if (rc) ldap_pvt_thread_yield();
}
if ( rc != 0) {


--
 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support