From 03478561b93fcccb1a6e528201946a234825fbf7 Mon Sep 17 00:00:00 2001 From: "A.J. Beamon" Date: Mon, 28 Aug 2017 17:16:46 -0700 Subject: [PATCH] fix: Set lock aware at the transaction level for latency probe to avoid having to fill the shard cache every time. --- fdbserver/Status.actor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fdbserver/Status.actor.cpp b/fdbserver/Status.actor.cpp index 4345f5ec77..f3a11cfd1a 100644 --- a/fdbserver/Status.actor.cpp +++ b/fdbserver/Status.actor.cpp @@ -947,6 +947,7 @@ ACTOR static Future doGrvProbe(Transaction *tr, OptionalsetOption(FDBTransactionOptions::LOCK_AWARE); if(priority.present()) { tr->setOption(priority.get()); } @@ -969,6 +970,7 @@ ACTOR static Future doReadProbe(Future grvProbe, Transaction *tr state double start = timer_monotonic(); loop { + tr->setOption(FDBTransactionOptions::LOCK_AWARE); try { Optional > _ = wait(tr->get(LiteralStringRef("\xff/StatusJsonTestKey62793"))); return timer_monotonic() - start; @@ -993,6 +995,7 @@ ACTOR static Future doCommitProbe(Future grvProbe, Transaction * loop { try { + tr->setOption(FDBTransactionOptions::LOCK_AWARE); tr->setOption(FDBTransactionOptions::PRIORITY_SYSTEM_IMMEDIATE); tr->makeSelfConflicting(); Void _ = wait(tr->commit()); @@ -1022,9 +1025,7 @@ ACTOR static Future doProbe(Future probe, int timeoutSeconds, cons return Void(); } -ACTOR static Future latencyProbeFetcher(Reference> db, StatusArray *messages, std::set *incomplete_reasons) { - Database cx = openDBOnServer(db, TaskDefaultEndpoint, true, true); // Open a new database connection that is lock-aware - +ACTOR static Future latencyProbeFetcher(Database cx, StatusArray *messages, std::set *incomplete_reasons) { state Transaction trImmediate(cx); state Transaction trDefault(cx); state Transaction trBatch(cx); @@ -1777,9 +1778,7 @@ ACTOR Future clusterGetStatus( if (configuration.present()){ // Do the latency probe by itself to avoid interference from other status activities - state Future latencyProbe = latencyProbeFetcher(db, &messages, &status_incomplete_reasons); - - StatusObject latencyProbeResults = wait(latencyProbe); + StatusObject latencyProbeResults = wait(latencyProbeFetcher(cx, &messages, &status_incomplete_reasons)); statusObj["database_available"] = latencyProbeResults.count("immediate_priority_transaction_start_seconds") && latencyProbeResults.count("read_seconds") && latencyProbeResults.count("commit_seconds"); if (!latencyProbeResults.empty()) {