aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-02-07 15:00:09 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-02-07 15:00:09 +0000
commit7c504278a2873bc1b95779ee12e4ab2f9b4e7268 (patch)
treede7b4b1b164a626ac980b7f7754f711ae66263ed /storage
parented87919e63158e3a49c533eed61e57ba2e004b4c (diff)
Add a temporary dirty hack to handle overflow when adding timeout
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/storageserver/statemanager.cpp36
-rw-r--r--storage/src/vespa/storage/storageserver/statemanager.h7
2 files changed, 26 insertions, 17 deletions
diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp
index 647cba52bfc..c838885aadf 100644
--- a/storage/src/vespa/storage/storageserver/statemanager.cpp
+++ b/storage/src/vespa/storage/storageserver/statemanager.cpp
@@ -390,32 +390,28 @@ StateManager::onGetNodeState(const api::GetNodeStateCommand::SP& cmd)
{
bool sentReply = false;
if (cmd->getSourceIndex() != 0xffff) {
- sentReply = sendGetNodeStateReplies(vespalib::steady_time::max(), cmd->getSourceIndex());
+ sentReply = sendGetNodeStateReplies(cmd->getSourceIndex());
}
std::shared_ptr<api::GetNodeStateReply> reply;
{
std::unique_lock guard(_stateLock);
const bool is_up_to_date = (_controllers_observed_explicit_node_state.find(cmd->getSourceIndex())
!= _controllers_observed_explicit_node_state.end());
- if (cmd->getExpectedState() != nullptr
+ if ((cmd->getExpectedState() != nullptr)
&& (*cmd->getExpectedState() == *_nodeState || sentReply)
&& is_up_to_date)
{
vespalib::duration timeout = cmd->getTimeout();
- LOG(debug, "Received get node state request with timeout of "
- "%f seconds. Scheduling to be answered in "
- "%f seconds unless a node state change "
- "happens before that time.",
+ if (timeout == vespalib::duration::max()) timeout = 24h; //balder: Dirty temporary hack
+
+ LOG(debug, "Received get node state request with timeout of %f seconds. Scheduling to be answered in "
+ "%f seconds unless a node state change happens before that time.",
vespalib::to_s(timeout), vespalib::to_s(timeout)*0.8);
- TimeStateCmdPair pair(_component.getClock().getMonotonicTime() + timeout, cmd);
- _queuedStateRequests.emplace_back(std::move(pair));
+ _queuedStateRequests.emplace_back(_component.getClock().getMonotonicTime() + timeout, cmd);
} else {
- LOG(debug, "Answered get node state request right away since it "
- "thought we were in node state %s, while our actual "
- "node state is currently %s and we didn't just reply to "
- "existing request.",
- cmd->getExpectedState() == nullptr ? "unknown"
- : cmd->getExpectedState()->toString().c_str(),
+ LOG(debug, "Answered get node state request right away since it thought we were in node state %s, while "
+ "our actual node state is currently %s and we didn't just reply to existing request.",
+ cmd->getExpectedState() == nullptr ? "unknown": cmd->getExpectedState()->toString().c_str(),
_nodeState->toString().c_str());
reply = std::make_shared<api::GetNodeStateReply>(*cmd, *_nodeState);
mark_controller_as_having_observed_explicit_node_state(guard, cmd->getSourceIndex());
@@ -498,6 +494,18 @@ StateManager::tick() {
}
bool
+StateManager::sendGetNodeStateReplies() {
+ return sendGetNodeStateReplies(0xffff);
+}
+bool
+StateManager::sendGetNodeStateReplies(vespalib::steady_time olderThanTime) {
+ return sendGetNodeStateReplies(olderThanTime, 0xffff);
+}
+bool
+StateManager::sendGetNodeStateReplies(uint16_t nodeIndex) {
+ return sendGetNodeStateReplies(vespalib::steady_time::max(), nodeIndex);
+}
+bool
StateManager::sendGetNodeStateReplies(vespalib::steady_time olderThanTime, uint16_t node)
{
std::vector<std::shared_ptr<api::GetNodeStateReply>> replies;
diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h
index 3605a0b1605..73a89f3780f 100644
--- a/storage/src/vespa/storage/storageserver/statemanager.h
+++ b/storage/src/vespa/storage/storageserver/statemanager.h
@@ -108,9 +108,10 @@ private:
friend struct StateManagerTest;
void notifyStateListeners();
- bool sendGetNodeStateReplies(
- vespalib::steady_time olderThanTime = vespalib::steady_time::max(),
- uint16_t index = 0xffff);
+ bool sendGetNodeStateReplies();
+ bool sendGetNodeStateReplies(vespalib::steady_time olderThanTime);
+ bool sendGetNodeStateReplies(uint16_t nodeIndex);
+ bool sendGetNodeStateReplies(vespalib::steady_time olderThanTime, uint16_t nodeIndex);
void mark_controller_as_having_observed_explicit_node_state(const std::unique_lock<std::mutex> &, uint16_t controller_index);
lib::Node thisNode() const;