summaryrefslogtreecommitdiffstats
path: root/ctdb/lib/tdb/common/check.c
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-build: Remove duplicate tdb libraryAmitay Isaacs2014-06-201-472/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* lib/tdb: Sync tdb from samba git treeAmitay Isaacs2012-04-131-6/+6
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 0f40ea2386892ae10b30beeded0e00edf4c019c3)
* tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.Rusty Russell2010-10-071-1/+1
| | | | | | | | | | | | | | | | | | This flag to tdb_open/tdb_open_ex effects creation of a new database: 1) Uses the Jenkins lookup3 hash instead of the old gdbm hash if none is specified, 2) Places a non-zero field in header->rwlocks, so older versions of TDB will refuse to open it. This means that the caller (ie Samba) can set this flag to safely change the hash function. Versions of TDB from this one on will either use the correct hash or refuse to open (if a different hash is specified). Older TDB versions will see the nonzero rwlocks field and refuse to open it under any conditions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit dd86b24ae5307fe09d4ae22b7070d747013a2b07)
* tdb: put example hashes into header, so we notice incorrect hash_fn.Rusty Russell2010-10-071-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> (This used to be ctdb commit 63c582c99128c3623e270e8425966cab7744fb2f)
* tdb: fix tdb_check() on other-endian tdbs.Rusty Russell2010-10-071-1/+1
| | | | | | | | We must not endian-convert the magic string, just the rest. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 525390863ad39acea08ceb88531dc59d118fcad4)
* tdb: fix tdb_check() on read-only TDBs to actually work.Rusty Russell2010-10-071-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> (This used to be ctdb commit 2558eb250011893d09dbeaedaffeefa0e397142f)
* tdb: make check more robust against recovery failures.Rusty Russell2010-10-071-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> (This used to be ctdb commit b4162a95ff9ae28cda8d9c76c51c9480104517a7)
* tdb: Fix tdb_check() to work with read-only tdb databases.Rusty Russell2010-08-161-3/+3
| | | | | | | | (Import from SAMBA bc1c82ea137e1bf6cb55139a666c56ebb2226b23) The function tdb_lockall() uses F_WRLCK internally, which doesn't work on a fd opened with O_RDONLY. Use tdb_lockall_read() instead. (This used to be ctdb commit a5db1122ec48d7e7384066848457c850c1a6cf3c)
* tdb: give a name to the invalid recovery area constant (0)Rusty Russell2010-04-221-1/+1
| | | | | | | | Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from commit 6269cdcd1538e2e3cead9e0f3c156b0363d607a0) (This used to be ctdb commit e0ca2e02120258aabca1e1586a58a8d672484fb5)
* tdb: Fix a C++ warning (cherry picked from samba commit ↵Volker Lendecke2009-12-161-1/+2
| | | | | | | | be88a126ea50ea7e41583f402013c63234305e48) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit 6126f04bd4982b66564dcccd92a15baf9cb856f3)
* tdb: rename 'struct list_struct' into 'struct tdb_record'Stefan Metzmacher2009-12-161-4/+4
| | | | | | | | | metze (cherry picked from samba commit 3b62e250c066f44d0ab08a7db037b6b4f74a914b) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630)
* lib/tdb: add tdb_check()Rusty Russell2009-12-161-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> (cherry picked from samba commit 022b4d4aa6861c1e3e6d76484d92555221cb6d14) Signed-off-by: Stefan Metzmacher <metze@samba.org> (This used to be ctdb commit df1a3ce0380fa9d8722b2f9b16f65557095e4c83)