]> git.sur5r.net Git - openldap/commitdiff
ITS#8226 optimization
authorHoward Chu <hyc@openldap.org>
Tue, 1 Aug 2017 21:08:50 +0000 (22:08 +0100)
committerHoward Chu <hyc@openldap.org>
Tue, 1 Aug 2017 21:08:50 +0000 (22:08 +0100)
Don't release read txn unless there has actually been a new write txn

servers/slapd/back-mdb/search.c

index 8e06326780d159c881a70229a77fac8a33339d9c..036d21b2b0db6a4ebeb6eca604fada8f9dd59050 100644 (file)
@@ -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 ) {