diff options
author | Michael Adam <obnox@samba.org> | 2011-02-23 17:38:40 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-02-24 10:35:26 +0100 |
commit | 2bd04f0ff84d213f416c7df66c6745eed7d769da (patch) | |
tree | e9c6bda8689b94052be232b11780d400b7949b72 /ctdb/server/ctdb_persistent.c | |
parent | ee44c23cd5a9388eaa3e9bee76e778373e09f557 (diff) | |
download | samba-2bd04f0ff84d213f416c7df66c6745eed7d769da.tar.gz samba-2bd04f0ff84d213f416c7df66c6745eed7d769da.tar.xz samba-2bd04f0ff84d213f416c7df66c6745eed7d769da.zip |
persistent: add ctdb_persistent_finish_trans3_commits().
This function walks all databases and checks for running trans3 commits.
It sends replies to all of them (with error code) and ends them.
To be called when a recovery finishes.
(This used to be ctdb commit 70ba153b532528bdccea70c5ea28972257f384c1)
Diffstat (limited to 'ctdb/server/ctdb_persistent.c')
-rw-r--r-- | ctdb/server/ctdb_persistent.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_persistent.c b/ctdb/server/ctdb_persistent.c index 0627037ea9..b95f456ecf 100644 --- a/ctdb/server/ctdb_persistent.c +++ b/ctdb/server/ctdb_persistent.c @@ -118,6 +118,40 @@ static void ctdb_persistent_store_timeout(struct event_context *ev, struct timed talloc_free(state); } +/** + * Finish pending trans3 commit controls, i.e. send + * reply to the client. This is called by the end-recovery + * control to fix the situation when a recovery interrupts + * the usual porgress of a transaction. + */ +void ctdb_persistent_finish_trans3_commits(struct ctdb_context *ctdb) +{ + struct ctdb_db_context *ctdb_db; + + if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) { + DEBUG(DEBUG_INFO, ("ctdb_persistent_store_timeout: ignoring " + "timeout during recovery\n")); + return; + } + + for (ctdb_db = ctdb->db_list; ctdb_db; ctdb_db = ctdb_db->next) { + struct ctdb_persistent_state *state; + + if (ctdb_db->persistent_state == NULL) { + continue; + } + + state = ctdb_db->persistent_state; + + ctdb_request_control_reply(ctdb, state->c, NULL, + CTDB_TRANS2_COMMIT_SOMEFAIL, + "trans3 commit ended by recovery"); + + /* The destructor sets ctdb_db->persistent_state to NULL. */ + talloc_free(state); + } +} + /* store a set of persistent records - called from a ctdb client when it has updated some records in a persistent database. The client will have the record |