summaryrefslogtreecommitdiff
path: root/lib/tdb/common/check.c
AgeCommit message (Collapse)AuthorFilesLines
2010-09-13tdb: put example hashes into header, so we notice incorrect hash_fn.Rusty Russell1-0/+6
This is Stefan Metzmacher <metze@samba.org>'s patch with minor changes: 1) Use the TDB_MAGIC constant so both hashes aren't of strings. 2) Check the hash in tdb_check (paranoia, really). 3) Additional check in the (unlikely!) case where both examples hash to 0. 4) Cosmetic changes to var names and complaint message. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-09-13tdb: fix tdb_check() on other-endian tdbs.Rusty Russell1-1/+1
We must not endian-convert the magic string, just the rest. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-09-13tdb: fix tdb_check() on read-only TDBs to actually work.Rusty Russell1-5/+17
Commit bc1c82ea137 "Fix tdb_check() to work with read-only tdb databases." claimed to do this, but tdb_lockall_read() fails on read-only databases. Also make sure we can still do tdb_check() inside a transaction (weird, but we previously allowed it so don't break the API). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-09-13tdb: make check more robust against recovery failures.Rusty Russell1-5/+36
We can end up with dead areas when we die during transaction commit; tdb_check() fails on such a (valid) database. This is particularly noticable now we no longer truncate on recovery; if the recovery area was at the end of the file we used to remove it that way. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-07-29Fix tdb_check() to work with read-only tdb databases. The function ↵Jeremy Allison1-3/+3
tdb_lockall() uses F_WRLCK internally, which doesn't work on a fd opened with O_RDONLY. Use tdb_lockall_read() instead. Jeremy.
2010-02-10tdb: give a name to the invalid recovery area constant (0)Rusty Russell1-1/+1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2009-11-08tdb: Fix a C++ warningVolker Lendecke1-1/+2
2009-10-23tdb: rename 'struct list_struct' into 'struct tdb_record'Stefan Metzmacher1-4/+4
metze
2009-10-22lib/tdb: add tdb_check()Rusty Russell1-0/+422
ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with loops in their hash chains. tdb_check() provides this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>