diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-14 13:18:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 13:18:08 +0100 |
commit | 1ed426e9c2ec767f96f45b9ec2608125a17679dd (patch) | |
tree | 5161db028e99af959421938557cfcab8439dbe81 | |
parent | 9f8f18a653d24f4f15c8672523c50232fc22eaed (diff) | |
parent | 4e6c4756f8dd4bf0d218f857863f9c1268f8ae8a (diff) |
Merge pull request #12191 from vespa-engine/balder/stripes-2-to-4
Twice as many stripes.
6 files changed, 31 insertions, 64 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp index 350cdad791c..543accc80ae 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.cpp @@ -6,22 +6,18 @@ namespace storage { FileStorHandler::FileStorHandler(MessageSender& sender, FileStorMetrics& metrics, const spi::PartitionStateList& partitions, ServiceLayerComponentRegister& compReg) - : _impl(new FileStorHandlerImpl(1, 1, sender, metrics, partitions, compReg)) + : _impl(std::make_unique<FileStorHandlerImpl>(1, 1, sender, metrics, partitions, compReg)) { } FileStorHandler::FileStorHandler(uint32_t numThreads, uint32_t numStripes, MessageSender& sender, FileStorMetrics& metrics, const spi::PartitionStateList& partitions, ServiceLayerComponentRegister& compReg) - : _impl(new FileStorHandlerImpl(numThreads, numStripes, sender, metrics, partitions, compReg)) + : _impl(std::make_unique<FileStorHandlerImpl>(numThreads, numStripes, sender, metrics, partitions, compReg)) { } -FileStorHandler::~FileStorHandler() -{ - delete _impl; -} - +FileStorHandler::~FileStorHandler() = default; void FileStorHandler::flush(bool flushMerges) { diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h index ab3d03a5e9a..db294d7c39f 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h @@ -35,7 +35,6 @@ namespace framework { class FileStorHandlerImpl; struct FileStorMetrics; struct MessageSender; -class MountPointList; struct ServiceLayerComponentRegister; class AbortBucketOperationsCommand; @@ -259,7 +258,7 @@ public: std::string dumpQueue(uint16_t disk) const; private: - FileStorHandlerImpl* _impl; + std::unique_ptr<FileStorHandlerImpl> _impl; }; } // storage diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index f773ee774bb..080446c1c92 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -879,15 +879,15 @@ FileStorHandlerImpl::MessageEntry::MessageEntry(MessageEntry && entry) noexcept _priority(entry._priority) { } -FileStorHandlerImpl::MessageEntry::~MessageEntry() { } +FileStorHandlerImpl::MessageEntry::~MessageEntry() = default; -FileStorHandlerImpl::Disk::Disk(const FileStorHandlerImpl & owner, MessageSender & messageSender, uint32_t numThreads) +FileStorHandlerImpl::Disk::Disk(const FileStorHandlerImpl & owner, MessageSender & messageSender, uint32_t numStripes) : metrics(0), _nextStripeId(0), - _stripes(numThreads, Stripe(owner, messageSender)), + _stripes(numStripes, Stripe(owner, messageSender)), state(FileStorHandler::AVAILABLE) { - assert(numThreads > 0); + assert(numStripes > 0); } FileStorHandlerImpl::Disk::Disk(Disk && rhs) noexcept diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index 5fc592e11cb..44756ed5891 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -169,7 +169,7 @@ public: state.store(s, std::memory_order_relaxed); } - Disk(const FileStorHandlerImpl & owner, MessageSender & messageSender, uint32_t numThreads); + Disk(const FileStorHandlerImpl & owner, MessageSender & messageSender, uint32_t numStripes); Disk(Disk &&) noexcept; ~Disk(); diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index baa6523cbb2..b9fb85e0e80 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -38,11 +38,11 @@ FileStorManager(const config::ConfigUri & configUri, const spi::PartitionStateLi _bucketIdFactory(_component.getBucketIdFactory()), _configUri(configUri), _disks(), - _bucketOwnershipNotifier(new BucketOwnershipNotifier(_component, *this)), + _bucketOwnershipNotifier(std::make_unique<BucketOwnershipNotifier>(_component, *this)), _configFetcher(_configUri.getContext()), _threadLockCheckInterval(60), _failDiskOnError(false), - _metrics(new FileStorMetrics(_component.getLoadTypes()->getMetricLoadTypes())), + _metrics(std::make_unique<FileStorMetrics>(_component.getLoadTypes()->getMetricLoadTypes())), _threadMonitor(), _closed(false) { @@ -105,10 +105,10 @@ FileStorManager::configure(std::unique_ptr<vespa::config::content::StorFilestorC _config = std::move(config); _disks.resize(_component.getDiskCount()); size_t numThreads = _config->numThreads; - size_t numStripes = std::min(2ul, numThreads); + size_t numStripes = std::min(4ul, numThreads); _metrics->initDiskMetrics(_disks.size(), _component.getLoadTypes()->getMetricLoadTypes(), numStripes, numThreads); - _filestorHandler.reset(new FileStorHandler(numThreads, numStripes, *this, *_metrics, _partitions, _compReg)); + _filestorHandler = std::make_unique<FileStorHandler>(numThreads, numStripes, *this, *_metrics, _partitions, _compReg); for (uint32_t i=0; i<_component.getDiskCount(); ++i) { if (_partitions[i].isUp()) { LOG(spam, "Setting up disk %u", i); @@ -849,12 +849,6 @@ FileStorManager::reportHtmlStatus(std::ostream& out, const framework::HttpUrlPat _filestorHandler->getStatus(out, path); } -bool -FileStorManager::isMerging(const document::Bucket& bucket) const -{ - return _filestorHandler->isMerging(bucket); -} - namespace { struct Deactivator { StorBucketDatabase::Decision operator()(document::BucketId::Type, StorBucketDatabase::Entry& data) diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h index 65d4035a3dd..433b9ddbd39 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h @@ -45,65 +45,43 @@ class FileStorManager : public StorageLinkQueued, public framework::HtmlStatusReporter, public StateListener, private config::IFetcherCallback<vespa::config::content::StorFilestorConfig>, - private MessageSender + public MessageSender { - ServiceLayerComponentRegister& _compReg; - ServiceLayerComponent _component; - const spi::PartitionStateList& _partitions; - spi::PersistenceProvider& _providerCore; - ProviderErrorWrapper _providerErrorWrapper; - spi::PersistenceProvider* _provider; + ServiceLayerComponentRegister & _compReg; + ServiceLayerComponent _component; + const spi::PartitionStateList & _partitions; + spi::PersistenceProvider & _providerCore; + ProviderErrorWrapper _providerErrorWrapper; + spi::PersistenceProvider * _provider; const document::BucketIdFactory& _bucketIdFactory; - config::ConfigUri _configUri; + config::ConfigUri _configUri; typedef std::vector<DiskThread::SP> DiskThreads; - std::vector<DiskThreads> _disks; + std::vector<DiskThreads> _disks; std::unique_ptr<BucketOwnershipNotifier> _bucketOwnershipNotifier; std::unique_ptr<vespa::config::content::StorFilestorConfig> _config; config::ConfigFetcher _configFetcher; - uint32_t _threadLockCheckInterval; // In seconds - bool _failDiskOnError; - int _killSignal; + uint32_t _threadLockCheckInterval; // In seconds + bool _failDiskOnError; std::shared_ptr<FileStorMetrics> _metrics; std::unique_ptr<FileStorHandler> _filestorHandler; - lib::ClusterState _lastState; - struct ReplyHolder { - int refCount; - std::unique_ptr<api::StorageReply> reply; - - ReplyHolder(int rc, std::unique_ptr<api::StorageReply> r) - : refCount(rc), reply(std::move(r)) {}; - }; - - std::map<api::StorageMessage::Id, - std::shared_ptr<ReplyHolder> > _splitMessages; - vespalib::Lock _splitLock; mutable vespalib::Monitor _threadMonitor; // Notify to stop sleeping - bool _closed; - - FileStorManager(const FileStorManager &); - FileStorManager& operator=(const FileStorManager &); + bool _closed; - std::vector<DiskThreads> getThreads() { return _disks; } - - friend class BucketMergeTest; friend struct FileStorManagerTest; - friend class MessageTest; public: - explicit FileStorManager(const config::ConfigUri &, - const spi::PartitionStateList&, - spi::PersistenceProvider&, - ServiceLayerComponentRegister&); - ~FileStorManager(); + FileStorManager(const config::ConfigUri &, const spi::PartitionStateList&, + spi::PersistenceProvider&, ServiceLayerComponentRegister&); + FileStorManager(const FileStorManager &) = delete; + FileStorManager& operator=(const FileStorManager &) = delete; - void print(std::ostream& out, bool verbose, const std::string& indent) const override; + ~FileStorManager() override; - // Return true if we are currently merging the given bucket. - bool isMerging(const document::Bucket& bucket) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; FileStorHandler& getFileStorHandler() { return *_filestorHandler; |