-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fdbserver] Gray failure and simulator improvements related to remote processes #11717
Open
spraza
wants to merge
9
commits into
apple:main
Choose a base branch
from
spraza:gray-failure-features-PR
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c94d0dd
[fdbserver][simulator] Add remoteDesiredTLogCount option
spraza ca0ed97
[fdbserver][simulator] Allow explicitly specifying number of stateles…
spraza c83b990
[fdbserver][gray_failure] RemoteTLog lagging SS simulation test
spraza 5fbc74b
[fdbserver][gray_failure] Consider remote processes + CC inter/intra …
spraza 5d45988
[fdbserver][cc] Make processInSameDC O(1)
spraza 8a0469e
self review
spraza 3f6dd3d
fixup! self review
spraza cefc144
fixup! self review
spraza 40b0433
fixup! self review
spraza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
#include "fdbclient/DatabaseContext.h" | ||
#include "fdbrpc/FailureMonitor.h" | ||
#include "fdbclient/EncryptKeyProxyInterface.h" | ||
#include "fdbrpc/Locality.h" | ||
#include "fdbserver/BlobGranuleServerCommon.actor.h" | ||
#include "fdbserver/BlobMigratorInterface.h" | ||
#include "fdbserver/Knobs.h" | ||
|
@@ -94,12 +95,19 @@ ACTOR Future<Optional<Value>> getPreviousCoordinators(ClusterControllerData* sel | |
} | ||
} | ||
|
||
bool ClusterControllerData::processesInSameDC(const NetworkAddress& addr1, const NetworkAddress& addr2) const { | ||
return this->addr_locality.contains(addr1) && this->addr_locality.contains(addr2) && | ||
this->addr_locality.at(addr1).dcId().present() && this->addr_locality.at(addr2).dcId().present() && | ||
this->addr_locality.at(addr1).dcId().get() == this->addr_locality.at(addr2).dcId().get(); | ||
} | ||
|
||
bool ClusterControllerData::transactionSystemContainsDegradedServers() { | ||
const ServerDBInfo& dbi = db.serverInfo->get(); | ||
const Reference<ClusterRecoveryData> recoveryData = db.recoveryData; | ||
auto transactionWorkerInList = [&dbi, &recoveryData](const std::unordered_set<NetworkAddress>& serverList, | ||
bool skipSatellite, | ||
bool skipRemote) -> bool { | ||
bool skipRemoteTLog, | ||
bool skipRemoteLogRouter) -> bool { | ||
for (const auto& server : serverList) { | ||
if (dbi.master.addresses().contains(server)) { | ||
return true; | ||
|
@@ -115,15 +123,19 @@ bool ClusterControllerData::transactionSystemContainsDegradedServers() { | |
continue; | ||
} | ||
|
||
if (skipRemote && !logSet.isLocal) { | ||
continue; | ||
} | ||
|
||
if (!logSet.isLocal) { | ||
// Only check log routers in the remote region. | ||
for (const auto& logRouter : logSet.logRouters) { | ||
if (logRouter.present() && logRouter.interf().addresses().contains(server)) { | ||
return true; | ||
if (!skipRemoteTLog) { | ||
for (const auto& tlog : logSet.tLogs) { | ||
if (tlog.present() && tlog.interf().addresses().contains(server)) { | ||
return true; | ||
} | ||
} | ||
} | ||
if (!skipRemoteLogRouter) { | ||
for (const auto& logRouter : logSet.logRouters) { | ||
if (logRouter.present() && logRouter.interf().addresses().contains(server)) { | ||
return true; | ||
} | ||
} | ||
} | ||
} else { | ||
|
@@ -176,13 +188,23 @@ bool ClusterControllerData::transactionSystemContainsDegradedServers() { | |
return false; | ||
}; | ||
|
||
// Check if transaction system contains degraded/disconnected servers. For satellite and remote regions, we only | ||
// Check if transaction system contains degraded/disconnected servers. For satellite, we only | ||
// check for disconnection since the latency between prmary and satellite is across WAN and may not be very | ||
// stable. | ||
return transactionWorkerInList(degradationInfo.degradedServers, /*skipSatellite=*/true, /*skipRemote=*/true) || | ||
// TODO: Consider adding satellite latency degradation check and rely on | ||
// SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY for accurate health signal | ||
return transactionWorkerInList(degradationInfo.degradedServers, | ||
/*skipSatellite=*/true, | ||
/*skipRemoteTLog=*/ | ||
!(SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY && | ||
SERVER_KNOBS->CC_ENABLE_REMOTE_TLOG_DEGRADATION_MONITORING), | ||
/*skipRemoteLogRouter*/ | ||
!(SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY && | ||
SERVER_KNOBS->CC_ENABLE_REMOTE_LOG_ROUTER_DEGRADATION_MONITORING)) || | ||
transactionWorkerInList(degradationInfo.disconnectedServers, | ||
/*skipSatellite=*/false, | ||
/*skipRemote=*/!SERVER_KNOBS->CC_ENABLE_REMOTE_LOG_ROUTER_MONITORING); | ||
/*skipRemoteTLog=*/!SERVER_KNOBS->CC_ENABLE_REMOTE_TLOG_DISCONNECT_MONITORING, | ||
/*skipRemoteLogRouter*/ !SERVER_KNOBS->CC_ENABLE_REMOTE_LOG_ROUTER_MONITORING); | ||
} | ||
|
||
bool ClusterControllerData::remoteTransactionSystemContainsDegradedServers() { | ||
|
@@ -914,6 +936,14 @@ ACTOR Future<Void> workerAvailabilityWatch(WorkerInterface worker, | |
.detail("Address", worker.address()); | ||
cluster->removedDBInfoEndpoints.insert(worker.updateServerDBInfo.getEndpoint()); | ||
cluster->id_worker.erase(worker.locality.processId()); | ||
// Currently, only CC_ONLY_CONSIDER_INTRA_DC_LATENCY feature relies on addr_locality mapping. In the | ||
// future, if needed, we can populate the mapping unconditionally. | ||
if (SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY) { | ||
cluster->addr_locality.erase(worker.address()); | ||
if (worker.secondaryAddress().present()) { | ||
cluster->addr_locality.erase(worker.secondaryAddress().get()); | ||
} | ||
} | ||
cluster->updateWorkerList.set(worker.locality.processId(), Optional<ProcessData>()); | ||
return Void(); | ||
} | ||
|
@@ -1275,6 +1305,23 @@ ACTOR Future<Void> registerWorker(RegisterWorkerRequest req, | |
req.degraded, | ||
req.recoveredDiskFiles, | ||
req.issues); | ||
// Currently, only CC_ONLY_CONSIDER_INTRA_DC_LATENCY feature relies on addr_locality mapping. In the future, if | ||
// needed, we can populate the mapping unconditionally. | ||
if (SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY) { | ||
const bool addrDcChanged = self->addr_locality.contains(w.address()) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separately, understand why we can not relax this condition. |
||
self->addr_locality[w.address()].dcId() != w.locality.dcId(); | ||
if (addrDcChanged) { | ||
TraceEvent(SevWarn, "AddrDcChanged") | ||
.detail("Addr", w.address()) | ||
.detail("ExistingLocality", self->addr_locality[w.address()].toString()) | ||
.detail("NewLocality", w.locality.toString()); | ||
} | ||
ASSERT_WE_THINK(!addrDcChanged); | ||
self->addr_locality[w.address()] = w.locality; | ||
if (w.secondaryAddress().present()) { | ||
self->addr_locality[w.secondaryAddress().get()] = w.locality; | ||
} | ||
} | ||
if (!self->masterProcessId.present() && | ||
w.locality.processId() == self->db.serverInfo->get().master.locality.processId()) { | ||
self->masterProcessId = w.locality.processId(); | ||
|
@@ -3363,6 +3410,15 @@ ACTOR Future<Void> clusterController(Reference<IClusterConnectionRecord> connRec | |
|
||
namespace { | ||
|
||
void addProcessesToSameDC(ClusterControllerData& self, const std::vector<NetworkAddress>&& processes) { | ||
LocalityData locality; | ||
locality.set(LocalityData::keyDcId, Standalone<StringRef>(std::string{ "1" })); | ||
for (const auto& process : processes) { | ||
const bool added = self.addr_locality.insert({ process, locality }).second; | ||
ASSERT(added); | ||
} | ||
} | ||
|
||
// Tests `ClusterControllerData::updateWorkerHealth()` can update `ClusterControllerData::workerHealth` | ||
// based on `UpdateWorkerHealth` request correctly. | ||
TEST_CASE("/fdbserver/clustercontroller/updateWorkerHealth") { | ||
|
@@ -3536,6 +3592,10 @@ TEST_CASE("/fdbserver/clustercontroller/getDegradationInfo") { | |
NetworkAddress badPeer3(IPAddress(0x04040404), 1); | ||
NetworkAddress badPeer4(IPAddress(0x05050505), 1); | ||
|
||
if (SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY) { | ||
addProcessesToSameDC(data, { worker, badPeer1, badPeer2, badPeer3, badPeer4 }); | ||
} | ||
|
||
// Test that a reported degraded link should stay for sometime before being considered as a degraded | ||
// link by cluster controller. | ||
{ | ||
|
@@ -3797,22 +3857,32 @@ TEST_CASE("/fdbserver/clustercontroller/shouldTriggerRecoveryDueToDegradedServer | |
data.degradationInfo.disconnectedServers.clear(); | ||
|
||
// No recovery when remote tlog is degraded. | ||
data.degradationInfo.degradedServers.insert(remoteTlog); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.degradedServers.clear(); | ||
data.degradationInfo.disconnectedServers.insert(remoteTlog); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.disconnectedServers.clear(); | ||
if (!(SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY && | ||
SERVER_KNOBS->CC_ENABLE_REMOTE_TLOG_DEGRADATION_MONITORING)) { | ||
data.degradationInfo.degradedServers.insert(remoteTlog); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.degradedServers.clear(); | ||
} | ||
if (!SERVER_KNOBS->CC_ENABLE_REMOTE_TLOG_DISCONNECT_MONITORING) { | ||
data.degradationInfo.disconnectedServers.insert(remoteTlog); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.disconnectedServers.clear(); | ||
} | ||
|
||
// No recovery when remote log router is degraded. | ||
data.degradationInfo.degradedServers.insert(logRouter); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.degradedServers.clear(); | ||
if (!(SERVER_KNOBS->CC_ONLY_CONSIDER_INTRA_DC_LATENCY && | ||
SERVER_KNOBS->CC_ENABLE_REMOTE_LOG_ROUTER_DEGRADATION_MONITORING)) { | ||
data.degradationInfo.degradedServers.insert(logRouter); | ||
ASSERT(!data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.degradedServers.clear(); | ||
} | ||
|
||
// Trigger recovery when remote log router is disconnected. | ||
data.degradationInfo.disconnectedServers.insert(logRouter); | ||
ASSERT(data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.disconnectedServers.clear(); | ||
if (SERVER_KNOBS->CC_ENABLE_REMOTE_LOG_ROUTER_MONITORING) { | ||
data.degradationInfo.disconnectedServers.insert(logRouter); | ||
ASSERT(data.shouldTriggerRecoveryDueToDegradedServers()); | ||
data.degradationInfo.disconnectedServers.clear(); | ||
} | ||
|
||
// No recovery when backup worker is degraded. | ||
data.degradationInfo.degradedServers.insert(backup); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for not saying DISCONNECT in the name is to keep backwards compatibility with the previous knob.