summaryrefslogtreecommitdiffstats
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: remove persistent_safe write test.Michael Adam2009-12-091-39/+0
| | | | | | | | This is useless now that persistent writes without transactions are forbidden. Michael (This used to be ctdb commit 9ac82311d796e1fab31f8de62b8ccc754445093c)
* test: add test 54_ctdb_transaction_recovery.shMichael Adam2009-12-091-0/+66
| | | | | | | | | | | | | | | This is like the 53_ctdb_transaction test, but it additionally runs a loop with recoveries while the transactions are running. When called like this, the transaction loops run for 10 minutes: CTDB_TEST_TIMELIMIT=600 tests/scripts/run_tests tests/simple/54_ctdb_transaction_recovery.sh The default timelimit is 30 seconds. Michael (This used to be ctdb commit 2ff2679e8f3d50ebf735f2c420898a84268bdc95)
* test: get value for --timelimit from environment var CTDB_TEST_TIMELIMIT in ↵Michael Adam2009-12-091-1/+5
| | | | | | | | transaction test Michael (This used to be ctdb commit c13077ca64f6e6569c30ef7fcb044e5711dce1a3)
* client: lower level of commit retry message WARNING->DEBUGMichael Adam2009-12-091-3/+3
| | | | | | | | This can happen frequently when recoveries intercept transactions. Michael (This used to be ctdb commit c46adb210e47530488503e20d682d4d182c0fb79)
* client: lower debug level of transaction-active-retry message to DEBUGMichael Adam2009-12-091-4/+4
| | | | | | | | This reduces some noise. Michael (This used to be ctdb commit 54d227811753f4a87f1a2c9dc0b1389f5ca2a12f)
* call: lower the debug message "refusing migration while transction" to lvl INFOMichael Adam2009-12-091-1/+1
| | | | | | | | | This gets just too noisy on a busy system. And it is purley informational anyways... Michael (This used to be ctdb commit 7f64a00c76203fdf6673c3f862a4bfd17fb848d7)
* Run only one event for each epoll_wait/select callVolker Lendecke2009-12-105-8/+5
| | | | | | | | This might be a bit less efficient, but experience in winbind has shown that event callbacks can trigger changes in the socket state in very hard to diagnose ways. (This used to be ctdb commit a78b8ea7168e5fdb2d62379ad3112008b2748576)
* reduce vacuuming lognoiseChristian Ambach2009-12-101-6/+6
| | | | | | | | | | | | | | syslog.h says: LOG_NOTICE 5 normal but significant condition LOG_INFO 6 informational several vacuuming related logs logged at NOTICE level although I don't see any real significance, these are just informational messages for me Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com> (This used to be ctdb commit 142111983c103e90ccccbe26fd580c4eb28e949f)
* improve time jump loggingChristian Ambach2009-12-103-6/+6
| | | | | | | | | add the __location__ macro to the logs to get a better idea in which loop the problem occured Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com> (This used to be ctdb commit dccb549fd6a6e338063699544e52f2a1a6a966b5)
* Merge commit 'rusty/script-report'Ronnie Sahlberg2009-12-0913-765/+645
|\ | | | | | | (This used to be ctdb commit 6e8b279ed307eccac08386e98510361ba3ab3d36)
| * ctdb: scriptstatus can now query non-monitor eventsRusty Russell2009-12-086-31/+101
| | | | | | | | | | | | | | | | | | | | | | | | We also no longer return an error before scripts have been run; a special zero-length data means we have never run the scripts. "ctdb scriptstatus all" returns all event script results. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 9b90d671581e390e2892d3a68f3ca98d58bef4df)
| * eventscript: expost call names and enumRusty Russell2009-12-084-39/+45
| | | | | | | | | | | | | | | | | | We're going to need this so ctdb can query non-monitor status. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 53bc5ca23ca55a3ac63a440051f16716944a2a51)
| * eventscript: lock logging on timeout.Rusty Russell2009-12-081-1/+2
| | | | | | | | | | | | | | | | | | Ronnie suggested this; seems like a very good idea. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 93153bca68926401dc9ae7fd77ed3f17be923344)
| * ctdb: support --machinereadable (-Y) for scriptstatusRusty Russell2009-12-081-1/+17
| | | | | | | | | | | | | | Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 47ffe75848f216568ce3db0a60ca88cfe3d6903a)
| * eventscript: get rid of ctdb_control_event_script_finished altogetherRusty Russell2009-12-081-22/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We always have to call it before freeing the state; we should just do this work in the destructor itself. Unfortunately, the script state would already be freed by the time the state destructor is called, so we make the script state a child of ctdb, and talloc_free() it manually on the one path which doesn't use the destructor. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit c1ba1392fe52762960e896ace0aca0ee4faa94d5)
| * eventscript: save state for all script invocationsRusty Russell2009-12-082-33/+26
| | | | | | | | | | | | | | | | | | | | Rather than only tranferring to last_status for monitor events, do it for every event (ctdb->last_status is now an array). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit c73ea56275d4be76f7ed983d7565b20237dbdce3)
| * eventscript: cleanup finished to take state argRusty Russell2009-12-081-15/+10
| | | | | | | | | | | | | | | | | | | | | | We only need ctdb->current_monitor so we can kill it when we want to run something else; we don't need to use it here as we always know what script we are running. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 4cf1b7c32bcf7e4b65aec1fa7ee1a4b162cac889)
| * eventscript: use wire format internally for script status.Rusty Russell2009-12-081-71/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference between the exposed an internal structure now is that the name and output fields were pointers. Switch to using ctdb_scripts_wire/ctdb_script_wire internally as well so marshalling is a noop. We now reject scripts which are too long and truncate logging to the 511 characters we have space for (the entire output will be in the normal ctdbd log). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit fd2f04554e604bc421806be96b987e601473a9b8)
| * eventscript: rename ctdb_monitoring_wire to ctdb_scripts_wireRusty Russell2009-12-085-11/+11
| | | | | | | | | | | | | | | | | | | | We're going to allow fetching status of all script runs, so this name is no longer appropriate. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit f5cb41ecf3fa986b8af243e8546eb3b985cd902a)
| * eventscript: get_current_script() helperRusty Russell2009-12-081-10/+15
| | | | | | | | | | | | | | | | | | | | This neatens the code slightly. We also use the name 'current' in ctdb_event_script_handler() for uniformity. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit e9661b383e0c50b9e3d114b7434dfe601aff5744)
| * eventscript: use an array rather than a linked list of scriptsRusty Russell2009-12-081-94/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings us closer to the wire format, by using a simple array and a 'current' iterator. The downside is that a 'struct ctdb_script' is no longer a talloc object: the state must be passed to our log fn, and the current script extracted with &state->scripts->scripts[state->current]. The wackiness of marshalling is simplified, and as a bonus, we can distinguish between an empty event directory (state->scripts->num_scripts == 0) and and error (state->scripts == NULL). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 76e8bdc11b953398ce8850de57aa51f30cb46bff)
| * eventscript: record script status for all eventsRusty Russell2009-12-081-83/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This unifies almost everything: the state->current pointer points to the struct ctdb_script where we record start, finish, status and output. We still only marshall up the monitor events; the rest disappear when the state structure is freed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit c476c81f3e3d8fc62f2e53d82fce5774044ee9ce)
| * eventscript: use scripts array directly, rather than separate listRusty Russell2009-12-081-50/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We rename ctdb_monitor_script_status to ctdb_script, and instead of allocating them as the scripts are executed, we allocate them up front and keep a "current" interator. This slightly simplifies the code, though it means we only marshall up to the last successfully run script. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit b2a300768536d10bd867a987ad4cf1c5268c44bc)
| * eventscript: ctdb_fork_with_logging()Rusty Russell2009-12-083-34/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new helper functions which sets up an event attached to the child's stdout/stderr which gets routed to the logging callback after being placed in the normal logs. This is a generalization of the previous code which was hardcoded to call ctdb_log_event_script_output. The only subtlety is that we hang the child fds off the output buffer; the destructor for that will flush, which means it has to be destroyed before the output buffer is. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 32cfdc3aec34272612f43a3588e4cabed9c85b68)
| * eventscript: pass struct ctdb_log_state directly to ctdb_log_handler().Rusty Russell2009-12-081-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current logging logic assumes that any stdout/stderr belongs to the currently running monitor script output. This isn't quite right anyway, and we'd like to capture stderr output of other script invocations. So we move towards multiple struct ctdb_log_state by handing it directly to ctdb_log_handler to use, rather than having it assume ctdb->log. We need a ctdb pointer inside the log struct now though. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 497766cf186442de00fb324343150442457be858)
| * eventscript: remove unused ctbd_ctrl_event_script*Rusty Russell2009-12-084-179/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The child no longer uses ctdb_ctrl_event_script_init or ctdb_ctrl_event_script_finished, and the others are redundant: it doesn't need to tell us it's starting a script when it only runs one. We move start and stop calls to the parent, and eliminate the RPC infrastructure altogether. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 391926a87a7af73840f10bb314c0a2f951a0854c)
| * eventscript: refactor forking code into fork_child_for_script()Rusty Russell2009-12-081-77/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | We do the same thing in two places: fire off a child from the initial ctdb_event_script_callback_v() and also from the ctdb_event_script_handler() when it's done. Unify this logic into fork_child_for_script(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 814704a3286756d40c2a6c508c1c0b77fa711891)
| * eventscript: fork() a child for each script.Rusty Russell2009-12-081-59/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We rename child_run_scripts() to child_run_script(), because it now runs a single script rather than walking the list. When it's finished, we fork the next child from the ctdb_event_script_handler() callback. ctdb_control_event_script_init() and ctdb_control_event_script_finished() are now called directly by the parent process; the child still calls ctdb_ctrl_event_script_start() and ctdb_ctrl_event_script_stop() before and after the script. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 0fafdcb8d3532a05846abaa5805b2e2f3cee8f47)
| * eventscript: store from_user and script_list inside state structureRusty Russell2009-12-081-3/+5
| | | | | | | | | | | | | | | | | | | | This means all the state about running the scripts is in that structure, which helps in the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 020fd21e0905e7f11400f6537988645987f2bb32)
| * eventscript: use direct script state pointer for current monitorRusty Russell2009-12-082-26/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We put a "scripts" member in ctdb_event_script_state, rather than using a special struct for monitor events. This will fit better as we further unify the different events, and holds the reports from the child process running each monitor script. Rather than making the monitor state a child of current_monitor_status_ctx, we just point current_monitor directly at it. This means we need to reset that pointer in the destructor for ctdb_event_script_state. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 9a2b4f6b17e54685f878d75bad27aa5090b4571f)
| * eventscript: make current_monitor_status_ctx serve as monitor_event_script_ctxRusty Russell2009-12-082-38/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have monitor_event_script_ctx and other_event_script_ctx, and current_monitor_status_ctx in struct ctdb_context. This seems more complex than it needs to be. We use a single "event_script_ctx" as parent for all event script state structures. Then we explicitly reparent monitor events under current_monitor_status_ctx: this is freed every script invocation to kill off any running scripts anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 0d925e6f2767691fa561f15bbb857a2aec531143)
| * eventscript: split ctdb_run_event_script into multiple partsRusty Russell2009-12-071-62/+88
| | | | | | | | | | | | | | | | | | | | Simple refactoring in preparation for switching to one-child-per-script. We also call the functions run by the child process "child_". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit bfee777faff75e9bed4aedc1558957483616a6d3)
| * eventscript: hoist work out of child process, into parentRusty Russell2009-12-071-22/+24
| | | | | | | | | | | | | | | | | | | | | | This is the start of a move towards finer-grained reporting, with one child per script. Simple code motion to do sanity check and get the list of scripts before fork(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 816b9177f51ae5b21b92ff4a404f548fe9723c96)
| * eventscript: don't make ourselves healthy if we're under ban_countRusty Russell2009-12-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If we've timed out, but we've not timed out more than ctdb->tunable.script_ban_count, we pretend we haven't. There's a logic bug in the way this is done: if we were unhealthy before, this would set us to "healthy" again (status == 0). I don't think this would happen in real life, but it's a little surprising. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit e6488c0e05bab5c4c2c0a6370930b0b27e5ed56e)
| * eventscript: handle banning within the callbacksRusty Russell2009-12-074-41/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the timeout handler in eventscript.c does the banning if a timeout happens. However, because monitor events are different, it has to special case them. As we call the callback anyway in this case, we should make that handle -ETIME as it sees fit: for everyone but the monitor event, we simply ban ourselves. The more complicated monitor event banning logic is now in ctdb_monitor.c where it belongs. Note: I wrapped the other bans in "if (status == -ETIME)", though they should probably ban themselves on any error. This change should be a noop. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 9ecee127e19a9e7cae114a66f3514ee7a75276c5)
| * eventscript: expost ctdb_ban_self()Rusty Russell2009-12-073-16/+17
| | | | | | | | | | | | | | | | | | eventscript.c uses this now, but our next patch makes others use it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit a305cb7743c24386e464f6b2efab7e2108bb1e7e)
| * eventscript: handle v. unlikely timeout raceRusty Russell2009-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | If we time out just as the child exits, we currently will report an uninitialized cb_status field. Set it to -ETIME as expected. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 024386931bda9757079f206238ae09bae4de6ea2)
| * eventscript: replace other -1 returns with -errnoRusty Russell2009-12-071-22/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This completes our "problem with script" reporting; we never set cb_status to -1 on error. Real errnos are used where the failure is a system call (eg. read, setpgid), otherwise -EIO is used if we couldn't communicate with the parent. The latter case is a bit useless, since the parent probably won't see the error anyway, but it's neater. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 1269458547795c90d544371332ba1de68df29548)
| * eventscript: simplify ctdb_run_event_script loopRusty Russell2009-12-071-13/+3
| | | | | | | | | | | | | | | | | | | | If we break, we avoid cut & paste code inside the loop. Need to initialize ret to 0 for the "no scripts" case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit ec36ced9446da7e3bf866466d265ee8e18f606c1)
| * eventscript: handle and report generic stat/execution errorsRusty Russell2009-12-072-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than ignoring deleted event scripts (or pretending that they were "OK"), and discarding other stat errors, we save the errno and turn it into a negative status. This gives us a bit more information if we can't execute a script (eg. too many symlinks or other weird errors). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 5d894e1ae5228df6bbe4fc305ccba19803fa3798)
| * eventscript: use -ENOEXEC for disabled status valueRusty Russell2009-12-076-66/+8
| | | | | | | | | | | | | | | | | | | | This unifies code paths and simplifies things: we just hand -ENOEXEC to ctdb_ctrl_event_script_stop(). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit eadf5e44ef97d7703a7d3bce0e7ea0f21cb11f14)
| * eventscript: enhance script delete race checkRusty Russell2009-12-071-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | We currently assume 127 == script removed. The script can also return 127; best to re-check the execution status in this case (and for 126, which will happen if the script is non-executable). If the script is no longer executable/not present, we ignore it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 0a53d6b5ac81daf0efa32f35e7758ede2a5bdb63)
| * eventscript: check_executable() to centralize stat/perm checksRusty Russell2009-12-071-11/+32
| | | | | | | | | | | | | | | | | | This is used later in the "script vanished" check. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 8ddb97040842375daf378cbb5816d0c2b031fa65)
| * talloc: save errno over talloc_freeRusty Russell2009-12-071-1/+6
| | | | | | | | | | | | | | | | | | | | As we start to use errno more, it's a huge pain if talloc_free() can blatt it (esp. destructors). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 76a0ca77feba14e1e1162c195ffbdf516e62aa4d)
| * eventscript: use -ETIME for timeout status valueRusty Russell2009-12-073-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | This starts the move toward more expressive encoding of return values: positive values mean the script ran, negative means we had a problem with the script (and the value is the errno). This does timeout, but changes the ctdb tool to recognize it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 0eb1d0aa14e68b598d9e281c8a02b8f94a042fd9)
| * eventscript: marshall onto last_status immediatelyRusty Russell2009-12-072-35/+26
| | | | | | | | | | | | | | | | | | | | This simplifies the code a little: last_status is now read to go (it's only used by the scriptstatus command at the moment). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 6be931266a4e41fd0253f760936ad9707dd97c47)
| * eventscript: reduce code duplication for ending a script, and fix bugRusty Russell2009-12-021-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 50c2caed57c0 removed a gratuitous talloc_steal from the code in ctdb_control_event_script_finished(), but not ctdb_event_script_timeout(). Easiest to call ctdb_control_event_script_finished() at the bottom of the timeout routine. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 17fa252d0d6981fbae8083a818f26d5ce9c5102e)
* | Bond devices can have any name the user configures, soRonnie Sahlberg2009-12-091-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | when checking link status for an interface, first check if this interface is in fact a bond device (by the precense of a /proc/net/bonding/IFACE file) and use that file for checking status. Othervise assume ib* is an infiniband interface which we donnt know how to check, or otherwise it is an ethernet interface and ethtool should hopefully work. (This used to be ctdb commit 8cc6c5de3d7abb0b72eaa6e769e70963b02d84cb)
* | make sure to also check that interfaces used for NATGW are okRonnie Sahlberg2009-12-091-0/+1
| | | | | | | | | | | | | | and have a link. if not the node should become unhealthy (This used to be ctdb commit 03b5bbaae1b53830a4cd20d3079ab8f45ffce923)
* | events/50.samba: only use wbinfo --ping-dc if availableStefan Metzmacher2009-12-081-1/+6
|/ | | | | | metze (This used to be ctdb commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b)