mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
fix: lastRequestTime was not updated
fix: COORDINATOR_REGISTER_INTERVAL was not set fixed review comments
This commit is contained in:
parent
be5d144b8b
commit
ee92f0574f
@ -145,7 +145,7 @@ struct ItemWithExamples {
|
||||
int count;
|
||||
std::vector<std::pair<NetworkAddress,Key>> examples;
|
||||
|
||||
ItemWithExamples() : count(0) {}
|
||||
ItemWithExamples() : item{}, count(0) {}
|
||||
ItemWithExamples(T const& item, int count, std::vector<std::pair<NetworkAddress,Key>> const& examples) : item(item), count(count), examples(examples) {}
|
||||
|
||||
template <class Ar>
|
||||
|
@ -153,13 +153,13 @@ struct OpenDatabaseCoordRequest {
|
||||
Standalone<VectorRef<StringRef>> issues;
|
||||
Standalone<VectorRef<ClientVersionRef>> supportedVersions;
|
||||
UID knownClientInfoID;
|
||||
Key key;
|
||||
Key clusterKey;
|
||||
vector<NetworkAddress> coordinators;
|
||||
ReplyPromise< struct ClientDBInfo > reply;
|
||||
|
||||
template <class Ar>
|
||||
void serialize(Ar& ar) {
|
||||
serializer(ar, issues, supportedVersions, traceLogGroup, knownClientInfoID, key, coordinators, reply);
|
||||
serializer(ar, issues, supportedVersions, traceLogGroup, knownClientInfoID, clusterKey, coordinators, reply);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -385,7 +385,7 @@ ACTOR Future<Void> monitorNominee( Key key, ClientLeaderRegInterface coord, Asyn
|
||||
state Optional<LeaderInfo> li = wait( retryBrokenPromise( coord.getLeader, GetLeaderRequest( key, info->present() ? info->get().changeID : UID() ), TaskPriority::CoordinationReply ) );
|
||||
wait( Future<Void>(Void()) ); // Make sure we weren't cancelled
|
||||
|
||||
TraceEvent("GetLeaderReply").detail("Coordinator", coord.getLeader.getEndpoint().getPrimaryAddress()).detail("Nominee", li.present() ? li.get().changeID : UID()).detail("Key", key.printable());
|
||||
TraceEvent("GetLeaderReply").suppressFor(1.0).detail("Coordinator", coord.getLeader.getEndpoint().getPrimaryAddress()).detail("Nominee", li.present() ? li.get().changeID : UID()).detail("ClusterKey", key.printable());
|
||||
|
||||
if (li != *info) {
|
||||
*info = li;
|
||||
@ -542,6 +542,7 @@ OpenDatabaseRequest ClientData::getRequest() {
|
||||
std::map<ClientVersionRef, ClientStatusStats> versionMap;
|
||||
std::map<StringRef, ClientStatusStats> maxProtocolMap;
|
||||
|
||||
//SOMEDAY: add a yield in this loop
|
||||
for(auto& ci : clientStatusInfoMap) {
|
||||
for(auto& it : ci.second.issues) {
|
||||
auto& entry = issueMap[it];
|
||||
@ -593,6 +594,7 @@ ACTOR Future<Void> getClientInfoFromLeader( Reference<AsyncVar<Optional<ClusterC
|
||||
|
||||
loop {
|
||||
if(now() - lastRequestTime > CLIENT_KNOBS->MAX_CLIENT_STATUS_AGE) {
|
||||
lastRequestTime = now();
|
||||
req = clientData->getRequest();
|
||||
} else {
|
||||
resetReply(req);
|
||||
@ -669,7 +671,7 @@ ACTOR Future<MonitorLeaderInfo> monitorProxiesOneGeneration( Reference<ClusterCo
|
||||
loop {
|
||||
state ClientLeaderRegInterface clientLeaderServer( addrs[idx] );
|
||||
state OpenDatabaseCoordRequest req;
|
||||
req.key = cs.clusterKey();
|
||||
req.clusterKey = cs.clusterKey();
|
||||
req.coordinators = cs.coordinators();
|
||||
req.knownClientInfoID = clientInfo->get().id;
|
||||
req.supportedVersions = supportedVersions;
|
||||
|
@ -221,7 +221,7 @@ ACTOR Future<Void> openDatabase(ClientData* db, int* clientCount, Reference<Asyn
|
||||
while (db->clientInfo->get().id == req.knownClientInfoID && !db->clientInfo->get().forward.present()) {
|
||||
choose {
|
||||
when (wait( db->clientInfo->onChange() )) {}
|
||||
when (wait( delayJittered( 300 ) )) { break; } // The client might be long gone!
|
||||
when (wait( delayJittered( SERVER_KNOBS->CLIENT_REGISTER_INTERVAL ) )) { break; } // The client might be long gone!
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ ACTOR Future<Void> leaderRegister(LeaderElectionRegInterface interf, Key key) {
|
||||
loop choose {
|
||||
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
||||
if(!leaderMon.isValid()) {
|
||||
leaderMon = monitorLeaderForProxies(req.key, req.coordinators, &clientData);
|
||||
leaderMon = monitorLeaderForProxies(req.clusterKey, req.coordinators, &clientData);
|
||||
}
|
||||
actors.add(openDatabase(&clientData, &clientCount, hasConnectedClients, req));
|
||||
}
|
||||
@ -472,13 +472,14 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
|
||||
|
||||
loop choose {
|
||||
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
||||
Optional<LeaderInfo> forward = regs.getForward(req.key);
|
||||
Optional<LeaderInfo> forward = regs.getForward(req.clusterKey);
|
||||
if( forward.present() ) {
|
||||
ClientDBInfo info;
|
||||
info.id = deterministicRandom()->randomUniqueID();
|
||||
info.forward = forward.get().serializedInfo;
|
||||
req.reply.send( info );
|
||||
} else {
|
||||
regs.getInterface(req.key, id).openDatabase.send( req );
|
||||
regs.getInterface(req.clusterKey, id).openDatabase.send( req );
|
||||
}
|
||||
}
|
||||
when ( GetLeaderRequest req = waitNext( interf.getLeader.getFuture() ) ) {
|
||||
|
@ -332,6 +332,8 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
|
||||
init( RATEKEEPER_FAILURE_TIME, 1.0 );
|
||||
init( REPLACE_INTERFACE_DELAY, 60.0 );
|
||||
init( REPLACE_INTERFACE_CHECK_DELAY, 5.0 );
|
||||
init( COORDINATOR_REGISTER_INTERVAL, 30.0 );
|
||||
init( CLIENT_REGISTER_INTERVAL, 300.0 );
|
||||
|
||||
init( INCOMPATIBLE_PEERS_LOGGING_INTERVAL, 600 ); if( randomize && BUGGIFY ) INCOMPATIBLE_PEERS_LOGGING_INTERVAL = 60.0;
|
||||
init( EXPECTED_MASTER_FITNESS, ProcessClass::UnsetFit );
|
||||
|
@ -275,6 +275,7 @@ public:
|
||||
double REPLACE_INTERFACE_DELAY;
|
||||
double REPLACE_INTERFACE_CHECK_DELAY;
|
||||
double COORDINATOR_REGISTER_INTERVAL;
|
||||
double CLIENT_REGISTER_INTERVAL;
|
||||
|
||||
// Knobs used to select the best policy (via monte carlo)
|
||||
int POLICY_RATING_TESTS; // number of tests per policy (in order to compare)
|
||||
|
@ -932,9 +932,9 @@ static JsonBuilderObject clientStatusFetcher(std::map<NetworkAddress, std::pair<
|
||||
cli["log_group"] = client.second.toString();
|
||||
clients.push_back(cli);
|
||||
}
|
||||
maxSupportedProtocol.erase(cv.first.protocolVersion);
|
||||
ver["max_protocol_count"] = iter->second.count;
|
||||
ver["max_protocol_clients"] = maxClients;
|
||||
maxSupportedProtocol.erase(cv.first.protocolVersion);
|
||||
}
|
||||
|
||||
ver["connected_clients"] = clients;
|
||||
@ -1883,6 +1883,7 @@ static JsonBuilderArray getClientIssuesAsMessages( std::map<NetworkAddress, std:
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: add the log_group in addition to the network address
|
||||
for (auto i : deduplicatedIssues) {
|
||||
JsonBuilderObject message = JsonString::makeMessage(i.first.c_str(), getIssueDescription(i.first).c_str());
|
||||
JsonBuilderArray addresses;
|
||||
|
Loading…
x
Reference in New Issue
Block a user