Merge pull request #618 from ajbeamon/log-options
Log network, cluster, and database options when they are set.
This commit is contained in:
commit
d42f0e9c44
|
@ -47,6 +47,7 @@ private:
|
||||||
public:
|
public:
|
||||||
typename std::map<typename T::Option, FDBOptionInfo>::iterator begin() { return optionInfo.begin(); }
|
typename std::map<typename T::Option, FDBOptionInfo>::iterator begin() { return optionInfo.begin(); }
|
||||||
typename std::map<typename T::Option, FDBOptionInfo>::iterator end() { return optionInfo.end(); }
|
typename std::map<typename T::Option, FDBOptionInfo>::iterator end() { return optionInfo.end(); }
|
||||||
|
typename std::map<typename T::Option, FDBOptionInfo>::iterator find(const typename T::Option& key) { return optionInfo.find(key); }
|
||||||
|
|
||||||
FDBOptionInfo& operator[] (const typename T::Option& key) { return optionInfo[key]; }
|
FDBOptionInfo& operator[] (const typename T::Option& key) { return optionInfo[key]; }
|
||||||
|
|
||||||
|
|
|
@ -585,6 +585,16 @@ Reference<ITransaction> MultiVersionDatabase::createTransaction() {
|
||||||
void MultiVersionDatabase::setOption(FDBDatabaseOptions::Option option, Optional<StringRef> value) {
|
void MultiVersionDatabase::setOption(FDBDatabaseOptions::Option option, Optional<StringRef> value) {
|
||||||
MutexHolder holder(dbState->optionLock);
|
MutexHolder holder(dbState->optionLock);
|
||||||
|
|
||||||
|
|
||||||
|
auto itr = FDBDatabaseOptions::optionInfo.find(option);
|
||||||
|
if(itr != FDBDatabaseOptions::optionInfo.end()) {
|
||||||
|
TraceEvent("SetDatabaseOption").detail("Option", itr->second.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TraceEvent("UnknownDatabaseOption").detail("Option", option);
|
||||||
|
throw invalid_option();
|
||||||
|
}
|
||||||
|
|
||||||
if(dbState->db) {
|
if(dbState->db) {
|
||||||
dbState->db->setOption(option, value);
|
dbState->db->setOption(option, value);
|
||||||
}
|
}
|
||||||
|
@ -733,6 +743,15 @@ ThreadFuture<Reference<IDatabase>> MultiVersionCluster::createDatabase() {
|
||||||
void MultiVersionCluster::setOption(FDBClusterOptions::Option option, Optional<StringRef> value) {
|
void MultiVersionCluster::setOption(FDBClusterOptions::Option option, Optional<StringRef> value) {
|
||||||
MutexHolder holder(clusterState->optionLock);
|
MutexHolder holder(clusterState->optionLock);
|
||||||
|
|
||||||
|
auto itr = FDBClusterOptions::optionInfo.find(option);
|
||||||
|
if(itr != FDBClusterOptions::optionInfo.end()) {
|
||||||
|
TraceEvent("SetClusterOption").detail("Option", itr->second.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TraceEvent("UnknownClusterOption").detail("Option", option);
|
||||||
|
throw invalid_option();
|
||||||
|
}
|
||||||
|
|
||||||
if(clusterState->cluster) {
|
if(clusterState->cluster) {
|
||||||
clusterState->cluster->setOption(option, value);
|
clusterState->cluster->setOption(option, value);
|
||||||
}
|
}
|
||||||
|
@ -986,6 +1005,7 @@ void MultiVersionApi::addExternalLibrary(std::string path) {
|
||||||
std::string filename = basename(path);
|
std::string filename = basename(path);
|
||||||
|
|
||||||
if(filename.empty() || !fileExists(path)) {
|
if(filename.empty() || !fileExists(path)) {
|
||||||
|
TraceEvent("ExternalClientNotFound").detail("LibraryPath", filename);
|
||||||
throw file_not_found();
|
throw file_not_found();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,6 +1072,15 @@ void MultiVersionApi::setNetworkOption(FDBNetworkOptions::Option option, Optiona
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiVersionApi::setNetworkOptionInternal(FDBNetworkOptions::Option option, Optional<StringRef> value) {
|
void MultiVersionApi::setNetworkOptionInternal(FDBNetworkOptions::Option option, Optional<StringRef> value) {
|
||||||
|
auto itr = FDBNetworkOptions::optionInfo.find(option);
|
||||||
|
if(itr != FDBNetworkOptions::optionInfo.end()) {
|
||||||
|
TraceEvent("SetNetworkOption").detail("Option", itr->second.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TraceEvent("UnknownNetworkOption").detail("Option", option);
|
||||||
|
throw invalid_option();
|
||||||
|
}
|
||||||
|
|
||||||
if(option == FDBNetworkOptions::DISABLE_MULTI_VERSION_CLIENT_API) {
|
if(option == FDBNetworkOptions::DISABLE_MULTI_VERSION_CLIENT_API) {
|
||||||
validateOption(value, false, true);
|
validateOption(value, false, true);
|
||||||
disableMultiVersionClientApi();
|
disableMultiVersionClientApi();
|
||||||
|
|
|
@ -764,17 +764,21 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional<StringRef> valu
|
||||||
validateOptionValue(value, true);
|
validateOptionValue(value, true);
|
||||||
|
|
||||||
std::string optionValue = value.get().toString();
|
std::string optionValue = value.get().toString();
|
||||||
|
TraceEvent("SetKnob").detail("KnobString", optionValue);
|
||||||
|
|
||||||
size_t eq = optionValue.find_first_of('=');
|
size_t eq = optionValue.find_first_of('=');
|
||||||
if(eq == optionValue.npos) {
|
if(eq == optionValue.npos) {
|
||||||
|
TraceEvent(SevWarnAlways, "InvalidKnobString").detail("KnobString", optionValue);
|
||||||
throw invalid_option_value();
|
throw invalid_option_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string knob_name = optionValue.substr(0, eq);
|
std::string knobName = optionValue.substr(0, eq);
|
||||||
std::string knob_value = optionValue.substr(eq+1);
|
std::string knobValue = optionValue.substr(eq+1);
|
||||||
if (!const_cast<FlowKnobs*>(FLOW_KNOBS)->setKnob( knob_name, knob_value ) &&
|
if (!const_cast<FlowKnobs*>(FLOW_KNOBS)->setKnob( knobName, knobValue ) &&
|
||||||
!const_cast<ClientKnobs*>(CLIENT_KNOBS)->setKnob( knob_name, knob_value ))
|
!const_cast<ClientKnobs*>(CLIENT_KNOBS)->setKnob( knobName, knobValue ))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "FoundationDB client ignoring unrecognized knob option '%s'\n", knob_name.c_str());
|
TraceEvent(SevWarnAlways, "UnrecognizedKnob").detail("Knob", knobName.c_str());
|
||||||
|
fprintf(stderr, "FoundationDB client ignoring unrecognized knob option '%s'\n", knobName.c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue