From 59285f16d6428477b3a065fdf52098af1d62f606 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 6 Mar 2007 10:11:15 +0000 Subject: r21722: Add the dead record functionality presented on samba-technical@samba.org. If you do a tdb_set_max_dead(tdb, n), then for this tdb a delete operation will only mark a record as dead and re-use it if a new record is created. The parameter n allows for at most n dead records per hash chain. If this number is exceeded, all dead records are put on the central freelist. Volker (This used to be commit 97af3a019b196d530a50ffc05c57568e2dbda4bb) --- source3/tdb/common/open.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/tdb/common/open.c') diff --git a/source3/tdb/common/open.c b/source3/tdb/common/open.c index 3f0c35331b..c7fd3f6656 100644 --- a/source3/tdb/common/open.c +++ b/source3/tdb/common/open.c @@ -263,6 +263,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; + tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { @@ -321,6 +322,15 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, } } +/* + * Set the maximum number of dead records per hash chain + */ + +void tdb_set_max_dead(struct tdb_context *tdb, int max_dead) +{ + tdb->max_dead_records = max_dead; +} + /** * Close a database. * -- cgit