fix: update the encoding of AddressExclusion in SystemData #963
This commit is contained in:
parent
592e224155
commit
41d18db7b9
|
@ -1068,8 +1068,19 @@ bool GetRangeLimits::hasSatisfiedMinRows() {
|
|||
|
||||
AddressExclusion AddressExclusion::parse( StringRef const& key ) {
|
||||
//Must not change: serialized to the database!
|
||||
auto parsedIp = IPAddress::parse(key.toString());
|
||||
if (parsedIp.present()) {
|
||||
return AddressExclusion(parsedIp.get());
|
||||
}
|
||||
|
||||
try {
|
||||
auto addr = NetworkAddress::parse(key.toString());
|
||||
if (addr.isTLS()) {
|
||||
TraceEvent(SevWarnAlways, "AddressExclusionParseError")
|
||||
.detail("String", printable(key))
|
||||
.detail("Description", "Address inclusion string should not include `:tls' suffix.");
|
||||
return AddressExclusion();
|
||||
}
|
||||
return AddressExclusion(addr.ip, addr.port);
|
||||
} catch (Error& e) {
|
||||
TraceEvent(SevWarnAlways, "AddressExclusionParseError").detail("String", printable(key));
|
||||
|
|
|
@ -374,11 +374,7 @@ const AddressExclusion decodeExcludedServersKey( KeyRef const& key ) {
|
|||
}
|
||||
std::string encodeExcludedServersKey( AddressExclusion const& addr ) {
|
||||
//FIXME: make sure what's persisted here is not affected by innocent changes elsewhere
|
||||
std::string as = format("%s", addr.ip.toString().c_str());
|
||||
//ASSERT( StringRef(as).endsWith(LiteralStringRef(":0")) == (addr.port == 0) );
|
||||
if (!addr.isWholeMachine())
|
||||
as += format(":%d", addr.port);
|
||||
return excludedServersPrefix.toString() + as;
|
||||
return excludedServersPrefix.toString() + addr.toString();
|
||||
}
|
||||
|
||||
const KeyRangeRef workerListKeys( LiteralStringRef("\xff/worker/"), LiteralStringRef("\xff/worker0") );
|
||||
|
|
Loading…
Reference in New Issue