From 022b4d4aa6861c1e3e6d76484d92555221cb6d14 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 22 Oct 2009 00:10:34 +1030 Subject: lib/tdb: add tdb_check() 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 --- lib/tdb/docs/README | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/tdb/docs') diff --git a/lib/tdb/docs/README b/lib/tdb/docs/README index 454e4ba032b..4eb809fdf40 100644 --- a/lib/tdb/docs/README +++ b/lib/tdb/docs/README @@ -244,3 +244,14 @@ int tdb_transaction_prepare_commit(TDB_CONTEXT *tdb) tdb_transaction_commit() or tdb_transaction_cancel(). Preparing allocates disk space for the pending updates, so a subsequent commit should succeed (barring any hardware failures). + +---------------------------------------------------------------------- +int tdb_check(TDB_CONTEXT *tdb, + int (*check)(TDB_DATA key, TDB_DATA data, void *private_data), + void *private_data);) + + check the consistency of the database, calling back the check function + (if non-NULL) with each record. If some consistency check fails, or + the supplied check function returns -1, tdb_check returns -1, otherwise + 0. Note that logging function (if set) will be called with additional + information on the corruption found. -- cgit v1.2.1