How do dead records get into a tdb file?

Michael Adam obnox at
Wed Feb 26 01:47:14 MST 2014

Hi Richard,

First to answer the question of the subject:

A dead record is createad when a record is deleted.
This was introduced by Volker some time ago to prevent
tdb_delete from blocking when the freelist is locked:

- Originally, tdb_delete took the record out of the
  hash chain and insert it into the free list.
- Now, the record is left in the hash chain but marked
  dead. Every couple of deletes, namely when the number
  of dead records exceeds a threshold (currently 5),
  the dead reacords of the chain are first all purged
  from the chain (moved to the freelist), befor the
  record to delete is marked dead.

This helps reducing the average contention of a delete operation.

On 2014-02-25 at 20:31 -0800, Richard Sharpe wrote:
> We recently saw a tdb file get very large:
> tdb> info
> Size of file/data: 2785345536/3293549
> Number of records: 99
> Smallest/average/largest keys: 9/9/10
> Smallest/average/largest data: 72/33258/2616464
> Smallest/average/largest padding: 30/5374/367322
> Number of dead records: 1 ---> only one dead record
> Smallest/average/largest dead records: 2718339048/2718339048/2718339048 -->
> That dead record is a concern.

This is mainly wrong output.
The statistics from tdbtool info counts the so called
recovery area that is used in transactions (and hence
potentially occupies much of the space). This should be
listed separately, as it is _not_ a dead record.

What database is this, btw?
Having the dead/recovery arey occupy almost all of
the size of the DB seems a lot, indeed.

Thinking about a patch to improve the precision of the
info output..

Cheers - Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 215 bytes
Desc: Digital signature
URL: <>

More information about the samba-technical mailing list