From: Howard Chu Date: Tue, 1 Aug 2017 21:08:50 +0000 (+0100) Subject: ITS#8226 optimization X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=221dd433995a480599d3038d109e63e0b570d84d;p=openldap ITS#8226 optimization Don't release read txn unless there has actually been a new write txn --- diff --git a/servers/slapd/back-mdb/search.c b/servers/slapd/back-mdb/search.c index 8e06326780..036d21b2b0 100644 --- a/servers/slapd/back-mdb/search.c +++ b/servers/slapd/back-mdb/search.c @@ -1125,8 +1125,11 @@ loop_continue: if ( moi == &opinfo && !wwctx.flag && mdb->mi_rtxn_size ) { wwctx.nentries++; if ( wwctx.nentries >= mdb->mi_rtxn_size ) { + MDB_envinfo ei; wwctx.nentries = 0; - mdb_rtxn_snap( op, &wwctx ); + mdb_env_info(mdb->mi_dbenv, &ei); + if ( ei.me_last_txnid > mdb_txn_id( ltid )) + mdb_rtxn_snap( op, &wwctx ); } } if ( wwctx.flag ) {