mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
500a729a55
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 |
||
---|---|---|
.. | ||
addns | ||
afs | ||
async_req | ||
audit_logging | ||
compression | ||
crypto | ||
dbwrap | ||
krb5_wrap | ||
ldb | ||
ldb-samba | ||
mscat | ||
param | ||
pthreadpool | ||
replace | ||
smbconf | ||
socket | ||
talloc | ||
tdb | ||
tdb_wrap | ||
tdr | ||
tevent | ||
texpect | ||
torture | ||
tsocket | ||
util | ||
README | ||
wscript_build |
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