diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-10-18 21:45:46 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:21:26 -0500 |
commit | 4b9eee02c4a0c856f16d9f17929e726fb75e051f (patch) | |
tree | c22d0f46f4d6d549feb4873d3274cc837aab08fe /source4/lib/ldb/ldb_tdb/ldb_search.c | |
parent | cba142f1ae71b03266210e254c251683846d7fd7 (diff) | |
download | samba-4b9eee02c4a0c856f16d9f17929e726fb75e051f.tar.gz samba-4b9eee02c4a0c856f16d9f17929e726fb75e051f.tar.bz2 samba-4b9eee02c4a0c856f16d9f17929e726fb75e051f.zip |
r19402: - use the new tdb_lockall_read() to make ldb_search() more efficient,
by avoiding chain locks on each tdb_fetch() within the search
- use the tdb_get_seqnum() call to avoid re-reading the @BASEINFO
record when it hasn't changed.
These speed up the LOCAL-DBSPEED test for ldb from 7k ops/sec to a bit
over 11k ops/sec
(This used to be commit 1347ad254eb8cd12ce22a5a2a37bec0a0ac8dbf1)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_search.c')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_search.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 85b6a123ca..4b76c437b6 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -248,25 +248,13 @@ int ltdb_search_dn1(struct ldb_module *module, const struct ldb_dn *dn, struct l return 1; } -/* the lock key for search locking. Note that this is not a DN, its - just an arbitrary key to give to tdb. Also note that as we and - using transactions for all write operations and transactions take - care of their own locks, we don't need to do any locking anywhere - other than in ldb_search() */ -#define LDBLOCK "INT_LDBLOCK" - /* lock the database for read - use by ltdb_search */ static int ltdb_lock_read(struct ldb_module *module) { struct ltdb_private *ltdb = module->private_data; - TDB_DATA key; - - key.dptr = discard_const(LDBLOCK); - key.dsize = strlen(LDBLOCK); - - return tdb_chainlock_read(ltdb->tdb, key); + return tdb_lockall_read(ltdb->tdb); } /* @@ -275,12 +263,7 @@ static int ltdb_lock_read(struct ldb_module *module) static int ltdb_unlock_read(struct ldb_module *module) { struct ltdb_private *ltdb = module->private_data; - TDB_DATA key; - - key.dptr = discard_const(LDBLOCK); - key.dsize = strlen(LDBLOCK); - - return tdb_chainunlock_read(ltdb->tdb, key); + return tdb_unlockall_read(ltdb->tdb); } /* |