1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/lib
Volker Lendecke 500a729a55 tdb: Make record deletion circular-chain safe
Before this patch we had 3 loops walking a hash chain to delete
records:

tdb_do_delete() to find the predecessor of the record that was to be
deleted. tdb_count_dead(), the name says it all and tdb_purge_dead()
to give back all dead records from a chain to the freelist.

This patch introduces tdb_trim_dead that walks a hash chain just
once. While it does so it counts the number of dead records, and all
records beyond tdb->max_dead_records are moved to the freelist.

Normal record deletion now works by always marking a record as dead in
step 1 and then calling tdb_trim_dead. This is made safe against
circular chains by doing the slow chain walk only in the case when we
did not delete a dead record during our walk.

It changes our dynamics a bit:

When deleting a record with non-zero max_dead_records, now we always
leave that number of records around when deleting, doing a blocking
lock on the freelist when we found too many dead records.

Previously when exceeding max_dead_records we wiped all dead records
to start accumulating them from scratch, assuming we could lock the
freelist in a nonblocking fashion.

The net effect for an uncontended freelist is the same: In
tdb_allocate() we still completely hand over all dead records to the
freelist when we could lock it, it just happens later than without
this patch.

This means for a lightly loaded system we will potentially leave more
dead records around in databases like locking.tdb. However, on a
heavily loaded system we become more predictable: If the freelist is
so heavily contended that across many deletes we can't get hold of it,
previously we accumulated more dead records than max_dead_records
would allow. This is a really lowlevel tradeoff that is likely hard to
measure, but to me becoming more deterministic without sacrificing too
much parallelism (we keep more dead records around) is worth trying.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Oct 30 02:48:38 CET 2018 on sn-devel-144
2018-10-30 02:48:38 +01:00
..
addns addns: Fix a typo 2018-06-16 04:21:17 +02:00
afs waf: add --with-fake-kaserver option 2014-06-04 20:09:38 +02:00
async_req lib/async_req/async_sock.c set socket close on exec 2017-12-18 04:38:19 +01:00
audit_logging turn --with-json-audit into global --with-json 2018-09-26 20:41:07 +02:00
compression lib/compression/tests: add missing #include "torture/local/proto.h" 2014-04-02 09:03:44 +02:00
crypto lib: Remove lib/crypto/crc32.[ch] 2018-10-10 01:41:52 +02:00
dbwrap dbwrap_tdb: Avoid double-call to talloc_get_type_abort 2018-09-14 07:49:13 +02:00
krb5_wrap krb5-samba: interdomain trust uses different salt principal 2018-09-05 03:57:22 +02:00
ldb ldb/tests/py/api: reveal shadowed casefold test 2018-10-25 21:45:59 +02:00
ldb-samba ldb-samba/tests/match-rules: remove unused imports 2018-10-25 21:45:55 +02:00
mscat lib/mscat: fix logging in wscript 2018-09-05 06:37:27 +02:00
param smb.conf: add dns_zone_scavenging 2018-07-12 04:31:51 +02:00
pthreadpool pthreadpool: reset monitor_fd after calling tevent_fd_set_auto_close() 2018-07-31 11:26:16 +02:00
replace replace: Add memset_s() if not available 2018-10-16 08:42:18 +02:00
smbconf Correct "occured" typos. 2017-02-22 08:26:21 +01:00
socket lib:socket: If returning early, set ifaces 2018-10-28 00:35:34 +02:00
talloc talloc/test/pytalloc: remove unused imports 2018-10-25 21:45:55 +02:00
tdb tdb: Make record deletion circular-chain safe 2018-10-30 02:48:38 +01:00
tdb_wrap tdb_wrap: Use a struct initializer 2015-07-23 14:39:18 +02:00
tdr lib: Fix 1354521 Unchecked return value 2016-03-01 21:49:44 +01:00
tevent lib: Avoid the use of open_memstream in tevent_req_profile_string 2018-10-08 22:17:11 +02:00
texpect lib:texpect: Avoid some compiler warnings 2018-03-01 04:37:41 +01:00
torture selftest: consistently produce high-res UTC time 2018-03-22 13:26:44 +01:00
tsocket tsocket: Fix typos 2018-01-04 00:37:20 +01:00
util lib: Avoid the use of open_memstream in tevent_req_profile_string 2018-10-08 22:17:11 +02:00
README build: Move nss_wrapper to third_party 2017-11-25 10:14:13 +01:00
wscript_build Remove 'external' python module support code - use the third_party directory instead. 2015-03-06 04:41:48 +01:00

compression - Various compression algorithms (MSZIP, lzxpress)
dnspython - Python module for working with DNS.
popt - Command-line option parsing library
replace - Provides replacements for standard (POSIX, C99) functions 
          not provided by the host platform.
subunit - Utilities and bindings for working with the Subunit test result 
          reporting protocol.
talloc - Hierarchical pool based memory allocator 
tdb - Simple but fast key/value database library, supporting multiple writers
torture - Simple unit testing helper library