tdbtool: Use tdb_wipe_all in "erase" command
authorVolker Lendecke <vl@samba.org>
Tue, 10 Apr 2018 14:58:46 +0000 (16:58 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Apr 2018 23:06:39 +0000 (01:06 +0200)
commit10dbd51e2d54c45de103de10c400d7f323c7223e
treed320c2c086741e27d9c5d072613e40308d96b899
parentee560fa3a67797deef86b3aea763389488790ef0
tdbtool: Use tdb_wipe_all in "erase" command

This is a lot quicker on large, fragmented databases. tdb_delete can
leave the freelist in a fragmented mess.

Also, it's a lot more robust: I've got a 4GB tdb file that was affected
by the problem fixed with c7211882a79. These databases have large space
at the end that is not part of any record or freelist
entry. tdb_wipe_all converts this space into a freelist entry. One
downside is that with those broken databases (which should not happen
after c7211882a79) have unallocated blocks in their file range after
this operation.

I think the speed advantage outweighs this disadvantage.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/tools/tdbtool.c