tdb_delete marking records as dead?

Jeremy Allison jra at samba.org
Sun Mar 4 20:59:01 GMT 2007


On Sun, Mar 04, 2007 at 05:59:59PM +0100, Volker Lendecke wrote:
> Hi, Tridge!
> 
> Attach find a patch to tdb that reduces access to the
> central freelist. In particular on locking.tdb we have a
> very high rate of creation/deletion, and all the records are
> of a reasonably bounded size. With the high rate of
> create/delete I have seen processes stuck in the fcntl lock
> call for the locking.tdb freelist for a considerable amount
> of time. It's a bit difficult to reproduce, this only
> happens under really heavy load and mainly on SMP boxes.
> 
> The patch essentially makes tdb_delete just mark the record
> dead. Adding a record searches in its own hash chain for a
> dead record that has enough space for the new record.
> 
> To let the per-hashchain "freelist" not grow too large,
> tdb_delete checks if there are already more than 5 dead
> records. If this is the case, it locks the main freelist
> once and adds all dead records. The other place we do this
> is in tdb_store when we have figured out that we have to
> allocate from the freelist anyway and thus have to lock it.
> 
> Not all tdb's have such a high delete rate, so this
> heuristic might not fit for all tdb's. So we might add a
> flag to tdb_open to enable/disable this behaviour. No format
> change on disk, it just re-uses the existing TDB_DEAD_MAGIC.
> 
> The downside of this patch is that it leaves at most
> 5*tdb->hash_size records more around than necessary.
> 
> Comments?

Just a quickie, I *really* like this ! Looks really
nice work Volker, thanks.

Jeremy.


More information about the samba-technical mailing list