summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-02-07 11:33:14 +0100
committerGitHub <noreply@github.com>2023-02-07 11:33:14 +0100
commit0dc8763f99ec7a8d0938683c17c17fbe29fc3840 (patch)
tree6183cb2dcbcbffac715cf74a05822023f6c3f438 /storage
parentb5fc02d4da1fd4766e7b665ee0c8dd0914776a0b (diff)
parent4a4be00fd363441031b68e6d877bdb86b5a31504 (diff)
Merge pull request #25904 from vespa-engine/balder/std-chrono-for-bucketmanager
Use std::chrono based time for bucket manager time-to-work check.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/tests/storageserver/statereportertest.cpp12
-rw-r--r--storage/src/tests/storageserver/testvisitormessagesession.h5
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanager.cpp9
3 files changed, 11 insertions, 15 deletions
diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp
index 47d70cf436e..01cf12f7947 100644
--- a/storage/src/tests/storageserver/statereportertest.cpp
+++ b/storage/src/tests/storageserver/statereportertest.cpp
@@ -25,8 +25,8 @@ namespace storage {
class DummyApplicationGenerationFether : public ApplicationGenerationFetcher {
public:
- int64_t getGeneration() const override { return 1; }
- std::string getComponentName() const override { return "component"; }
+ [[nodiscard]] int64_t getGeneration() const override { return 1; }
+ [[nodiscard]] std::string getComponentName() const override { return "component"; }
};
struct StateReporterTest : Test {
@@ -54,8 +54,8 @@ struct MetricClock : public metrics::MetricManager::Timer
{
framework::Clock& _clock;
explicit MetricClock(framework::Clock& c) : _clock(c) {}
- time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); }
- time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); }
+ [[nodiscard]] time_t getTime() const override { return vespalib::count_s(_clock.getMonotonicTime().time_since_epoch()); }
+ [[nodiscard]] time_t getTimeInMilliSecs() const override { return vespalib::count_ms(_clock.getMonotonicTime().time_since_epoch()); }
};
}
@@ -245,8 +245,8 @@ TEST_F(StateReporterTest, report_metrics) {
"/state/v1/metrics?consumer=status"
};
- for (int i = 0; i < pathCount; i++) {
- framework::HttpUrlPath path(paths[i]);
+ for (auto & path_str : paths) {
+ framework::HttpUrlPath path(path_str);
std::ostringstream ost;
_stateReporter->reportStatus(ost, path);
std::string jsonData = ost.str();
diff --git a/storage/src/tests/storageserver/testvisitormessagesession.h b/storage/src/tests/storageserver/testvisitormessagesession.h
index c0c3b8429b2..4479b194396 100644
--- a/storage/src/tests/storageserver/testvisitormessagesession.h
+++ b/storage/src/tests/storageserver/testvisitormessagesession.h
@@ -32,10 +32,7 @@ public:
std::deque<std::unique_ptr<documentapi::DocumentMessage> > sentMessages;
- TestVisitorMessageSession(VisitorThread& t,
- Visitor& v,
- const mbus::Error& autoReplyError,
- bool autoReply);
+ TestVisitorMessageSession(VisitorThread& t, Visitor& v, const mbus::Error& autoReplyError, bool autoReply);
void reply(mbus::Reply::UP rep);
uint32_t pending() override { return pendingCount; }
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
index 9fafc87688f..cf98585bc82 100644
--- a/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
+++ b/storage/src/vespa/storage/bucketdb/bucketmanager.cpp
@@ -279,8 +279,8 @@ void BucketManager::updateMinUsedBits()
// Responsible for sending on messages that was previously queued
void BucketManager::run(framework::ThreadHandle& thread)
{
- const int64_t CHECK_MINUSEDBITS_INTERVAL = 1000*30;
- framework::MilliSecTime timeToCheckMinUsedBits(0);
+ constexpr vespalib::duration CHECK_MINUSEDBITS_INTERVAL = 30s;
+ vespalib::steady_time timeToCheckMinUsedBits = vespalib::steady_time::min();
while (!thread.interrupted()) {
bool didWork = false;
BucketInfoRequestMap infoReqs;
@@ -305,10 +305,9 @@ void BucketManager::run(framework::ThreadHandle& thread)
thread.registerTick(framework::PROCESS_CYCLE);
}
}
- if (timeToCheckMinUsedBits < _component.getClock().getTimeInMillis()) {
+ if (timeToCheckMinUsedBits < _component.getClock().getMonotonicTime()) {
updateMinUsedBits();
- timeToCheckMinUsedBits = _component.getClock().getTimeInMillis();
- timeToCheckMinUsedBits += framework::MilliSecTime(CHECK_MINUSEDBITS_INTERVAL);
+ timeToCheckMinUsedBits = _component.getClock().getMonotonicTime() + CHECK_MINUSEDBITS_INTERVAL;
}
}
}