Revert "LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy...
authorAmitay Isaacs <amitay@gmail.com>
Mon, 19 Aug 2013 05:04:46 +0000 (15:04 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Thu, 22 Aug 2013 04:08:52 +0000 (14:08 +1000)
This reverts commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504.

This is a premature optimization.  Record can bounce between nodes
very quickly if it is a contended record.  There is no need to hold a
record on a node unnecessarily.  In case record contention becomes bad,
enabling sticky records on a database is a better idea.

Conflicts:
include/ctdb_private.h
server/ctdb_tunables.c

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
client/ctdb_client.c
common/ctdb_ltdb.c
include/ctdb_private.h
include/ctdb_protocol.h
server/ctdb_call.c
server/ctdb_tunables.c

index 764404edfddfcc1b7f949e516a223b9e0c918039..8bab9bba8672d3d9750dc183a11137eda350f0b6 100644 (file)
@@ -70,7 +70,7 @@ struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
 */
 int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
                    struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
-                   TDB_DATA *data, bool updatetdb, uint32_t caller)
+                   TDB_DATA *data, bool updatetdb)
 {
        struct ctdb_call_info *c;
        struct ctdb_registered_call *fn;
@@ -105,15 +105,7 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
        }
 
        /* we need to force the record to be written out if this was a remote access */
-       if (header->laccessor != caller) {
-               header->lacount = 0;
-       }
-       header->laccessor = caller;
-       header->lacount++;
-
-       /* we need to force the record to be written out if this was a remote access,
-          so that the lacount is updated */
-       if (c->new_data == NULL && header->laccessor != ctdb->pnn) {
+       if (c->new_data == NULL) {
                c->new_data = &c->record_data;
        }
 
@@ -368,7 +360,7 @@ static struct ctdb_client_call_state *ctdb_client_call_local_send(struct ctdb_db
        *(state->call) = *call;
        state->ctdb_db = ctdb_db;
 
-       ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true, ctdb->pnn);
+       ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
        if (ret != 0) {
                DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
        }
index 9c2a6898e05540d7497668fb8efa156f3e3af447..4681f304187f53835e7e42fb917cdad1f9077c17 100644 (file)
@@ -66,7 +66,6 @@ static void ltdb_initial_header(struct ctdb_db_context *ctdb_db,
        /* initial dmaster is the lmaster */
        header->dmaster = ctdb_lmaster(ctdb_db->ctdb, &key);
        header->flags = CTDB_REC_FLAG_AUTOMATIC;
-       header->laccessor = header->dmaster;
 }
 
 
index 9c78440c2a76ab991d4aa046d53536687f35125b..3c97363b87c9dddf275d49f85ad79ec6c3e8d212 100644 (file)
@@ -126,7 +126,6 @@ struct ctdb_tunable {
        uint32_t recover_pdb_by_seqnum;
        uint32_t deferred_rebalance_on_node_add;
        uint32_t fetch_collapse;
-       uint32_t max_lacount;
        uint32_t hopcount_make_sticky;
        uint32_t sticky_duration;
        uint32_t sticky_pindown;
@@ -872,7 +871,7 @@ struct ctdb_call_state *ctdb_daemon_call_send_remote(struct ctdb_db_context *ctd
 
 int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
                    struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
-                   TDB_DATA *data, bool updatetdb, uint32_t caller);
+                   TDB_DATA *data, bool updatetdb);
 
 #define ctdb_reqid_find(ctdb, reqid, type)     (type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)
 
index f72381f7db9d1c6722ec36012e5941b6a3e199cf..7b8298b4db83eb515a8aad7895ff9d02976a65e0 100644 (file)
@@ -524,8 +524,7 @@ enum ctdb_trans2_commit_error {
 struct ctdb_ltdb_header {
        uint64_t rsn;
        uint32_t dmaster;
-       uint16_t laccessor;
-       uint16_t lacount;
+       uint32_t reserved1;
 #define CTDB_REC_FLAG_DEFAULT                  0x00000000
 #define CTDB_REC_FLAG_MIGRATED_WITH_DATA       0x00010000
 #define CTDB_REC_FLAG_VACUUM_MIGRATED          0x00020000
index bda599acc84a6bf658e40018cb97a72828c8debb..017e4f575ce1a22470ab16c99e8f562750663ca6 100644 (file)
@@ -399,7 +399,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
                return;
        }
 
-       ctdb_call_local(ctdb_db, state->call, &header, state, &data, true, ctdb->pnn);
+       ctdb_call_local(ctdb_db, state->call, &header, state, &data, true);
 
        ret = ctdb_ltdb_unlock(ctdb_db, state->call->key);
        if (ret != 0) {
@@ -930,15 +930,11 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        }
 
 
-       /* if this nodes has done enough consecutive calls on the same record
-          then give them the record
-          or if the node requested an immediate migration
-       */
-       if ( c->hdr.srcnode != ctdb->pnn &&
-            ((header.laccessor == c->hdr.srcnode
-              && header.lacount >= ctdb->tunable.max_lacount
-              && ctdb->tunable.max_lacount != 0)
-             || (c->flags & CTDB_IMMEDIATE_MIGRATION)) ) {
+       /* Try if possible to migrate the record off to the caller node.
+        * From the clients perspective a fetch of the data is just as 
+        * expensive as a migration.
+        */
+       if (c->hdr.srcnode != ctdb->pnn) {
                if (ctdb_db->transaction_active) {
                        DEBUG(DEBUG_INFO, (__location__ " refusing migration"
                              " of key %s while transaction is active\n",
@@ -957,7 +953,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
                }
        }
 
-       ret = ctdb_call_local(ctdb_db, call, &header, hdr, &data, true, c->hdr.srcnode);
+       ret = ctdb_call_local(ctdb_db, call, &header, hdr, &data, true);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,(__location__ " ctdb_call_local failed\n"));
                call->status = -1;
@@ -1244,7 +1240,7 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_db_context *ctdb_db,
        *(state->call) = *call;
        state->ctdb_db = ctdb_db;
 
-       ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true, ctdb->pnn);
+       ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
        if (ret != 0) {
                DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
        }
index 7d06d831a24173f56638139f6bb99c78faa82d20..5fb4344e2b7f246150b6ca45ad769cafa155ceea 100644 (file)
@@ -75,7 +75,6 @@ static const struct {
        { "RecoverPDBBySeqNum",  0, offsetof(struct ctdb_tunable, recover_pdb_by_seqnum), false },
        { "DeferredRebalanceOnNodeAdd", 300, offsetof(struct ctdb_tunable, deferred_rebalance_on_node_add) },
        { "FetchCollapse",       1, offsetof(struct ctdb_tunable, fetch_collapse) },
-       { "MaxLACount",         20,  offsetof(struct ctdb_tunable, max_lacount) },
        { "HopcountMakeSticky",   50,  offsetof(struct ctdb_tunable, hopcount_make_sticky) },
        { "StickyDuration",      600,  offsetof(struct ctdb_tunable, sticky_duration) },
        { "StickyPindown",       200,  offsetof(struct ctdb_tunable, sticky_pindown) },