mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 10:22:20 +08:00
Address review comments, improve performance
This commit is contained in:
parent
49968b8200
commit
ceeade7334
@ -8,6 +8,7 @@ Release Notes
|
||||
=====
|
||||
|
||||
* Fix an issue where ``fdbcli --exec 'exclude no_wait ...'`` would incorrectly report that processes can safely be removed from the cluster. `(PR #3566) <https://github.com/apple/foundationdb/pull/3566>`_
|
||||
* When a configuration key is changed, it will always be included in ``status json`` output, even the value is reverted back to the default value. `(PR #3610) <https://github.com/apple/foundationdb/pull/3610>`_
|
||||
|
||||
6.3.4
|
||||
=====
|
||||
|
@ -562,25 +562,21 @@ void DatabaseConfiguration::fromKeyValues(Standalone<VectorRef<KeyValueRef>> raw
|
||||
setDefaultReplicationPolicy();
|
||||
}
|
||||
|
||||
bool DatabaseConfiguration::isOverridden(const std::string& key) const {
|
||||
bool DatabaseConfiguration::isOverridden(std::string key) const {
|
||||
key = configKeysPrefix.toString() + key;
|
||||
|
||||
if (mutableConfiguration.present() && mutableConfiguration.get().find(key) != mutableConfiguration.get().end()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const int keyLen = key.size();
|
||||
for (auto iter = rawConfiguration.begin(); iter != rawConfiguration.end(); ++iter) {
|
||||
auto confKey = iter->key.removePrefix(configKeysPrefix).toString();
|
||||
if (key == confKey) {
|
||||
const auto& rawConfKey = iter->key;
|
||||
if (keyLen == rawConfKey.size() &&
|
||||
strncmp(key.c_str(), reinterpret_cast<const char*>(rawConfKey.begin()), keyLen) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mutableConfiguration.present()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto iter = mutableConfiguration.get().begin(); iter != mutableConfiguration.get().end(); ++iter) {
|
||||
UNSTOPPABLE_ASSERT(iter->first.size() >= configKeysPrefix.size() &&
|
||||
iter->first.substr(0, configKeysPrefix.size()) == configKeysPrefix.toString());
|
||||
auto confKey = iter->first.substr(configKeysPrefix.size());
|
||||
if (key == confKey) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -231,7 +231,8 @@ private:
|
||||
void resetInternal();
|
||||
void setDefaultReplicationPolicy();
|
||||
|
||||
bool isOverridden(const std::string& key) const;
|
||||
/// Check if the key is overridden by either mutableConfiguration or rawConfiguration
|
||||
bool isOverridden(std::string key) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user