re-added the connect lock in the fdbcli so that the timeout is not spent before a connection has been initiated (because of the handshake lock)
This commit is contained in:
parent
69b5a1fbe3
commit
08c318d28a
|
@ -2552,7 +2552,9 @@ Future<T> stopNetworkAfter( Future<T> what ) {
|
|||
}
|
||||
}
|
||||
|
||||
ACTOR Future<Void> addInterface( std::map<Key,std::pair<Value,ClientLeaderRegInterface>>* address_interface, KeyValue kv) {
|
||||
ACTOR Future<Void> addInterface( std::map<Key,std::pair<Value,ClientLeaderRegInterface>>* address_interface, Reference<FlowLock> connectLock, KeyValue kv) {
|
||||
wait(connectLock->take());
|
||||
state FlowLock::Releaser releaser(*connectLock);
|
||||
state ClientWorkerInterface workerInterf = BinaryReader::fromStringRef<ClientWorkerInterface>(kv.value, IncludeVersion());
|
||||
state ClientLeaderRegInterface leaderInterf(workerInterf.address());
|
||||
choose {
|
||||
|
@ -2566,7 +2568,7 @@ ACTOR Future<Void> addInterface( std::map<Key,std::pair<Value,ClientLeaderRegInt
|
|||
(*address_interface)[ip_port2] = std::make_pair(kv.value, leaderInterf);
|
||||
}
|
||||
}
|
||||
when( wait(delay(1.0)) ) {}
|
||||
when( wait(delay(CLIENT_KNOBS->CLI_CONNECT_TIMEOUT)) ) {}
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
@ -2974,9 +2976,10 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
getTransaction(db, tr, options, intrans);
|
||||
if (tokens.size() == 1) {
|
||||
Standalone<RangeResultRef> kvs = wait( makeInterruptable( tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces"), LiteralStringRef("\xff\xff\xff")), 1) ) );
|
||||
Reference<FlowLock> connectLock(new FlowLock(CLIENT_KNOBS->CLI_CONNECT_PARALLELISM));
|
||||
std::vector<Future<Void>> addInterfs;
|
||||
for( auto it : kvs ) {
|
||||
addInterfs.push_back(addInterface(&address_interface, it));
|
||||
addInterfs.push_back(addInterface(&address_interface, connectLock, it));
|
||||
}
|
||||
wait( waitForAll(addInterfs) );
|
||||
}
|
||||
|
@ -3287,9 +3290,10 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
getTransaction(db, tr, options, intrans);
|
||||
if (tokens.size() == 1) {
|
||||
Standalone<RangeResultRef> kvs = wait( makeInterruptable( tr->getRange(KeyRangeRef(LiteralStringRef("\xff\xff/worker_interfaces"), LiteralStringRef("\xff\xff\xff")), 1) ) );
|
||||
Reference<FlowLock> connectLock(new FlowLock(CLIENT_KNOBS->CLI_CONNECT_PARALLELISM));
|
||||
std::vector<Future<Void>> addInterfs;
|
||||
for( auto it : kvs ) {
|
||||
addInterfs.push_back(addInterface(&address_interface, it));
|
||||
addInterfs.push_back(addInterface(&address_interface, connectLock, it));
|
||||
}
|
||||
wait( waitForAll(addInterfs) );
|
||||
}
|
||||
|
|
|
@ -200,4 +200,8 @@ ClientKnobs::ClientKnobs(bool randomize) {
|
|||
|
||||
init( CONSISTENCY_CHECK_RATE_LIMIT_MAX, 50e6 ); // Limit in per sec
|
||||
init( CONSISTENCY_CHECK_ONE_ROUND_TARGET_COMPLETION_TIME, 7 * 24 * 60 * 60 ); // 7 days
|
||||
|
||||
//fdbcli
|
||||
init( CLI_CONNECT_PARALLELISM, 400 );
|
||||
init( CLI_CONNECT_TIMEOUT, 10.0 );
|
||||
}
|
||||
|
|
|
@ -190,6 +190,10 @@ public:
|
|||
|
||||
int CONSISTENCY_CHECK_RATE_LIMIT_MAX;
|
||||
int CONSISTENCY_CHECK_ONE_ROUND_TARGET_COMPLETION_TIME;
|
||||
|
||||
// fdbcli
|
||||
int CLI_CONNECT_PARALLELISM;
|
||||
double CLI_CONNECT_TIMEOUT;
|
||||
|
||||
ClientKnobs(bool randomize = false);
|
||||
};
|
||||
|
|
|
@ -66,8 +66,6 @@ using std::max;
|
|||
using std::min;
|
||||
using std::pair;
|
||||
|
||||
#define CERT_FILE_MAX_SIZE (5 * 1024 * 1024)
|
||||
|
||||
NetworkOptions networkOptions;
|
||||
TLSParams tlsParams;
|
||||
static Reference<TLSPolicy> tlsPolicy;
|
||||
|
|
|
@ -81,8 +81,6 @@
|
|||
#include "flow/SimpleOpt.h"
|
||||
#include "flow/actorcompiler.h" // This must be the last #include.
|
||||
|
||||
#define CERT_FILE_MAX_SIZE (5 * 1024 * 1024)
|
||||
|
||||
enum {
|
||||
OPT_CONNFILE, OPT_SEEDCONNFILE, OPT_SEEDCONNSTRING, OPT_ROLE, OPT_LISTEN, OPT_PUBLICADDR, OPT_DATAFOLDER, OPT_LOGFOLDER, OPT_PARENTPID, OPT_NEWCONSOLE,
|
||||
OPT_NOBOX, OPT_TESTFILE, OPT_RESTARTING, OPT_RESTORING, OPT_RANDOMSEED, OPT_KEY, OPT_MEMLIMIT, OPT_STORAGEMEMLIMIT, OPT_CACHEMEMLIMIT, OPT_MACHINEID,
|
||||
|
|
|
@ -115,6 +115,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
|
|||
init( SLOW_LOOP_CUTOFF, 15.0 / 1000.0 );
|
||||
init( SLOW_LOOP_SAMPLING_RATE, 0.1 );
|
||||
init( TSC_YIELD_TIME, 1000000 );
|
||||
init( CERT_FILE_MAX_SIZE, 5 * 1024 * 1024 );
|
||||
|
||||
//Network
|
||||
init( PACKET_LIMIT, 100LL<<20 );
|
||||
|
|
|
@ -136,6 +136,7 @@ public:
|
|||
double SLOW_LOOP_SAMPLING_RATE;
|
||||
int64_t TSC_YIELD_TIME;
|
||||
int64_t REACTOR_FLAGS;
|
||||
int CERT_FILE_MAX_SIZE;
|
||||
|
||||
//Network
|
||||
int64_t PACKET_LIMIT;
|
||||
|
|
|
@ -837,8 +837,6 @@ struct PromiseTask : public Task, public FastAllocated<PromiseTask> {
|
|||
};
|
||||
|
||||
// 5MB for loading files into memory
|
||||
// TODO: Move to a headerfile and delete all the copies of this.
|
||||
#define CERT_FILE_MAX_SIZE (5 * 1024 * 1024)
|
||||
|
||||
#ifndef TLS_DISABLED
|
||||
bool insecurely_always_accept(bool _1, boost::asio::ssl::verify_context& _2) {
|
||||
|
@ -884,7 +882,7 @@ Net2::Net2(bool useThreadPool, bool useMetrics, Reference<TLSPolicy> policy, con
|
|||
sslContext.use_certificate(boost::asio::buffer(tlsParams.tlsCertBytes.data(), tlsParams.tlsCertBytes.size()), boost::asio::ssl::context::pem);
|
||||
}
|
||||
if (tlsParams.tlsCAPath.size()) {
|
||||
std::string cert = readFileBytes(tlsParams.tlsCAPath, CERT_FILE_MAX_SIZE);
|
||||
std::string cert = readFileBytes(tlsParams.tlsCAPath, FLOW_KNOBS->CERT_FILE_MAX_SIZE);
|
||||
sslContext.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()));
|
||||
}
|
||||
if (tlsParams.tlsCABytes.size()) {
|
||||
|
|
Loading…
Reference in New Issue