diff options
Diffstat (limited to 'storage/src')
8 files changed, 27 insertions, 75 deletions
diff --git a/storage/src/tests/distributor/garbagecollectiontest.cpp b/storage/src/tests/distributor/garbagecollectiontest.cpp index 88281f3ca20..65c1ac726b5 100644 --- a/storage/src/tests/distributor/garbagecollectiontest.cpp +++ b/storage/src/tests/distributor/garbagecollectiontest.cpp @@ -18,7 +18,7 @@ struct GarbageCollectionOperationTest : Test, DistributorTestUtil { createLinks(); enableDistributorClusterState("distributor:1 storage:2"); addNodesToBucketDB(document::BucketId(16, 1), "0=250/50/300,1=250/50/300"); - getConfig().setGarbageCollection("music.date < 34", 3600); + getConfig().setGarbageCollection("music.date < 34", 3600s); getClock().setAbsoluteTimeInSeconds(34); }; diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp index 0c1ec1e77de..01c4ad1cf6a 100644 --- a/storage/src/tests/distributor/statecheckerstest.cpp +++ b/storage/src/tests/distributor/statecheckerstest.cpp @@ -1242,8 +1242,8 @@ std::string StateCheckersTest::testGarbageCollection( getBucketDatabase().update(e); GarbageCollectionStateChecker checker; - getConfig().setGarbageCollection("music", checkInterval); - getConfig().setLastGarbageCollectionChangeTime(lastChangeTime); + getConfig().setGarbageCollection("music", std::chrono::seconds(checkInterval)); + getConfig().setLastGarbageCollectionChangeTime(vespalib::steady_time(std::chrono::seconds(lastChangeTime))); NodeMaintenanceStatsTracker statsTracker; StateChecker::Context c(getExternalOperationHandler(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(e.getBucketId())); @@ -1315,8 +1315,8 @@ TEST_F(StateCheckersTest, gc_inhibited_when_ideal_node_in_maintenance) { getBucketDatabase().update(e); GarbageCollectionStateChecker checker; - getConfig().setGarbageCollection("music", 3600); - getConfig().setLastGarbageCollectionChangeTime(0); + getConfig().setGarbageCollection("music", 3600s); + getConfig().setLastGarbageCollectionChangeTime(vespalib::steady_time(vespalib::duration::zero())); NodeMaintenanceStatsTracker statsTracker; StateChecker::Context c(getExternalOperationHandler(), getDistributorBucketSpace(), statsTracker, makeDocumentBucket(bucket)); diff --git a/storage/src/vespa/storage/bucketdb/bucketinfo.h b/storage/src/vespa/storage/bucketdb/bucketinfo.h index f0be700d204..9616a1fae6e 100644 --- a/storage/src/vespa/storage/bucketdb/bucketinfo.h +++ b/storage/src/vespa/storage/bucketdb/bucketinfo.h @@ -3,12 +3,11 @@ #include "bucketcopy.h" #include <vespa/vespalib/util/arrayref.h> +#include <vespa/vespalib/util/time.h> namespace storage { -namespace distributor { - class DistributorTestUtil; -} +namespace distributor { class DistributorTestUtil; } enum class TrustedUpdate { UPDATE, @@ -190,10 +189,6 @@ public: */ bool removeNode(uint16_t node, TrustedUpdate update = TrustedUpdate::UPDATE); - void clearTrusted(uint16_t nodeIdx) { - getNodeInternal(nodeIdx)->clearTrusted(); - } - /** Clears all nodes from the bucket information. */ @@ -207,10 +202,6 @@ private: */ BucketCopy* getNodeInternal(uint16_t node); - const BucketCopy& getNodeRefInternal(uint16_t idx) const { - return _nodes[idx]; - } - void addNodeManual(const BucketCopy& newCopy) { _nodes.push_back(newCopy); } }; diff --git a/storage/src/vespa/storage/config/distributorconfiguration.cpp b/storage/src/vespa/storage/config/distributorconfiguration.cpp index e89b9e6b1aa..0b8564e561a 100644 --- a/storage/src/vespa/storage/config/distributorconfiguration.cpp +++ b/storage/src/vespa/storage/config/distributorconfiguration.cpp @@ -3,7 +3,6 @@ #include <vespa/document/select/parser.h> #include <vespa/document/select/traversingvisitor.h> #include <vespa/vespalib/util/exceptions.h> -#include <vespa/fastos/timestamp.h> #include <sstream> #include <vespa/log/log.h> @@ -23,14 +22,14 @@ DistributorConfiguration::DistributorConfiguration(StorageComponent& component) _maxIdealStateOperations(100), _idealStateChunkSize(1000), _maxNodesPerMerge(16), - _lastGarbageCollectionChange(0), + _lastGarbageCollectionChange(vespalib::duration::zero()), _garbageCollectionInterval(0), _minPendingMaintenanceOps(100), _maxPendingMaintenanceOps(1000), _maxVisitorsPerNodePerClientVisitor(4), _minBucketsPerVisitor(5), _maxClusterClockSkew(0), - _inhibitMergeSendingOnBusyNodeDuration(std::chrono::seconds(60)), + _inhibitMergeSendingOnBusyNodeDuration(60s), _simulated_db_pruning_latency(0), _simulated_db_merging_latency(0), _doInlineSplit(true), @@ -122,20 +121,20 @@ DistributorConfiguration::configure(const vespa::config::content::core::StorDist _minimalBucketSplit = config.minsplitcount; _maxNodesPerMerge = config.maximumNodesPerMerge; - _garbageCollectionInterval = config.garbagecollection.interval; + _garbageCollectionInterval = std::chrono::seconds(config.garbagecollection.interval); if (containsTimeStatement(config.garbagecollection.selectiontoremove)) { // Always changes. - _lastGarbageCollectionChange = 1; + _lastGarbageCollectionChange = vespalib::steady_time::min(); } else if (_garbageCollectionSelection != config.garbagecollection.selectiontoremove) { - _lastGarbageCollectionChange = fastos::time(); + _lastGarbageCollectionChange = vespalib::steady_clock::now(); } _garbageCollectionSelection = config.garbagecollection.selectiontoremove; // Don't garbage collect with empty selection. if (_garbageCollectionSelection.empty()) { - _garbageCollectionInterval = 0; + _garbageCollectionInterval = vespalib::duration::zero(); } _blockedStateCheckers.clear(); @@ -177,7 +176,7 @@ DistributorConfiguration::configure(const vespa::config::content::core::StorDist (int)_byteCountJoinLimit, (int)_minimalBucketSplit, _garbageCollectionSelection.c_str(), - (int)_garbageCollectionInterval, + (int)vespalib::to_s(_garbageCollectionInterval), (int)_maxIdealStateOperations); } diff --git a/storage/src/vespa/storage/config/distributorconfiguration.h b/storage/src/vespa/storage/config/distributorconfiguration.h index 3cb84943508..51ac7f8dae0 100644 --- a/storage/src/vespa/storage/config/distributorconfiguration.h +++ b/storage/src/vespa/storage/config/distributorconfiguration.h @@ -1,17 +1,15 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/storage/config/config-stor-distributormanager.h> -#include <vespa/storage/config/config-stor-visitordispatcher.h> +#include "config-stor-distributormanager.h" +#include "config-stor-visitordispatcher.h" #include <vespa/vespalib/stllike/hash_set.h> #include <vespa/storage/common/storagecomponent.h> -#include <chrono> +#include <vespa/vespalib/util/time.h> namespace storage { -namespace distributor { -struct DistributorTest; -} +namespace distributor { struct DistributorTest; } class DistributorConfiguration { public: @@ -40,33 +38,22 @@ public: void configure(const DistrConfig& config); void configure(const vespa::config::content::core::StorVisitordispatcherConfig& config); - - void setIdealStateChunkSize(uint32_t chunkSize) { - _idealStateChunkSize = chunkSize; - } - - uint32_t getIdealStateChunkSize() { - return _idealStateChunkSize; - } - uint32_t lastGarbageCollectionChangeTime() const { - return _lastGarbageCollectionChange; - } const std::string& getGarbageCollectionSelection() const { return _garbageCollectionSelection; } - uint32_t getGarbageCollectionInterval() const { + vespalib::duration getGarbageCollectionInterval() const { return _garbageCollectionInterval; } - void setGarbageCollection(const std::string& selection, uint32_t interval) { + void setGarbageCollection(const std::string& selection, vespalib::duration interval) { _garbageCollectionSelection = selection; _garbageCollectionInterval = interval; } - void setLastGarbageCollectionChangeTime(uint32_t lastChangeTime) { + void setLastGarbageCollectionChangeTime(vespalib::steady_time lastChangeTime) { _lastGarbageCollectionChange = lastChangeTime; } @@ -124,20 +111,6 @@ public: */ void setMinimalBucketSplit(int splitBits) { _minimalBucketSplit = splitBits; }; - /** - Sets the maximum number of ideal state operations a distributor should - schedule to each storage node. - - @param numOps The number of operations to schedule. - */ - void setMaxIdealStateOperations(uint32_t numOps) { - _maxIdealStateOperations = numOps; - }; - - uint32_t getMaxIdealStateOperations() { - return _maxIdealStateOperations; - } - void setMaintenancePriorities(const MaintenancePriorities& mp) { _maintenancePriorities = mp; } @@ -191,13 +164,6 @@ public: return _minBucketsPerVisitor; } - void setMaxVisitorsPerNodePerClientVisitor(uint32_t n) { - _maxVisitorsPerNodePerClientVisitor = n; - } - void setMinBucketsPerVisitor(uint32_t n) { - _minBucketsPerVisitor = n; - } - uint32_t getMaxNodesPerMerge() const { return _maxNodesPerMerge; } @@ -213,9 +179,7 @@ public: } using ReplicaCountingMode = DistrConfig::MinimumReplicaCountingMode; - void setMinimumReplicaCountingMode(ReplicaCountingMode mode) noexcept { - _minimumReplicaCountingMode = mode; - } + ReplicaCountingMode getMinimumReplicaCountingMode() const noexcept { return _minimumReplicaCountingMode; } @@ -276,8 +240,8 @@ private: std::string _garbageCollectionSelection; - uint32_t _lastGarbageCollectionChange; - uint32_t _garbageCollectionInterval; + vespalib::steady_time _lastGarbageCollectionChange; + vespalib::duration _garbageCollectionInterval; uint32_t _minPendingMaintenanceOps; uint32_t _maxPendingMaintenanceOps; diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index f7ef1122692..2740d275732 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -70,8 +70,7 @@ StateChecker::Context::Context(const DistributorComponent& c, distributorConfig(c.getDistributor().getConfig()), distribution(distributorBucketSpace.getDistribution()), gcTimeCalculator(c.getDistributor().getBucketIdHasher(), - std::chrono::seconds(distributorConfig - .getGarbageCollectionInterval())), + std::chrono::duration_cast<std::chrono::seconds>(distributorConfig.getGarbageCollectionInterval())), component(c), db(distributorBucketSpace.getBucketDatabase()), stats(statsTracker) diff --git a/storage/src/vespa/storage/distributor/statecheckers.cpp b/storage/src/vespa/storage/distributor/statecheckers.cpp index dab2025bfbb..b1fa3056cb1 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.cpp +++ b/storage/src/vespa/storage/distributor/statecheckers.cpp @@ -1119,7 +1119,7 @@ BucketStateStateChecker::check(StateChecker::Context& c) bool GarbageCollectionStateChecker::needsGarbageCollection(const Context& c) const { - if (c.entry->getNodeCount() == 0 || c.distributorConfig.getGarbageCollectionInterval() == 0) { + if (c.entry->getNodeCount() == 0 || c.distributorConfig.getGarbageCollectionInterval() == vespalib::duration::zero()) { return false; } if (containsMaintenanceNode(c.idealState, c)) { @@ -1147,7 +1147,7 @@ GarbageCollectionStateChecker::check(Context& c) << ", current time " << c.component.getClock().getTimeInSeconds().getTime() << ", configured interval " - << c.distributorConfig.getGarbageCollectionInterval() << "]"; + << vespalib::to_s(c.distributorConfig.getGarbageCollectionInterval()) << "]"; op->setPriority(c.distributorConfig.getMaintenancePriorities().garbageCollection); op->setDetailedReason(reason.c_str()); diff --git a/storage/src/vespa/storage/visiting/commandqueue.h b/storage/src/vespa/storage/visiting/commandqueue.h index ce309d55803..498cf14567d 100644 --- a/storage/src/vespa/storage/visiting/commandqueue.h +++ b/storage/src/vespa/storage/visiting/commandqueue.h @@ -17,7 +17,6 @@ #include <boost/multi_index/sequenced_index.hpp> #include <vespa/vespalib/util/printable.h> #include <vespa/vespalib//util/time.h> -#include <vespa/fastos/timestamp.h> #include <vespa/storageframework/generic/clock/clock.h> #include <list> #include <ostream> |