mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
Merge pull request #5314 from halfprice/zhewu/optional-tlog-interface
Account for the case where TLogInterface may not present in ServerDbInfo in worker health monitor
This commit is contained in:
commit
d9b5a7c38d
@ -632,6 +632,10 @@ bool addressInDbAndPrimaryDc(const NetworkAddress& address, Reference<AsyncVar<S
|
||||
|
||||
for (const auto& logSet : dbi.logSystemConfig.tLogs) {
|
||||
for (const auto& tlog : logSet.tLogs) {
|
||||
if (!tlog.present()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!localityIsInPrimaryDc(tlog.interf().filteredLocality)) {
|
||||
continue;
|
||||
}
|
||||
@ -664,13 +668,17 @@ TEST_CASE("/fdbserver/worker/addressInDbAndPrimaryDc") {
|
||||
testDbInfo.master.changeCoordinators =
|
||||
RequestStream<struct ChangeCoordinatorsRequest>(Endpoint({ testAddress }, UID(1, 2)));
|
||||
|
||||
// First, create a remote TLog. Although the remote TLog also uses the local address, it shouldn't be considered as
|
||||
// First, create an empty TLogInterface, and check that it shouldn't be considered as in primary DC.
|
||||
testDbInfo.logSystemConfig.tLogs.push_back(TLogSet());
|
||||
testDbInfo.logSystemConfig.tLogs.back().tLogs.push_back(OptionalInterface<TLogInterface>());
|
||||
ASSERT(!addressInDbAndPrimaryDc(g_network->getLocalAddress(), makeReference<AsyncVar<ServerDBInfo>>(testDbInfo)));
|
||||
|
||||
// Create a remote TLog. Although the remote TLog also uses the local address, it shouldn't be considered as
|
||||
// in primary DC given the remote locality.
|
||||
LocalityData fakeRemote;
|
||||
fakeRemote.set(LiteralStringRef("dcid"), StringRef(std::to_string(2)));
|
||||
TLogInterface remoteTlog(fakeRemote);
|
||||
remoteTlog.initEndpoints();
|
||||
testDbInfo.logSystemConfig.tLogs.push_back(TLogSet());
|
||||
testDbInfo.logSystemConfig.tLogs.back().tLogs.push_back(OptionalInterface(remoteTlog));
|
||||
ASSERT(!addressInDbAndPrimaryDc(g_network->getLocalAddress(), makeReference<AsyncVar<ServerDBInfo>>(testDbInfo)));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user