summaryrefslogtreecommitdiffstats
path: root/ctdb/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* tdb: expose transaction lock infrastructure for ctdbRusty Russell2011-01-182-0/+24
| | | | | | | | | tdb_traverse_read() grabs the transaction lock. This can cause ctdbd (which uses it) to block when it should not; expose mark and normal variants of this lock, so ctdbd's child (the recovery daemon) can acquire it and the ctdbd parent can mark it was held. (This used to be ctdb commit d09fa845bd848d04507853809acf42e0471b44bf)
* change Christinas previous patch to only perform the check/loggingRonnie Sahlberg2011-01-174-8/+12
| | | | | | | | if we are the main ctdb daemon. Other daemons/child processes are not guaranteed to get events on regular basis so those should not be checked. (This used to be ctdb commit ac2afe9c25753b837d5f6396020e0f3c65ef3628)
* improve timing issue detectionsChristian Ambach2011-01-176-15/+61
| | | | | | | | | | | the original "Time jumped" messages are too coarse to interpret exactly what was going wrong inside of CTDB. This patch removes the original logs and adds two other logs that differentiate between the time it took to work on an event and the time it took to get the next event. (This used to be ctdb commit fd8d54292f10b35bc4960d64cfa6843ce9aba225)
* idtree: fix overflow for v. large ids on allocation and removalRusty Russell2010-12-071-1/+1
| | | | | | | | | | | | | | (Imported from SAMBA commit 09a6538969ac). Chris Cowan tracked down a SEGV in sub_alloc: idp->level can actually be equal to 7 (MAX_LEVEL) there, as it can be in sub_remove. (We unfairly blamed a shift of a signed var for this crash in commit 2db1987f5a3a). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 73764104356d3738d9d20a9d06ce51535f74f475)
* idtree: fix right shift of signed ints, crash on large ids on AIXRusty Russell2010-10-071-1/+1
| | | | | | | | | | | | | | | | | | | Right-shifting signed integers in undefined; indeed it seems that on AIX with their compiler, doing a 30-bit shift on (INT_MAX-200) gives 0, not 1 as we might expect. The obvious fix is to make id and oid unsigned: l (level count) is also logically unsigned. (Note: Samba doesn't generally get to ids > 1 billion, but ctdb does) Reported-by: Chris Cowan <cc@us.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@samba.org> Autobuild-Date: Wed Oct 6 08:31:09 UTC 2010 on sn-devel-104 (This used to be ctdb commit 53d49df2d4519c35b270c30660e2504af2a5ed5c)
* pytdb: Add __version__ attribute.Jelmer Vernooij2010-10-072-0/+8
| | | | (This used to be ctdb commit 2b81314eb94d31f4efadd2a3dcf2f6e176338d3f)
* pytdb: Include Python.h first to prevent warning.Jelmer Vernooij2010-10-071-1/+1
| | | | (This used to be ctdb commit 247dacde0d0de1358cc2c27d08914be605272023)
* pytdb: Check errors after PyObject_New() callsKirill Smelkov2010-10-071-0/+7
| | | | | | | | | | The call could fail with e.g. MemoryError, and we'll dereference NULL pointer without checking. Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit 09369aa86e233a58ed131fa5b7584b6c86527d40)
* pytdb: Add support for tdb_repack()Kirill Smelkov2010-10-072-0/+15
| | | | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit ce84abcc6be31554da73920280e6bfc5b63b1464)
* pytdb: Add TDB_INCOMPATIBLE_HASH open flagKirill Smelkov2010-10-071-0/+1
| | | | | | | | | | | | | In 2dcf76 Rusty added TDB_INCOMPATIBLE_HASH open flag which selects Jenkins lookup3 hash for new databases. Expose this flag to python users too. Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit 07880810941850e81442b888cd70d810d3f80fc3)
* tdb: fix non-WAF build, commit 1.2.6 ABI file.Rusty Russell2010-10-072-1/+62
| | | | | | | | Sorry Jeremy. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 7db9838cb5af0d334efbbcb96bfa51d19b35941a)
* tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.Rusty Russell2010-10-075-5/+22
| | | | | | | | | | | | | | | | | | 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: automatically identify Jenkins hash tdbsRusty Russell2010-10-071-14/+27
| | | | | | | | | | | | If the caller to tdb_open_ex() doesn't specify a hash, and tdb_old_hash doesn't match, try tdb_jenkins_hash. This was Metze's idea: it makes life simpler, especially with the upcoming TDB_INCOMPATIBLE_HASH flag. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 3f7ed2b46cb304d553d3f7bd34554d695b8ccc52)
* tdb: add Bob Jenkins lookup3 hash as helper hash.Rusty Russell2010-10-075-16/+384
| | | | | | | | | | | | This is a better hash than the default: shipping it with tdb makes it easy for callers to use it as the hash by passing it to tdb_open_ex(). This version taken from CCAN and modified, which took it from http://www.burtleburtle.net/bob/c/lookup3.c. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 58c9d90c758aa7c062d84ab97f62947190526356)
* tdb: add restoreVolker Lendecke2010-10-073-1/+239
| | | | | | Based on an idea by Simon McVittie, largely rewritten (This used to be ctdb commit 7cda5507f90d7598d745a1acfc66c2afa73cd4b5)
* lib/tdb: fix c++ build warning in tdb_header_hash().Günther Deschner2010-10-071-1/+1
| | | | | | Guenther (This used to be ctdb commit e34e639c214b010ff18140b769a8c9245c92006f)
* pytdb: Make filename argument optional.Jelmer Vernooij2010-10-072-13/+15
| | | | (This used to be ctdb commit 3cc73c51caff51e0cba688aefd6f37e632c0e8d4)
* pytdb: Add support for tdb_freelist_size()Kirill Smelkov2010-10-072-0/+9
| | | | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit dcdd83e6d6786f0857acdf9aa04bca74a7ccf14d)
* pytdb: Add support for tdb_transaction_prepare_commit()Kirill Smelkov2010-10-072-0/+18
| | | | | | | | Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit fd16bcc1434841d84fdf78f80163c97c0b52b3fe)
* pytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and ↵Kirill Smelkov2010-10-072-0/+30
| | | | | | | | | | tdb_increment_seqnum_nonblock Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit 1778fd02eec6e64737167c46173c0c76c85cc4d9)
* pytdb: Update open flags to match those for tdb_open() in tdb.hKirill Smelkov2010-10-071-0/+6
| | | | | | | | | | | Namely TDB_NOSYNC, TDB_SEQNUM, TDB_VOLATILE, TDB_ALLOW_NESTING and TDB_DISALLOW_NESTING were missing. Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit d0c28ff1fedd27a99a7550fcc74e18cb1f536986)
* pytdb: Fix repr segfault for internal dbKirill Smelkov2010-10-072-1/+11
| | | | | | | | | | | | | | | | | The problem was tdb->name is NULL for TDB_INTERNAL databases, and so it was crashing ... #0 0xb76944f3 in strlen () from /lib/i686/cmov/libc.so.6 #1 0x0809862b in PyString_FromFormatV (format=0xb72b6a26 "Tdb('%s')", vargs=0xbfc26a94 "") at ../Objects/stringobject.c:211 #2 0x08098888 in PyString_FromFormat (format=0xb72b6a26 "Tdb('%s')") at ../Objects/stringobject.c:358 #3 0xb72b65f2 in tdb_object_repr (self=0xb759e060) at ./pytdb.c:439 Cc: 597089@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit 3ff413baf04ce28eb54a80141250ae1284b2a521)
* pytdb: Add support for tdb_add_flags() & tdb_remove_flags()Kirill Smelkov2010-10-072-0/+27
| | | | | | | | | | | Note, unlike tdb_open where flags is `int', tdb_{add,remove}_flags want flags as `unsigned', so instead of "i" I used "I" in PyArg_ParseTuple. Cc: 597386@bugs.debian.org Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Jelmer Vernooij <jelmer@samba.org> (This used to be ctdb commit 7389f8a8a634c2fe0f068831326d92e6bfa0d046)
* tdb: added TDB_NO_FSYNC env variableAndrew Tridgell2010-10-071-0/+4
| | | | | | this might help reduce test times and load on test machines (This used to be ctdb commit 5c4240c364c52073ca64fddf2aa2c1593db0093b)
* tdb: increment version to 1.2.4Rusty Russell2010-10-071-1/+1
| | | | (This used to be ctdb commit f1c06608245ec34493c330d891e04c250ad64b20)
* tdb: put example hashes into header, so we notice incorrect hash_fn.Rusty Russell2010-10-073-2/+65
| | | | | | | | | | | | 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)
* Add back monitoring for time skips, forward as well as backward.Ronnie Sahlberg2010-09-281-0/+22
| | | | | | This serviceability tool was lost during the migration from the old eventsystem to the tevent system. (This used to be ctdb commit b4c00b4ac30ec215629f44f802ce9660abcd7a48)
* Merge commit 'rusty/ports-from-1.0.112' into fooRonnie Sahlberg2010-08-192-1/+4
|\ | | | | | | (This used to be ctdb commit 13e58d92f5f1723e850a82ae030d0ca57e89b1ee)
| * logging: give a unique logging name to each forked child.Rusty Russell2010-08-182-1/+4
| | | | | | | | | | | | | | | | This means we can distinguish which child is logging, esp. via syslog where we have no pid. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 68b3761a0874429b90731741f0531f76dcfbb081)
* | We use eventloop nesting in a couple of places, notably the syncRonnie Sahlberg2010-08-181-0/+2
| | | | | | | | | | | | | | | | parts of the recovery daemon. Initialize all event contexts to allow nesting (This used to be ctdb commit 5bf6bd5e7f33aabbeb7b9707716ef99cf471e590)
* | Merge commit 'rusty/libctdb-new' into fooRonnie Sahlberg2010-08-1871-2694/+15668
|\ \ | | | | | | | | | (This used to be ctdb commit 1566d2d23ab698896b3b6a76974a5c7452db4a62)
| * | event: Update events to latest Samba version 0.9.8Rusty Russell2010-08-1858-2358/+11225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Samba this is now called "tevent", and while we use the backwards compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now a separate tevent_fd_set_auto_close() function. This is based on Samba version 7f29f817fa939ef1bbb740584f09e76e2ecd5b06. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
| * | talloc: update to 2.0.3 version from SAMBARusty Russell2010-08-1813-336/+4443
| |/ | | | | | | | | | | | | | | | | This is based on SAMBA as at revision 2de63aa2801a907905b3e05557074af5b896d486. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit cecd93be0a0aab868430dd43f8276bfb4e35f02e)
* | tdb: workaround starvation problem in locking entire database.Rusty Russell2010-08-162-18/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Imported from SAMBA 11ab43084b10cf53b530cdc3a6036c898b79ca38) We saw tdb_lockall() take 71 seconds under heavy load; this is because Linux (at least) doesn't prevent new small locks being obtained while we're waiting for a big log. The workaround is to do divide and conquer using non-blocking chainlocks: if we get down to a single chain we block. Using a simple test program where children did "hold lock for 100ms, sleep for 1 second" the time to do tdb_lockall() dropped signifiantly. There are ln(hashsize) locks taken in the contended case, but that's slow anyway. More analysis is given in my blog at http://rusty.ozlabs.org/?p=120 This may also help transactions, though in that case it's the initial read lock which uses this gradual locking routine; the update-to-write-lock code is separate and still tries to update in one go. Even though ABI doesn't change, minor version bumped so behavior change can be easily detected. CQ:S1018154 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 9ec0009443a0ac4187ce5212a5143689daa58a02)
* | 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: remove unused variable in tdb_new_database().Rusty Russell2010-08-161-1/+0
| | | | | | | | | | | | (Imported from SAMBA 2eab1d7fdcb54f9ec27431ca4858eb64cb1bd835) (This used to be ctdb commit 52a87e608d0406aee9df99f7ac3ce16e834b520b)
* | tdb: fix short write logic in tdb_new_databaseRusty Russell2010-08-163-17/+17
|/ | | | | | | | | | | | | | Commit 207a213c/24fed55d purported to fix the problem of signals during tdb_new_database (which could cause a spurious short write, hence a failure). However, the code is wrong: newdb+written is not correct. Fix this by introducing a general tdb_write_all() and using it here and in the tracing code. Cc: Stefan Metzmacher <metze@samba.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 27ba0e5a6681063225df7244a85aa304c51c6948)
* tdb: improve loggingRusty Russell2010-07-011-2/+3
| | | | | | | | When tdb throws an error, we didn't report the name of the tdb; we should. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit cfea357c9b2142c8cd8cac1ee712d40b188793e1)
* idtree: fix handling of large ids (eg INT_MAX)Rusty Russell2010-06-101-2/+4
| | | | | | | | | | | | | Since idtree assigns sequentially, it rarely reaches high numbers. But such numbers can be forced with idr_get_new_above(), and that reveals two bugs: 1) Crash in sub_remove() caused by pa array being too short. 2) Shift by more than 32 in _idr_find(), which is undefined, causing the "outside the current tree" optimization to misfire and return NULL. Signed-off-by: Rusty Russell <rusty@rustorp.com.au> (This used to be ctdb commit 32c04e11ebbcf8239e47016302c6ce802a8b0a6f)
* tdb: define _PUBLIC_ so we can compile tdb.Rusty Russell2010-04-221-0/+5
| | | | | | | | | | | The Samba tree defines _PUBLIC_ (and _PRIVATE_) for libraries to control visibility. The last commit absorbed this from their tdb, but we need to #define to stub it out since ctdb doesn't use it (and doesn't need to: we only use tdb internally). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 54bee0ec670724c337b882e7dda3e999ffa80691)
* tdb: update tdb ABI to use hide_symbols=TrueAndrew Tridgell2010-04-224-77/+65
| | | | | | | | | | | | | | | | | | We now use -fvisibilty=hidden to hide symbols from outside the tdb shared library. This also moved tdb_transaction_recover() into the tdb_private.h header, as it should never have been a public API. For that reason we are changing the version number. We're only doing a minor version increment as it is extremely unlikely that anyone was actually using tdb_transaction_recover() as its locking requirements were rather unusual. Pair-Programmed-With: Rusty Russell <rusty@samba.org> (Imported from commit 773a8afbba27a5e2e48577100f3ca9873b506615) (This used to be ctdb commit e174dc084f11db0eb239b643affef2c02c711b1c)
* subunit: Support formatting compatible with upstream subunit, for consistency.Jelmer Vernooij2010-04-221-1/+1
| | | | | | | | | | Upstream subunit makes a ":" after commands optional, so I've fixed any places where we might trigger commands accidently. I've filed a bug about this in subunit. (Imported from commit 7da94cc4a664521be279b019e9f32121cd410193) (This used to be ctdb commit f1242d9cba676d1d393375bea42613192c70662e)
* tdb: update exports and signatures filesSimo Sorce2010-04-222-0/+2
| | | | | | (Imported from commit c1f6f61f620e865516d1856c9d937b5326a29046) (This used to be ctdb commit e61ff181085b35cb4aba933350bfe4f64471b359)
* tdb: Add a non-blocking version of tdb_transaction_startVolker Lendecke2010-04-226-8/+24
| | | | | | (Imported from commit 261c3b4f1beed820647061bacbee3acccbcbb089) (This used to be ctdb commit 87ced00d6d98be4a34719af58694e7c940b4dd68)
* tdb: Fix indentation in tdb_new_database()Volker Lendecke2010-04-221-1/+1
| | | | | | (Imported from commit 59315887a07033316edf91c0c57563eee5ea992d) (This used to be ctdb commit fa38f818c71c85918e673ff563bf7a91a0c4cc17)
* Fix some nonempty blank linesVolker Lendecke2010-04-2210-45/+44
| | | | | | (Imported from commit ea8e0d5d54b020c530e392c4edaeed43e20af303) (This used to be ctdb commit 7161cb1607bb105cd6f4f32df50f519314e77b3f)
* python: use '#!/usr/bin/env python' to cope with varying install locationsAndrew Tridgell2010-04-222-2/+2
| | | | | | | | this should be much more portable (Imported from commit 088096d1bad51428a2e2d487214995d4fdfc7ccc) (This used to be ctdb commit 7f1330adc690360a4a8ce85352df0908a93684a5)