Revert "Add back la-count based migration"
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 14 Mar 2012 23:15:56 +0000 (10:15 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 14 Mar 2012 23:15:56 +0000 (10:15 +1100)
This reverts commit 0c4ae347a20a780fe0326036de699e9f6cbb6d26.

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 7103ef6d94ce4ff4f98de31362d4d8976e47e882..5e0660457e48ac730e359496d30fa7608c863c2b 100644 (file)
@@ -72,7 +72,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, uint32_t caller)
+                   TDB_DATA *data)
 {
        struct ctdb_call_info *c;
        struct ctdb_registered_call *fn;
@@ -106,15 +106,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;
        }
 
@@ -369,7 +361,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, ctdb->pnn);
+       ret = ctdb_call_local(ctdb_db, state->call, header, state, data);
 
        return state;
 }
index b0ab3e6b758d6c96fec5b4e0b842121072845702..3ee7fe83143e406b220ae7374cbbbdab2ad9dfb9 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 0eb3b6e462c77f1fd19619e648c480c7fabc0d97..624aa7f95ac4528e4b9914cd625f32dc7c14b5f8 100644 (file)
@@ -123,7 +123,6 @@ struct ctdb_tunable {
        uint32_t lcp2_public_ip_assignment;
        uint32_t allow_client_db_attach;
        uint32_t fetch_lock_collapse;
-       uint32_t max_lacount;
 };
 
 /*
@@ -796,7 +795,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, uint32_t caller);
+                   TDB_DATA *data);
 
 #define ctdb_reqid_find(ctdb, reqid, type)     (type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)
 
index 90af21f574d09f20f9a6a1899311614765cc942a..c77893750ed055419a7b2a503221360707d54940 100644 (file)
@@ -482,8 +482,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 08710ebe62ef089b7ad785a0a1ae83f0980a5b88..622ef74f4377528ac75b27d03f383d3a2de65fa8 100644 (file)
@@ -339,7 +339,7 @@ static void ctdb_become_dmaster(struct ctdb_db_context *ctdb_db,
                return;
        }
 
-       ctdb_call_local(ctdb_db, state->call, &header, state, &data, ctdb->pnn);
+       ctdb_call_local(ctdb_db, state->call, &header, state, &data);
 
        ret = ctdb_ltdb_unlock(ctdb_db, state->call->key);
        if (ret != 0) {
@@ -532,15 +532,11 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
        CTDB_INCREMENT_STAT(ctdb, hop_count_bucket[bucket]);
 
 
-       /* 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",
@@ -559,7 +555,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
                }
        }
 
-       ctdb_call_local(ctdb_db, call, &header, hdr, &data, c->hdr.srcnode);
+       ctdb_call_local(ctdb_db, call, &header, hdr, &data);
 
        ret = ctdb_ltdb_unlock(ctdb_db, call->key);
        if (ret != 0) {
@@ -782,7 +778,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, ctdb->pnn);
+       ret = ctdb_call_local(ctdb_db, state->call, header, state, data);
 
        event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);
 
index dfdb0a0f14c72c23e598e71813f992b65e422c38..56eadc5e20ef8e60e071135675435d2c0ef620dc 100644 (file)
@@ -70,8 +70,7 @@ static const struct {
        { "StatHistoryInterval",  1,  offsetof(struct ctdb_tunable, stat_history_interval) },
        { "DeferredAttachTO",  120,  offsetof(struct ctdb_tunable, deferred_attach_timeout) },
        { "AllowClientDBAttach", 1, offsetof(struct ctdb_tunable, allow_client_db_attach) },
-       { "FetchLockCollapse", 1, offsetof(struct ctdb_tunable, fetch_lock_collapse) },
-       { "MaxLACount",           0,  offsetof(struct ctdb_tunable, max_lacount) },
+       { "FetchLockCollapse", 1, offsetof(struct ctdb_tunable, fetch_lock_collapse) }
 };
 
 /*