Skip to content

Commit

Permalink
[native] Return error on erroneous server operation calls
Browse files Browse the repository at this point in the history
  • Loading branch information
spershin committed Jan 27, 2024
1 parent 5f43cfa commit 5cbb00d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ void PeriodicServiceInventoryManager::stop() {
}

void PeriodicServiceInventoryManager::enableRequest(bool enable) {
LOG(INFO) << (enable ? "Enabling " : "Disabling ") << id_;
requestEnabled_ = enable;
if (requestEnabled_.exchange(enable) != enable) {
LOG(INFO) << id_ << " has been " << (enable ? "enabled" : "disabled");
}
}

void PeriodicServiceInventoryManager::sendRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ std::string PrestoServerOperations::serverOperationSetState(
} else if (stateStr == "shutting_down") {
newNodeState = NodeState::kShuttingDown;
} else {
return fmt::format(
VELOX_USER_FAIL(
"Invalid state '{}'. "
"Supported states are: 'active', 'inactive', 'shutting_down'. "
"Example: server/setState?state=shutting_down",
Expand Down Expand Up @@ -304,9 +304,8 @@ std::string PrestoServerOperations::serverOperationAnnouncer(
server_->enableAnnouncer(false);
return "Announcer disabled";
}
return fmt::format(
"Invalid action '{}'. "
"Supported actions are: 'enable', 'disable'. "
VELOX_USER_FAIL(
"Invalid action '{}'. Supported actions are: 'enable', 'disable'. "
"Example: server/announcer?action=disable",
actionStr);
}
Expand Down

0 comments on commit 5cbb00d

Please sign in to comment.