Rev 266: merged ronnies code to delay client requests when in
recovery mode in http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Wed May 9 21:43:19 GMT 2007
------------------------------------------------------------
revno: 266
revision-id: tridge at samba.org-20070509214318-io4xhj2e6k91eosm
parent: tridge at samba.org-20070509015437-c9u6pubosc3jz0um
parent: sahlberg at ronnie-20070509040811-460ac8e7d6691f7f
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Thu 2007-05-10 07:43:18 +1000
message:
merged ronnies code to delay client requests when in recovery mode
modified:
common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
------------------------------------------------------------
revno: 197.1.90
merged: sahlberg at ronnie-20070509040811-460ac8e7d6691f7f
parent: sahlberg at ronnie-20070509040647-f8724a40b8a205e5
committer: Ronnie Sahlberg <sahlberg at ronnie>
branch nick: ctdb
timestamp: Wed 2007-05-09 14:08:11 +1000
message:
hang the event from the retry structure instead of the hdr structure
------------------------------------------------------------
revno: 197.1.89
merged: sahlberg at ronnie-20070509040647-f8724a40b8a205e5
parent: sahlberg at ronnie-20070508235923-78a4589b69fa8935
committer: Ronnie Sahlberg <sahlberg at ronnie>
branch nick: ctdb
timestamp: Wed 2007-05-09 14:06:47 +1000
message:
when we are in recovery mode and we get a REQ_CALL from a client,
defer it for one second and try again
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c 2007-05-08 23:59:23 +0000
+++ b/common/ctdb_daemon.c 2007-05-09 21:43:18 +0000
@@ -334,6 +334,30 @@
}
+struct ctdb_client_retry {
+ struct ctdb_client *client;
+ struct ctdb_req_call *call;
+};
+
+static void daemon_request_call_from_client(struct ctdb_client *client,
+ struct ctdb_req_call *c);
+
+/*
+ triggered after a one second delay, retrying a client packet
+ that was deferred because of the daemon being in recovery mode
+ */
+static void retry_client_packet(struct event_context *ev, struct timed_event *te,
+ struct timeval t, void *private_data)
+{
+ struct ctdb_client_retry *retry = talloc_get_type(private_data, struct ctdb_client_retry);
+
+ daemon_request_call_from_client(retry->client, retry->call);
+
+ talloc_free(retry);
+}
+
+
+
/*
this is called when the ctdb daemon received a ctdb request call
from a local client over the unix domain socket
@@ -350,6 +374,29 @@
int ret;
struct ctdb_context *ctdb = client->ctdb;
+ if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
+ struct ctdb_client_retry *retry;
+
+ DEBUG(0,(__location__ " ctdb call %u from client"
+ " while we are in recovery mode. Deferring it\n",
+ c->hdr.reqid));
+
+ /* hang the event and the structure off client */
+ retry = talloc(client, struct ctdb_client_retry);
+ CTDB_NO_MEMORY_VOID(ctdb, retry);
+ retry->client = client;
+ retry->call = c;
+
+ /* this ensures that after the retry happens we
+ eventually free this request */
+ talloc_steal(retry, c);
+
+ event_add_timed(ctdb->ev, retry, timeval_current_ofs(1,0), retry_client_packet, retry);
+ return;
+ }
+
+
+
ctdb->status.total_calls++;
ctdb->status.pending_calls++;
More information about the samba-cvs
mailing list