diff options
Diffstat (limited to 'storage')
19 files changed, 46 insertions, 99 deletions
diff --git a/storage/src/tests/distributor/distributor_stripe_pool_test.cpp b/storage/src/tests/distributor/distributor_stripe_pool_test.cpp index fb7c446a781..bf3beda504e 100644 --- a/storage/src/tests/distributor/distributor_stripe_pool_test.cpp +++ b/storage/src/tests/distributor/distributor_stripe_pool_test.cpp @@ -73,7 +73,7 @@ struct ParkingInvariantCheckingMockStripe : MockTickableStripe { TEST_F(DistributorStripePoolThreadingTest, can_park_and_unpark_single_stripe) { ParkingInvariantCheckingMockStripe stripe(_is_parked); - _pool.start({{&stripe}}); + _pool.start({&stripe}); loop_park_unpark_cycle_until_test_time_expired(); _pool.stop_and_join(); } diff --git a/storage/src/vespa/storage/distributor/maintenance/bucketprioritydatabase.h b/storage/src/vespa/storage/distributor/maintenance/bucketprioritydatabase.h index 41878f09014..ec7b7791c11 100644 --- a/storage/src/vespa/storage/distributor/maintenance/bucketprioritydatabase.h +++ b/storage/src/vespa/storage/distributor/maintenance/bucketprioritydatabase.h @@ -56,9 +56,9 @@ public: } }; - typedef ConstIterator const_iterator; + using const_iterator = ConstIterator; - virtual ~BucketPriorityDatabase() { } + virtual ~BucketPriorityDatabase() = default; virtual const_iterator begin() const = 0; diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenanceoperation.h b/storage/src/vespa/storage/distributor/maintenance/maintenanceoperation.h index f9fbc4a2be1..a1cdaf57119 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenanceoperation.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenanceoperation.h @@ -3,13 +3,12 @@ #include <vespa/storage/distributor/operations/operation.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenanceOperation : public Operation { public: - typedef enum { + enum Type { DELETE_BUCKET, MERGE_BUCKET, SPLIT_BUCKET, @@ -17,12 +16,11 @@ public: SET_BUCKET_STATE, GARBAGE_COLLECTION, OPERATION_COUNT - } Type; + }; - typedef std::shared_ptr<MaintenanceOperation> SP; + using SP = std::shared_ptr<MaintenanceOperation>; virtual const std::string& getDetailedReason() const = 0; }; -} // distributor -} // storage +} // storage::distributor diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h b/storage/src/vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h index 1afc0990222..3cf6ad33694 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenanceoperationgenerator.h @@ -5,13 +5,12 @@ #include <vespa/storage/distributor/maintenance/maintenanceoperation.h> #include <vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenanceOperationGenerator { public: - virtual ~MaintenanceOperationGenerator() {} + virtual ~MaintenanceOperationGenerator() = default; /** * Generate and return the highest prioritized maintenance operation for @@ -40,5 +39,4 @@ public: } }; -} // distributor -} // storage +} // storage::distributor diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenancepriority.h b/storage/src/vespa/storage/distributor/maintenance/maintenancepriority.h index 11bde9b1986..ad82022b216 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenancepriority.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenancepriority.h @@ -1,8 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenancePriority { @@ -18,7 +17,7 @@ public: PRIORITY_LIMIT }; - static const std::string toString(Priority pri) { + static constexpr const char* toString(Priority pri) noexcept { switch (pri) { case NO_MAINTENANCE_NEEDED: return "NO_MAINTENANCE_NEEDED"; case VERY_LOW: return "VERY_LOW"; @@ -56,6 +55,3 @@ private: }; } -} - - diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenancepriorityandtype.h b/storage/src/vespa/storage/distributor/maintenance/maintenancepriorityandtype.h index 9335f053b4c..4e272bf03cc 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenancepriorityandtype.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenancepriorityandtype.h @@ -4,8 +4,7 @@ #include <vespa/storage/distributor/maintenance/maintenanceoperation.h> #include <vespa/storage/distributor/maintenance/maintenancepriority.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenancePriorityAndType { @@ -32,5 +31,4 @@ public: } }; -} // distributor -} // storage +} // storage::distributor diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h b/storage/src/vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h index ca7fb6ae81f..bf32fd4ccc1 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenanceprioritygenerator.h @@ -6,13 +6,12 @@ #include <vespa/storage/distributor/maintenance/maintenancepriorityandtype.h> #include <vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenancePriorityGenerator { public: - virtual ~MaintenancePriorityGenerator() {} + virtual ~MaintenancePriorityGenerator() = default; virtual MaintenancePriorityAndType prioritize( const document::Bucket &bucket, @@ -20,5 +19,3 @@ public: }; } -} - diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenancescanner.h b/storage/src/vespa/storage/distributor/maintenance/maintenancescanner.h index f329133f2c4..412fe91d690 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenancescanner.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenancescanner.h @@ -4,13 +4,12 @@ #include <vespa/document/bucket/bucketspace.h> #include <vespa/storage/bucketdb/bucketdatabase.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenanceScanner { public: - virtual ~MaintenanceScanner() {} + virtual ~MaintenanceScanner() = default; class ScanResult { bool _done; @@ -38,5 +37,3 @@ public: }; } -} - diff --git a/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.h b/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.h index 7d17e42b934..acb0c555f49 100644 --- a/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.h +++ b/storage/src/vespa/storage/distributor/maintenance/maintenancescheduler.h @@ -5,8 +5,7 @@ #include <vespa/storage/distributor/maintenance/simplemaintenancescanner.h> #include <vespa/storage/distributor/operationstarter.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class MaintenanceOperationGenerator; class BucketPriorityDatabase; @@ -19,7 +18,7 @@ public: NORMAL_SCHEDULING_MODE }; - typedef int WaitTimeMs; + using WaitTimeMs = int; MaintenanceScheduler(MaintenanceOperationGenerator& operationGenerator, BucketPriorityDatabase& priorityDb, @@ -31,7 +30,6 @@ private: MaintenanceScheduler(const MaintenanceScheduler&); MaintenanceScheduler& operator=(const MaintenanceScheduler&); - //void scanNextBucket(); PrioritizedBucket getMostImportantBucket(); bool possibleToSchedule(const PrioritizedBucket& bucket, SchedulingMode currentMode) const; bool possibleToScheduleInEmergency(const PrioritizedBucket& bucket) const; @@ -46,5 +44,3 @@ private: }; } -} - diff --git a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp index 9d999681407..b954ef93c76 100644 --- a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp +++ b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.cpp @@ -20,8 +20,8 @@ operator<<(std::ostream& os, const NodeMaintenanceStats& stats) return os; } -NodeMaintenanceStatsTracker::NodeMaintenanceStatsTracker() {} -NodeMaintenanceStatsTracker::~NodeMaintenanceStatsTracker() {} +NodeMaintenanceStatsTracker::NodeMaintenanceStatsTracker() = default; +NodeMaintenanceStatsTracker::~NodeMaintenanceStatsTracker() = default; } diff --git a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h index 296c6f76563..faf253fc84c 100644 --- a/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h +++ b/storage/src/vespa/storage/distributor/maintenance/node_maintenance_stats_tracker.h @@ -6,8 +6,7 @@ #include <stdint.h> #include <vespa/document/bucket/bucketspace.h> -namespace storage { -namespace distributor { +namespace storage::distributor { struct NodeMaintenanceStats { @@ -17,12 +16,15 @@ struct NodeMaintenanceStats uint64_t copyingOut; uint64_t total; - NodeMaintenanceStats() + constexpr NodeMaintenanceStats() noexcept : movingOut(0), syncing(0), copyingIn(0), copyingOut(0), total(0) {} - NodeMaintenanceStats(uint64_t movingOut_, uint64_t syncing_, uint64_t copyingIn_, uint64_t copyingOut_, uint64_t total_) - : movingOut(movingOut_), syncing(syncing_), copyingIn(copyingIn_), copyingOut(copyingOut_), total(total_) + constexpr NodeMaintenanceStats(uint64_t movingOut_, uint64_t syncing_, uint64_t copyingIn_, + uint64_t copyingOut_, uint64_t total_) noexcept + : movingOut(movingOut_), syncing(syncing_), + copyingIn(copyingIn_), copyingOut(copyingOut_), + total(total_) {} bool operator==(const NodeMaintenanceStats& other) const noexcept { @@ -52,6 +54,7 @@ private: public: NodeMaintenanceStatsTracker(); ~NodeMaintenanceStatsTracker(); + void incMovingOut(uint16_t node, document::BucketSpace bucketSpace) { ++_stats[node][bucketSpace].movingOut; } @@ -92,6 +95,4 @@ public: } }; -} // distributor -} // storage - +} // storage::distributor diff --git a/storage/src/vespa/storage/distributor/maintenance/prioritizedbucket.h b/storage/src/vespa/storage/distributor/maintenance/prioritizedbucket.h index fde73de0358..d6d68a956be 100644 --- a/storage/src/vespa/storage/distributor/maintenance/prioritizedbucket.h +++ b/storage/src/vespa/storage/distributor/maintenance/prioritizedbucket.h @@ -6,13 +6,11 @@ #include <vespa/vespalib/util/stringfmt.h> #include <vespa/storage/distributor/maintenance/maintenancepriority.h> -namespace storage { - -namespace distributor { +namespace storage::distributor { class PrioritizedBucket { public: - typedef MaintenancePriority::Priority Priority; + using Priority = MaintenancePriority::Priority; static const PrioritizedBucket INVALID; @@ -40,7 +38,7 @@ public: std::string toString() const { return vespalib::make_string("PrioritizedBucket(%s, pri %s)", _bucket.toString().c_str(), - MaintenancePriority::toString(_priority).c_str()); + MaintenancePriority::toString(_priority)); } bool operator==(const PrioritizedBucket& other) const { @@ -68,6 +66,3 @@ std::ostream& operator<<(std::ostream& os, const PrioritizedBucket& bucket); } - -} - diff --git a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp index 7b75091e252..fa1a632d355 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp +++ b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp @@ -6,9 +6,7 @@ namespace storage::distributor { -SimpleBucketPriorityDatabase::~SimpleBucketPriorityDatabase() -{ -} +SimpleBucketPriorityDatabase::~SimpleBucketPriorityDatabase() = default; void SimpleBucketPriorityDatabase::clearAllEntriesForBucket(const document::Bucket &bucket) diff --git a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h index 70b007decb6..db02c248980 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h +++ b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.h @@ -5,14 +5,13 @@ #include <set> #include <map> -namespace storage { -namespace distributor { +namespace storage::distributor { class SimpleBucketPriorityDatabase : public BucketPriorityDatabase { public: virtual ~SimpleBucketPriorityDatabase(); - typedef PrioritizedBucket::Priority Priority; + using Priority = PrioritizedBucket::Priority; virtual void setPriority(const PrioritizedBucket&) override; virtual const_iterator begin() const override; @@ -21,8 +20,8 @@ public: std::string toString() const; private: - typedef std::set<document::Bucket> BucketSet; - typedef std::map<Priority, BucketSet> PriorityMap; + using BucketSet = std::set<document::Bucket>; + using PriorityMap = std::map<Priority, BucketSet>; class SimpleConstIteratorImpl : public ConstIteratorImpl { @@ -62,4 +61,3 @@ private: }; } -} diff --git a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h index 5b316201036..254b3244171 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h +++ b/storage/src/vespa/storage/distributor/maintenance/simplemaintenancescanner.h @@ -7,8 +7,7 @@ #include "node_maintenance_stats_tracker.h" #include <vespa/storage/distributor/distributor_bucket_space_repo.h> -namespace storage { -namespace distributor { +namespace storage::distributor { class SimpleMaintenanceScanner : public MaintenanceScanner { @@ -31,7 +30,7 @@ public: private: BucketPriorityDatabase& _bucketPriorityDb; const MaintenancePriorityGenerator& _priorityGenerator; - const DistributorBucketSpaceRepo &_bucketSpaceRepo; + const DistributorBucketSpaceRepo& _bucketSpaceRepo; DistributorBucketSpaceRepo::BucketSpaceMap::const_iterator _bucketSpaceItr; document::BucketId _bucketCursor; PendingMaintenanceStats _pendingMaintenance; @@ -60,4 +59,3 @@ std::ostream& operator<<(std::ostream&, const SimpleMaintenanceScanner::GlobalMaintenanceStats&); } -} diff --git a/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.cpp b/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.cpp index 42d9e3d4a3d..142ff72bc79 100644 --- a/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/idealstate/idealstateoperation.cpp @@ -185,6 +185,9 @@ public: } }; +// TODO STRIPE replace with check for pending cluster state transition. +// Null-bucket messages are not intercepted nor observeable by stripes, +// only by the top-level distributor. bool checkNullBucketRequestBucketInfoMessage(uint16_t node, document::BucketSpace bucketSpace, diff --git a/storage/src/vespa/storage/distributor/operations/operation.h b/storage/src/vespa/storage/distributor/operations/operation.h index 75d72a2b5c9..5099762fd6a 100644 --- a/storage/src/vespa/storage/distributor/operations/operation.h +++ b/storage/src/vespa/storage/distributor/operations/operation.h @@ -5,7 +5,6 @@ #include <vespa/storage/distributor/distributormessagesender.h> #include <vespa/storageframework/generic/clock/time.h> - namespace storage { namespace api { diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index 82b8371e163..049e39fa3fc 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -79,6 +79,7 @@ StateChecker::Context::Context(const DistributorNodeContext& node_ctx_in, db(distributorBucketSpace.getBucketDatabase()), stats(statsTracker) { + // TODO STRIPE use existing cache for computing ideal storage nodes for bucket idealState = distribution.getIdealStorageNodes(systemState, bucket.getBucketId()); unorderedIdealState.insert(idealState.begin(), idealState.end()); } diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index 6d580ead659..004a6a798a9 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -1127,32 +1127,6 @@ MergeHandler::handleGetBucketDiff(api::GetBucketDiffCommand& cmd, MessageTracker return tracker; } -namespace { - - struct DiffInfoTimestampOrder - : public std::binary_function<api::GetBucketDiffCommand::Entry, - api::GetBucketDiffCommand::Entry, bool> - { - bool operator()(const api::GetBucketDiffCommand::Entry& x, - const api::GetBucketDiffCommand::Entry& y) - { - return (x._timestamp < y._timestamp); - } - }; - - struct ApplyDiffInfoTimestampOrder - : public std::binary_function<api::ApplyBucketDiffCommand::Entry, - api::ApplyBucketDiffCommand::Entry, bool> - { - bool operator()(const api::ApplyBucketDiffCommand::Entry& x, - const api::ApplyBucketDiffCommand::Entry& y) - { - return (x._entry._timestamp < y._entry._timestamp); - } - }; - -} // End of anonymous namespace - void MergeHandler::handleGetBucketDiffReply(api::GetBucketDiffReply& reply, MessageSender& sender) const { |