summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_call.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-11-24 08:01:01 +0100
committerMichael Adam <obnox@samba.org>2011-02-24 10:35:26 +0100
commit53b558a3bce18fbc05ca52a7b6bbcae6b6b125f1 (patch)
tree1ac1130a3ae4f6289f0440efcc922fa515d71a71 /ctdb/server/ctdb_call.c
parent40e922f4e687129069a6f526ad8c593f94cd92ec (diff)
downloadsamba-53b558a3bce18fbc05ca52a7b6bbcae6b6b125f1.tar.gz
samba-53b558a3bce18fbc05ca52a7b6bbcae6b6b125f1.tar.xz
samba-53b558a3bce18fbc05ca52a7b6bbcae6b6b125f1.zip
server: add a comment explaining the call redirect logic in ctdb_call_send_redirect().
(This used to be ctdb commit 81663b81687c0ba681500cca6aa8174bb9587ad2)
Diffstat (limited to 'ctdb/server/ctdb_call.c')
-rw-r--r--ctdb/server/ctdb_call.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index be6e8f93d2d..e188fcfcded 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -99,9 +99,30 @@ static void ctdb_send_error(struct ctdb_context *ctdb,
}
-/*
- send a redirect reply
-*/
+/**
+ * send a redirect reply
+ *
+ * The logic behind this function is this:
+ *
+ * A client wants to grab a record and sends a CTDB_REQ_CALL packet
+ * to its local ctdb (ctdb_request_call). If the node is not itself
+ * the record's DMASTER, it first redirects the packet to the
+ * record's LMASTER. The LMASTER then redirects the call packet to
+ * the current DMASTER. But there is a race: The record may have
+ * been migrated off the DMASTER while the redirected packet is
+ * on the wire (or in the local queue). So in case the record has
+ * migrated off the new destinaton of the call packet, instead of
+ * going back to the LMASTER to get the new DMASTER, we try to
+ * reduce rountrips by fist chasing the record a couple of times
+ * before giving up the direct chase and finally going back to the
+ * LMASTER (again). Note that this works because auf this: When
+ * a record is migrated off a node, then the new DMASTER is stored
+ * in the record's copy on the former DMASTER.
+ *
+ * The maxiumum number of attempts for direct chase to make before
+ * going back to the LMASTER is configurable by the tunable
+ * "MaxRedirectCount".
+ */
static void ctdb_call_send_redirect(struct ctdb_context *ctdb,
TDB_DATA key,
struct ctdb_req_call *c,