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;
|
int count;
|
||||||
std::vector<std::pair<NetworkAddress,Key>> examples;
|
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) {}
|
ItemWithExamples(T const& item, int count, std::vector<std::pair<NetworkAddress,Key>> const& examples) : item(item), count(count), examples(examples) {}
|
||||||
|
|
||||||
template <class Ar>
|
template <class Ar>
|
||||||
|
@ -153,13 +153,13 @@ struct OpenDatabaseCoordRequest {
|
|||||||
Standalone<VectorRef<StringRef>> issues;
|
Standalone<VectorRef<StringRef>> issues;
|
||||||
Standalone<VectorRef<ClientVersionRef>> supportedVersions;
|
Standalone<VectorRef<ClientVersionRef>> supportedVersions;
|
||||||
UID knownClientInfoID;
|
UID knownClientInfoID;
|
||||||
Key key;
|
Key clusterKey;
|
||||||
vector<NetworkAddress> coordinators;
|
vector<NetworkAddress> coordinators;
|
||||||
ReplyPromise< struct ClientDBInfo > reply;
|
ReplyPromise< struct ClientDBInfo > reply;
|
||||||
|
|
||||||
template <class Ar>
|
template <class Ar>
|
||||||
void serialize(Ar& 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 ) );
|
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
|
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) {
|
if (li != *info) {
|
||||||
*info = li;
|
*info = li;
|
||||||
@ -542,6 +542,7 @@ OpenDatabaseRequest ClientData::getRequest() {
|
|||||||
std::map<ClientVersionRef, ClientStatusStats> versionMap;
|
std::map<ClientVersionRef, ClientStatusStats> versionMap;
|
||||||
std::map<StringRef, ClientStatusStats> maxProtocolMap;
|
std::map<StringRef, ClientStatusStats> maxProtocolMap;
|
||||||
|
|
||||||
|
//SOMEDAY: add a yield in this loop
|
||||||
for(auto& ci : clientStatusInfoMap) {
|
for(auto& ci : clientStatusInfoMap) {
|
||||||
for(auto& it : ci.second.issues) {
|
for(auto& it : ci.second.issues) {
|
||||||
auto& entry = issueMap[it];
|
auto& entry = issueMap[it];
|
||||||
@ -593,6 +594,7 @@ ACTOR Future<Void> getClientInfoFromLeader( Reference<AsyncVar<Optional<ClusterC
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
if(now() - lastRequestTime > CLIENT_KNOBS->MAX_CLIENT_STATUS_AGE) {
|
if(now() - lastRequestTime > CLIENT_KNOBS->MAX_CLIENT_STATUS_AGE) {
|
||||||
|
lastRequestTime = now();
|
||||||
req = clientData->getRequest();
|
req = clientData->getRequest();
|
||||||
} else {
|
} else {
|
||||||
resetReply(req);
|
resetReply(req);
|
||||||
@ -669,7 +671,7 @@ ACTOR Future<MonitorLeaderInfo> monitorProxiesOneGeneration( Reference<ClusterCo
|
|||||||
loop {
|
loop {
|
||||||
state ClientLeaderRegInterface clientLeaderServer( addrs[idx] );
|
state ClientLeaderRegInterface clientLeaderServer( addrs[idx] );
|
||||||
state OpenDatabaseCoordRequest req;
|
state OpenDatabaseCoordRequest req;
|
||||||
req.key = cs.clusterKey();
|
req.clusterKey = cs.clusterKey();
|
||||||
req.coordinators = cs.coordinators();
|
req.coordinators = cs.coordinators();
|
||||||
req.knownClientInfoID = clientInfo->get().id;
|
req.knownClientInfoID = clientInfo->get().id;
|
||||||
req.supportedVersions = supportedVersions;
|
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()) {
|
while (db->clientInfo->get().id == req.knownClientInfoID && !db->clientInfo->get().forward.present()) {
|
||||||
choose {
|
choose {
|
||||||
when (wait( db->clientInfo->onChange() )) {}
|
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 {
|
loop choose {
|
||||||
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
||||||
if(!leaderMon.isValid()) {
|
if(!leaderMon.isValid()) {
|
||||||
leaderMon = monitorLeaderForProxies(req.key, req.coordinators, &clientData);
|
leaderMon = monitorLeaderForProxies(req.clusterKey, req.coordinators, &clientData);
|
||||||
}
|
}
|
||||||
actors.add(openDatabase(&clientData, &clientCount, hasConnectedClients, req));
|
actors.add(openDatabase(&clientData, &clientCount, hasConnectedClients, req));
|
||||||
}
|
}
|
||||||
@ -472,13 +472,14 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
|
|||||||
|
|
||||||
loop choose {
|
loop choose {
|
||||||
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
when ( OpenDatabaseCoordRequest req = waitNext( interf.openDatabase.getFuture() ) ) {
|
||||||
Optional<LeaderInfo> forward = regs.getForward(req.key);
|
Optional<LeaderInfo> forward = regs.getForward(req.clusterKey);
|
||||||
if( forward.present() ) {
|
if( forward.present() ) {
|
||||||
ClientDBInfo info;
|
ClientDBInfo info;
|
||||||
|
info.id = deterministicRandom()->randomUniqueID();
|
||||||
info.forward = forward.get().serializedInfo;
|
info.forward = forward.get().serializedInfo;
|
||||||
req.reply.send( info );
|
req.reply.send( info );
|
||||||
} else {
|
} else {
|
||||||
regs.getInterface(req.key, id).openDatabase.send( req );
|
regs.getInterface(req.clusterKey, id).openDatabase.send( req );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when ( GetLeaderRequest req = waitNext( interf.getLeader.getFuture() ) ) {
|
when ( GetLeaderRequest req = waitNext( interf.getLeader.getFuture() ) ) {
|
||||||
|
@ -332,6 +332,8 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
|
|||||||
init( RATEKEEPER_FAILURE_TIME, 1.0 );
|
init( RATEKEEPER_FAILURE_TIME, 1.0 );
|
||||||
init( REPLACE_INTERFACE_DELAY, 60.0 );
|
init( REPLACE_INTERFACE_DELAY, 60.0 );
|
||||||
init( REPLACE_INTERFACE_CHECK_DELAY, 5.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( INCOMPATIBLE_PEERS_LOGGING_INTERVAL, 600 ); if( randomize && BUGGIFY ) INCOMPATIBLE_PEERS_LOGGING_INTERVAL = 60.0;
|
||||||
init( EXPECTED_MASTER_FITNESS, ProcessClass::UnsetFit );
|
init( EXPECTED_MASTER_FITNESS, ProcessClass::UnsetFit );
|
||||||
|
@ -275,6 +275,7 @@ public:
|
|||||||
double REPLACE_INTERFACE_DELAY;
|
double REPLACE_INTERFACE_DELAY;
|
||||||
double REPLACE_INTERFACE_CHECK_DELAY;
|
double REPLACE_INTERFACE_CHECK_DELAY;
|
||||||
double COORDINATOR_REGISTER_INTERVAL;
|
double COORDINATOR_REGISTER_INTERVAL;
|
||||||
|
double CLIENT_REGISTER_INTERVAL;
|
||||||
|
|
||||||
// Knobs used to select the best policy (via monte carlo)
|
// Knobs used to select the best policy (via monte carlo)
|
||||||
int POLICY_RATING_TESTS; // number of tests per policy (in order to compare)
|
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();
|
cli["log_group"] = client.second.toString();
|
||||||
clients.push_back(cli);
|
clients.push_back(cli);
|
||||||
}
|
}
|
||||||
maxSupportedProtocol.erase(cv.first.protocolVersion);
|
|
||||||
ver["max_protocol_count"] = iter->second.count;
|
ver["max_protocol_count"] = iter->second.count;
|
||||||
ver["max_protocol_clients"] = maxClients;
|
ver["max_protocol_clients"] = maxClients;
|
||||||
|
maxSupportedProtocol.erase(cv.first.protocolVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
ver["connected_clients"] = clients;
|
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) {
|
for (auto i : deduplicatedIssues) {
|
||||||
JsonBuilderObject message = JsonString::makeMessage(i.first.c_str(), getIssueDescription(i.first).c_str());
|
JsonBuilderObject message = JsonString::makeMessage(i.first.c_str(), getIssueDescription(i.first).c_str());
|
||||||
JsonBuilderArray addresses;
|
JsonBuilderArray addresses;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user