From 645dc5ead6832f869159f46f19e7a456f5c4ad10 Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Sun, 14 Jan 2018 12:50:52 -0800 Subject: [PATCH] warmRange needs to get a read version occasionally to prevent it from overwhelming the proxy quietDatabase waits for all data distribution to be completely finished so that databases are cached in a cleaner state --- fdbclient/NativeAPI.actor.cpp | 17 +++++++++++++++++ fdbserver/QuietDatabase.actor.cpp | 4 ++-- fdbserver/tester.actor.cpp | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index e4b272ab37..551fdcacf0 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -1082,13 +1082,30 @@ Future< vector< pair> > > getKeyRangeLocations( ACTOR Future warmRange_impl( Transaction *self, Database cx, KeyRange keys ) { state int totalRanges = 0; + state int totalRequests = 0; loop { vector>> locations = wait(getKeyRangeLocations_internal(cx, keys, CLIENT_KNOBS->WARM_RANGE_SHARD_LIMIT, false, self->info)); totalRanges += CLIENT_KNOBS->WARM_RANGE_SHARD_LIMIT; + totalRequests++; if(locations.size() == 0 || totalRanges >= cx->locationCacheSize || locations[locations.size()-1].first.end >= keys.end) break; keys = KeyRangeRef(locations[locations.size()-1].first.end, keys.end); + + if(totalRequests%20 == 0) { + //To avoid blocking the proxies from starting other transactions, occasionally get a read version. + state Transaction tr(cx); + loop { + try { + tr.setOption( FDBTransactionOptions::LOCK_AWARE ); + tr.setOption( FDBTransactionOptions::CAUSAL_READ_RISKY ); + Version _ = wait( tr.getReadVersion() ); + break; + } catch( Error &e ) { + Void _ = wait( tr.onError(e) ); + } + } + } } return Void(); diff --git a/fdbserver/QuietDatabase.actor.cpp b/fdbserver/QuietDatabase.actor.cpp index f844716133..7f1936d3be 100644 --- a/fdbserver/QuietDatabase.actor.cpp +++ b/fdbserver/QuietDatabase.actor.cpp @@ -292,7 +292,7 @@ ACTOR Future waitForQuietDatabase( Database cx, ReferenceisSimulated()) Void _ = wait(delay(5.0)); - //Require 2 consecutive successful quiet database checks spaced 1 second apart + //Require 3 consecutive successful quiet database checks spaced 2 second apart state int numSuccesses = 0; loop { @@ -322,7 +322,7 @@ ACTOR Future waitForQuietDatabase( Database cx, Reference runTests( Reference