summaryrefslogtreecommitdiff
path: root/ctdb/server/ctdb_call.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-20 12:20:55 +1100
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2012-03-20 12:26:22 +1100
commite7e51ddb64cb362d3417eaae7c8d7fd5a5c4ea4d (patch)
treec65e45786149b97f06f152a286b613db7eb628da /ctdb/server/ctdb_call.c
parent6a493a0b08a8751ee9265047152851e00b9bf443 (diff)
downloadsamba-e7e51ddb64cb362d3417eaae7c8d7fd5a5c4ea4d.tar.gz
LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy until after default of 20 consecutive requests from the same node
This can improve performance slightly on certain workloads where smbds frequently read from the same record (This used to be ctdb commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504)
Diffstat (limited to 'ctdb/server/ctdb_call.c')
-rw-r--r--ctdb/server/ctdb_call.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c
index c015fbfff66..dabfe5468f8 100644
--- a/ctdb/server/ctdb_call.c
+++ b/ctdb/server/ctdb_call.c
@@ -338,7 +338,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_call_local(ctdb_db, state->call, &header, state, &data, true, ctdb->pnn);
ret = ctdb_ltdb_unlock(ctdb_db, state->call->key);
if (ret != 0) {
@@ -643,11 +643,15 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
CTDB_INCREMENT_DB_STAT(ctdb_db, hop_count_bucket[bucket]);
- /* 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 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)) ) {
if (ctdb_db->transaction_active) {
DEBUG(DEBUG_INFO, (__location__ " refusing migration"
" of key %s while transaction is active\n",
@@ -666,7 +670,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);
+ ret = ctdb_call_local(ctdb_db, call, &header, hdr, &data, true, c->hdr.srcnode);
if (ret != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_call_local failed\n"));
call->status = -1;
@@ -953,7 +957,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);
+ ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true, ctdb->pnn);
if (ret != 0) {
DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
}