diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-18 12:29:52 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-12-19 14:15:50 +0000 |
commit | 2cb7c0cd99d628fac2f8d1076e2a5b2496f307eb (patch) | |
tree | 34e0e2b28c4331300ccb7ffa606244e620c2d1a0 | |
parent | 3ff9a1747c83263dc34f5f0a15c90131914f9029 (diff) |
Do not carry exceptions in header files
28 files changed, 197 insertions, 209 deletions
diff --git a/memfilepersistence/src/tests/spi/CMakeLists.txt b/memfilepersistence/src/tests/spi/CMakeLists.txt index 38dadb9fd26..475e3deda9a 100644 --- a/memfilepersistence/src/tests/spi/CMakeLists.txt +++ b/memfilepersistence/src/tests/spi/CMakeLists.txt @@ -16,6 +16,7 @@ vespa_add_library(memfilepersistence_testspi shared_data_location_tracker_test.cpp buffered_file_writer_test.cpp buffer_test.cpp + simulatedfailurefile.cpp DEPENDS memfilepersistence_testhelper memfilepersistence diff --git a/memfilepersistence/src/tests/spi/memfiletest.cpp b/memfilepersistence/src/tests/spi/memfiletest.cpp index 70b03271da9..77f10f305ba 100644 --- a/memfilepersistence/src/tests/spi/memfiletest.cpp +++ b/memfilepersistence/src/tests/spi/memfiletest.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/memfilepersistence/memfile/memfile.h> #include <tests/spi/memfiletestutils.h> #include <tests/spi/logginglazyfile.h> @@ -7,6 +6,7 @@ #include <vespa/vdstestlib/cppunit/macros.h> #include <vespa/memfilepersistence/memfile/memfilecompactor.h> #include <vespa/memfilepersistence/mapper/simplememfileiobuffer.h> +#include <vespa/vespalib/util/exceptions.h> #include <limits> namespace storage { diff --git a/memfilepersistence/src/tests/spi/memfiletestutils.cpp b/memfilepersistence/src/tests/spi/memfiletestutils.cpp index dd9a231536a..572a0926c27 100644 --- a/memfilepersistence/src/tests/spi/memfiletestutils.cpp +++ b/memfilepersistence/src/tests/spi/memfiletestutils.cpp @@ -7,8 +7,9 @@ #include <vespa/memfilepersistence/memfile/memfilecache.h> #include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h> #include <vespa/document/update/assignvalueupdate.h> -#include <sys/time.h> #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/util/exceptions.h> +#include <sys/time.h> using document::DocumentType; diff --git a/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp b/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp new file mode 100644 index 00000000000..e96475edb61 --- /dev/null +++ b/memfilepersistence/src/tests/spi/simulatedfailurefile.cpp @@ -0,0 +1,55 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "simulatedfailurefile.h" +#include <vespa/vespalib/util/exceptions.h> + +namespace storage { +namespace memfile { + +vespalib::LazyFile::UP +SimulatedFailureLazyFile::Factory::createFile(const std::string& fileName) const { + return vespalib::LazyFile::UP( + new SimulatedFailureLazyFile(fileName, + vespalib::File::DIRECTIO, + _readOpsBeforeFailure, + _writeOpsBeforeFailure)); +} + +SimulatedFailureLazyFile::SimulatedFailureLazyFile( + const std::string& filename, + int flags, + int readOpsBeforeFailure, + int writeOpsBeforeFailure) + : LazyFile(filename, flags), + _readOpsBeforeFailure(readOpsBeforeFailure), + _writeOpsBeforeFailure(writeOpsBeforeFailure) +{ +} + +off_t +SimulatedFailureLazyFile::write(const void *buf, size_t bufsize, off_t offset) +{ + if (_writeOpsBeforeFailure == 0) { + throw vespalib::IoException( + "A simulated I/O write exception was triggered", + vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC); + } + --_writeOpsBeforeFailure; + return vespalib::LazyFile::write(buf, bufsize, offset); +} + +size_t +SimulatedFailureLazyFile::read(void *buf, size_t bufsize, off_t offset) const +{ + if (_readOpsBeforeFailure == 0) { + throw vespalib::IoException( + "A simulated I/O read exception was triggered", + vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC); + } + --_readOpsBeforeFailure; + return vespalib::LazyFile::read(buf, bufsize, offset); +} + +} // ns memfile +} // ns storage + diff --git a/memfilepersistence/src/tests/spi/simulatedfailurefile.h b/memfilepersistence/src/tests/spi/simulatedfailurefile.h index 1ded927a3d1..825c9f53585 100644 --- a/memfilepersistence/src/tests/spi/simulatedfailurefile.h +++ b/memfilepersistence/src/tests/spi/simulatedfailurefile.h @@ -17,15 +17,8 @@ public: Factory() : _readOpsBeforeFailure(-1), _writeOpsBeforeFailure(0) - { - } - vespalib::LazyFile::UP createFile(const std::string& fileName) const { - return vespalib::LazyFile::UP( - new SimulatedFailureLazyFile(fileName, - vespalib::File::DIRECTIO, - _readOpsBeforeFailure, - _writeOpsBeforeFailure)); - } + { } + vespalib::LazyFile::UP createFile(const std::string& fileName) const; void setReadOpsBeforeFailure(int ops) { _readOpsBeforeFailure = ops; @@ -43,34 +36,10 @@ public: const std::string& filename, int flags, int readOpsBeforeFailure, - int writeOpsBeforeFailure) - : LazyFile(filename, flags), - _readOpsBeforeFailure(readOpsBeforeFailure), - _writeOpsBeforeFailure(writeOpsBeforeFailure) - { - } + int writeOpsBeforeFailure); - off_t write(const void *buf, size_t bufsize, off_t offset) - { - if (_writeOpsBeforeFailure == 0) { - throw vespalib::IoException( - "A simulated I/O write exception was triggered", - vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC); - } - --_writeOpsBeforeFailure; - return vespalib::LazyFile::write(buf, bufsize, offset); - } - - size_t read(void *buf, size_t bufsize, off_t offset) const - { - if (_readOpsBeforeFailure == 0) { - throw vespalib::IoException( - "A simulated I/O read exception was triggered", - vespalib::IoException::CORRUPT_DATA, VESPA_STRLOC); - } - --_readOpsBeforeFailure; - return vespalib::LazyFile::read(buf, bufsize, offset); - } + off_t write(const void *buf, size_t bufsize, off_t offset); + size_t read(void *buf, size_t bufsize, off_t offset) const; }; } // ns memfile diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp index c314cdde1aa..d6b8a819823 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/memfilepersistence/device/ioevent.h> #include <vespa/memfilepersistence/device/device.h> +#include <vespa/vespalib/util/exceptions.h> #include <cerrno> #include <ostream> diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h index d30026c9f8c..e801d886bca 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h +++ b/memfilepersistence/src/vespa/memfilepersistence/device/ioevent.h @@ -7,9 +7,9 @@ */ #pragma once -#include <vespa/memfilepersistence/device/device.h> -#include <vespa/vespalib/util/exceptions.h> +#include "device.h" +namespace vespalib { class IoException; } namespace storage { namespace memfile { diff --git a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp index 74708bb36d8..e921101aa17 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/init/filescanner.cpp @@ -1,13 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/memfilepersistence/init/filescanner.h> #include <vespa/document/bucket/bucketid.h> -#include <iomanip> -#include <vespa/log/log.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/exceptions.h> +#include <iomanip> +#include <vespa/log/log.h> LOG_SETUP(".persistence.memfile.filescanner"); namespace storage { diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp index cd9cb5f3ee9..cd4b150f41c 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp @@ -4,6 +4,7 @@ #include <vespa/document/repo/documenttyperepo.h> #include <vespa/memfilepersistence/common/environment.h> #include <vespa/vespalib/util/crc.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".memfile.simpleiobuffer"); diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp index 86cf7f50ba2..da085ca9137 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.cpp @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/memfilepersistence/spi/operationhandler.h> +#include "operationhandler.h" +#include <vespa/memfilepersistence/common/exceptions.h> #include <vespa/document/select/parser.h> #include <vespa/log/log.h> - LOG_SETUP(".persistence.memfile.handler.operation"); namespace storage { diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h index 708ab34922a..a55b2413321 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h +++ b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h @@ -10,7 +10,6 @@ */ #pragma once -#include <vespa/memfilepersistence/common/exceptions.h> #include <vespa/memfilepersistence/common/filespecification.h> #include <vespa/memfilepersistence/common/types.h> #include <vespa/memfilepersistence/memfile/memfile.h> diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp index 2a3f1d58134..0011dddd421 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp @@ -1,17 +1,17 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/util/stringutil.h> #include <vespa/fnet/frt/frt.h> -#include <iostream> -#include <vespa/log/log.h> #include <vespa/memfilepersistence/device/mountpointlist.h> #include <vespa/memfilepersistence/tools/vdsdisktool.h> #include <vespa/storageframework/defaultimplementation/clock/realclock.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/programoptions.h> +#include <vespa/vespalib/util/exceptions.h> +#include <sstream> +#include <vespa/log/log.h> LOG_SETUP(".vdsdiskapp"); using std::vector; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp index 3f7d4059447..944c1ae3a75 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp @@ -1,12 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.attribute.filter_attribute_manager"); - #include "filter_attribute_manager.h" -#include <vespa/searchlib/common/isequencedtaskexecutor.h> #include "i_attribute_functor.h" +#include <vespa/searchlib/common/isequencedtaskexecutor.h> +#include <vespa/vespalib/util/exceptions.h> using search::AttributeGuard; @@ -31,6 +28,46 @@ FilterAttributeManager::FilterAttributeManager(const AttributeSet &acceptedAttri } } +FilterAttributeManager::~FilterAttributeManager() { } + +search::AttributeGuard::UP +FilterAttributeManager::getAttributeStableEnum(const vespalib::string &) const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +search::attribute::IAttributeContext::UP +FilterAttributeManager::createContext() const { + throw vespalib::IllegalArgumentException("Not implemented"); +} + +IAttributeManager::SP +FilterAttributeManager::create(const AttributeCollectionSpec &) const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +std::vector<searchcorespi::IFlushTarget::SP> +FilterAttributeManager::getFlushTargets() const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +search::SerialNum +FilterAttributeManager::getOldestFlushedSerialNumber() const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +search::SerialNum +FilterAttributeManager::getNewestFlushedSerialNumber() const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +void +FilterAttributeManager::getAttributeListAll(std::vector<search::AttributeGuard> &) const { + throw vespalib::IllegalArgumentException("Not implemented"); +} +void +FilterAttributeManager::wipeHistory(const search::index::Schema &) { + throw vespalib::IllegalArgumentException("Not implemented"); +} +const IAttributeFactory::SP & +FilterAttributeManager::getFactory() const { + throw vespalib::IllegalArgumentException("Not implemented"); +} + AttributeGuard::UP FilterAttributeManager::getAttribute(const vespalib::string &name) const { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h index 0add0bb9714..76d4d79cc91 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h @@ -3,7 +3,6 @@ #pragma once #include "i_attribute_manager.h" -#include <vespa/vespalib/util/exceptions.h> #include <set> namespace proton { @@ -30,55 +29,29 @@ private: public: FilterAttributeManager(const AttributeSet &acceptedAttributes, const IAttributeManager::SP &mgr); + ~FilterAttributeManager(); // Implements search::IAttributeManager virtual search::AttributeGuard::UP getAttribute(const vespalib::string &name) const; - virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &) const { - throw vespalib::IllegalArgumentException("Not implemented"); - } virtual void getAttributeList(std::vector<search::AttributeGuard> &list) const; - virtual search::attribute::IAttributeContext::UP createContext() const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - - // Implements proton::IAttributeManager - virtual IAttributeManager::SP create(const AttributeCollectionSpec &) const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - virtual std::vector<searchcorespi::IFlushTarget::SP> getFlushTargets() const { - throw vespalib::IllegalArgumentException("Not implemented"); - } virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const; - virtual search::SerialNum getOldestFlushedSerialNumber() const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - virtual search::SerialNum getNewestFlushedSerialNumber() const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - virtual void getAttributeListAll(std::vector<search::AttributeGuard> &) const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - virtual void wipeHistory(const search::index::Schema &) { - throw vespalib::IllegalArgumentException("Not implemented"); - } - virtual const IAttributeFactory::SP &getFactory() const { - throw vespalib::IllegalArgumentException("Not implemented"); - } - - virtual search::ISequencedTaskExecutor & - getAttributeFieldWriter() const override; - - virtual search::AttributeVector * - getWritableAttribute(const vespalib::string &name) const override; + virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &) const; + virtual search::attribute::IAttributeContext::UP createContext() const; - virtual const std::vector<search::AttributeVector *> & - getWritableAttributes() const override; - - virtual void - asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> func) const override; - - virtual ExclusiveAttributeReadAccessor::UP - getExclusiveReadAccessor(const vespalib::string &name) const override; + // Implements proton::IAttributeManager + virtual IAttributeManager::SP create(const AttributeCollectionSpec &) const; + virtual std::vector<searchcorespi::IFlushTarget::SP> getFlushTargets() const; + virtual search::SerialNum getOldestFlushedSerialNumber() const; + virtual search::SerialNum getNewestFlushedSerialNumber() const; + virtual void getAttributeListAll(std::vector<search::AttributeGuard> &) const; + virtual void wipeHistory(const search::index::Schema &); + virtual const IAttributeFactory::SP &getFactory() const; + virtual search::ISequencedTaskExecutor & getAttributeFieldWriter() const override; + + virtual search::AttributeVector * getWritableAttribute(const vespalib::string &name) const override; + virtual const std::vector<search::AttributeVector *> & getWritableAttributes() const override; + virtual void asyncForEachAttribute(std::shared_ptr<IAttributeFunctor> func) const override; + virtual ExclusiveAttributeReadAccessor::UP getExclusiveReadAccessor(const vespalib::string &name) const override; }; } // namespace proton diff --git a/storage/src/vespa/storage/bucketdb/CMakeLists.txt b/storage/src/vespa/storage/bucketdb/CMakeLists.txt index 192799dd634..430f3ca750c 100644 --- a/storage/src/vespa/storage/bucketdb/CMakeLists.txt +++ b/storage/src/vespa/storage/bucketdb/CMakeLists.txt @@ -11,6 +11,7 @@ vespa_add_library(storage_bucketdb OBJECT lockablemap.cpp storagebucketdbinitializer.cpp storbucketdb.cpp + bucketmanagermetrics.cpp DEPENDS AFTER storage_storageconfig diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h index c831e3799fe..876f9755ee6 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.h @@ -16,21 +16,8 @@ struct DataStoredMetrics : public metrics::MetricSet metrics::LongValueMetric active; metrics::LongValueMetric ready; - DataStoredMetrics(const std::string& name, metrics::MetricSet* owner) - : metrics::MetricSet(name, "partofsum yamasdefault", "", owner, "disk"), - buckets("buckets", "", "buckets managed", this), - docs("docs", "", "documents stored", this), - bytes("bytes", "", "bytes stored", this), - active("activebuckets", "", "Number of active buckets on the node", - this), - ready("readybuckets", "", "Number of ready buckets on the node", - this) - { - docs.logOnlyIfSet(); - bytes.logOnlyIfSet(); - active.logOnlyIfSet(); - ready.logOnlyIfSet(); - } + DataStoredMetrics(const std::string& name, metrics::MetricSet* owner); + ~DataStoredMetrics(); }; class BucketManagerMetrics : public metrics::MetricSet @@ -42,37 +29,9 @@ public: metrics::LongAverageMetric fullBucketInfoRequestSize; metrics::LongAverageMetric fullBucketInfoLatency; - BucketManagerMetrics() - : metrics::MetricSet("datastored", "", ""), - disks(), - total("alldisks", "sum", - "Sum of data stored metrics for all disks", this), - simpleBucketInfoRequestSize("simplebucketinforeqsize", "", - "Amount of buckets returned in simple bucket info requests", - this), - fullBucketInfoRequestSize("fullbucketinforeqsize", "", - "Amount of distributors answered at once in full bucket " - "info requests.", this), - fullBucketInfoLatency("fullbucketinfolatency", "", - "Amount of time spent to process a full bucket info request", - this) - - { - } - - void setDisks(uint16_t numDisks) { - assert(numDisks > 0); - if (!disks.empty()) { - throw vespalib::IllegalStateException( - "Cannot initialize disks twice", VESPA_STRLOC); - } - for (uint16_t i = 0; i<numDisks; i++) { - disks.push_back(DataStoredMetrics::SP( - new DataStoredMetrics( - vespalib::make_string("disk%d", i), this))); - total.addMetricToSum(*disks.back()); - } - } + BucketManagerMetrics(); + ~BucketManagerMetrics(); + void setDisks(uint16_t numDisks); }; } diff --git a/storage/src/vespa/storage/bucketdb/judyarray.cpp b/storage/src/vespa/storage/bucketdb/judyarray.cpp index 67fd8024bd1..0e58be29f01 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.cpp +++ b/storage/src/vespa/storage/bucketdb/judyarray.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/bucketdb/judyarray.h> +#include "judyarray.h" +#include <vespa/vespalib/util/exceptions.h> #include <iostream> #include <sstream> @@ -11,6 +11,26 @@ JudyArray::~JudyArray() clear(); } +void +JudyArray::Iterator::setValue(data_type val) +{ + if (_data == 0) { + throw vespalib::IllegalArgumentException( + "Cannot set value of end() iterator", VESPA_STRLOC); + } + *_data = val; +} + +void +JudyArray::Iterator::remove() +{ + if (_data == 0) { + throw vespalib::IllegalArgumentException( + "Cannot erase end() iterator", VESPA_STRLOC); + } + _parent->erase(_key); +} + bool JudyArray::operator==(const JudyArray& array) const { diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h index 9789d387a03..4ded2821af3 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.h +++ b/storage/src/vespa/storage/bucketdb/judyarray.h @@ -16,7 +16,6 @@ #pragma once -#include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/printable.h> #include <Judy.h> @@ -228,25 +227,5 @@ JudyArray::ConstIterator::operator==(const JudyArray::ConstIterator &cp) const return (_data == cp._data); } -inline void -JudyArray::Iterator::setValue(data_type val) -{ - if (_data == 0) { - throw vespalib::IllegalArgumentException( - "Cannot set value of end() iterator", VESPA_STRLOC); - } - *_data = val; -} - -inline void -JudyArray::Iterator::remove() -{ - if (_data == 0) { - throw vespalib::IllegalArgumentException( - "Cannot erase end() iterator", VESPA_STRLOC); - } - _parent->erase(_key); -} - } // storage diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp index 5d8cc5c6c27..109e864ba2b 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.cpp @@ -1,19 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h> - -#include <vespa/log/log.h> - -LOG_SETUP(".storage.component.register.servicelayer"); +#include "servicelayercomponentregisterimpl.h" +#include <vespa/vespalib/util/exceptions.h> namespace storage { +using vespalib::IllegalStateException; + ServiceLayerComponentRegisterImpl::ServiceLayerComponentRegisterImpl() : _diskCount(0), _bucketDatabase() -{ -} +{ } void ServiceLayerComponentRegisterImpl::registerServiceLayerComponent( @@ -31,8 +28,7 @@ ServiceLayerComponentRegisterImpl::setDiskCount(uint16_t count) { vespalib::LockGuard lock(_componentLock); if (_diskCount != 0) { - throw vespalib::IllegalStateException( - "Disk count already set. Cannot be updated live", VESPA_STRLOC); + throw IllegalStateException("Disk count already set. Cannot be updated live", VESPA_STRLOC); } _diskCount = count; for (uint32_t i=0; i<_components.size(); ++i) { diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index fb9b18c7341..bee8e7a6c49 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -18,6 +18,7 @@ #include <vespa/storageapi/message/stat.h> #include <vespa/storageapi/message/batch.h> #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".persistence.filestor.handler.impl"); diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index daf311ace67..b0e40789f86 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -7,6 +7,7 @@ #include <vespa/document/fieldset/fieldsets.h> #include <vespa/storage/common/bucketoperationlogger.h> #include <vespa/vespalib/objects/nbostream.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".persistence.mergehandler"); diff --git a/storage/src/vespa/storage/persistence/persistencethread.cpp b/storage/src/vespa/storage/persistence/persistencethread.cpp index a8f74af539d..d2bfcccb8cf 100644 --- a/storage/src/vespa/storage/persistence/persistencethread.cpp +++ b/storage/src/vespa/storage/persistence/persistencethread.cpp @@ -10,6 +10,7 @@ #include <vespa/storage/common/bucketoperationlogger.h> #include <vespa/document/fieldset/fieldsetrepo.h> #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> LOG_SETUP(".persistence.thread"); diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp index 1a3440c0494..14b6adcb9a4 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp @@ -9,6 +9,7 @@ #include <vespa/vdslib/distribution/distribution.h> #include <vespa/config/config.h> #include <vespa/storage/bucketdb/lockablemap.hpp> +#include <vespa/vespalib/util/exceptions.h> LOG_SETUP(".bucketintegritychecker"); diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp index 5b742ad524d..8de4199f246 100644 --- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp +++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.cpp @@ -1,15 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> +#include "changedbucketownershiphandler.h" #include <vespa/storageapi/message/state.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storage/common/messagebucketid.h> -#include <vespa/storage/common/servicelayercomponent.h> #include <vespa/storage/common/nodestateupdater.h> -#include <vespa/storage/persistence/messages.h> -#include <vespa/storage/storageserver/changedbucketownershiphandler.h> -#include <vespa/log/log.h> +#include <vespa/vespalib/util/exceptions.h> +#include <vespa/log/log.h> LOG_SETUP(".bucketownershiphandler"); namespace storage { diff --git a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h index 6027704be61..1689419d436 100644 --- a/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h +++ b/storage/src/vespa/storage/storageserver/changedbucketownershiphandler.h @@ -9,13 +9,13 @@ #include <vespa/metrics/metrics.h> #include <vespa/config/config.h> #include <vespa/config-persistence.h> +#include <vespa/storage/common/servicelayercomponent.h> +#include <vespa/storage/persistence/messages.h> #include <atomic> #include <vector> namespace storage { -class ServiceLayerComponent; - /** * The changed bucket ownership handler is a storage link that synchronously * intercepts attempts to change the state on the node and ensure any diff --git a/storage/src/vespa/storage/storageserver/distributornode.cpp b/storage/src/vespa/storage/storageserver/distributornode.cpp index 308747b6b10..ef3b3809720 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.cpp +++ b/storage/src/vespa/storage/storageserver/distributornode.cpp @@ -1,17 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/storageserver/distributornode.h> - +#include "distributornode.h" +#include "bouncer.h" +#include "communicationmanager.h" +#include "opslogger.h" +#include "statemanager.h" #include <vespa/storage/distributor/distributor.h> -#include <vespa/storage/storageserver/bouncer.h> -#include <vespa/storage/storageserver/communicationmanager.h> -#include <vespa/storage/storageserver/opslogger.h> -#include <vespa/storage/storageserver/statemanager.h> #include <vespa/storage/common/hostreporter/hostinfo.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/log/log.h> - LOG_SETUP(".node.distributor"); namespace storage { diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index 4c851264980..7ddc4392862 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -1,7 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storage/storageserver/storagenode.h> +#include "storagenode.h" +#include "bouncer.h" +#include "bucketintegritychecker.h" +#include "communicationmanager.h" +#include "mergethrottler.h" +#include "opslogger.h" +#include "statemanager.h" +#include "statereporter.h" +#include "storagemetricsset.h" #include <vespa/storage/bucketdb/bucketmanager.h> #include <vespa/storage/bucketdb/storagebucketdbinitializer.h> @@ -14,20 +21,13 @@ #include <vespa/storage/distributor/distributor.h> #include <vespa/storage/distributor/pendingmessagetracker.h> #include <vespa/storage/persistence/filestorage/filestormanager.h> -#include <vespa/storage/storageserver/bouncer.h> -#include <vespa/storage/storageserver/bucketintegritychecker.h> -#include <vespa/storage/storageserver/communicationmanager.h> -#include <vespa/storage/storageserver/mergethrottler.h> -#include <vespa/storage/storageserver/opslogger.h> -#include <vespa/storage/storageserver/statemanager.h> -#include <vespa/storage/storageserver/statereporter.h> -#include <vespa/storage/storageserver/storagemetricsset.h> #include <vespa/storage/storageutil/functor.h> #include <vespa/storage/storageutil/log.h> #include <vespa/storage/visiting/visitormanager.h> #include <vespa/storage/visiting/messagebusvisitormessagesession.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/exceptions.h> #include <vespa/metrics/metricmanager.h> #include <fstream> #include <sstream> diff --git a/storageserver/src/vespa/storageserver/app/process.cpp b/storageserver/src/vespa/storageserver/app/process.cpp index fc537f06590..352254fba14 100644 --- a/storageserver/src/vespa/storageserver/app/process.cpp +++ b/storageserver/src/vespa/storageserver/app/process.cpp @@ -1,11 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/storageserver/app/process.h> +#include "process.h" +#include <vespa/vespalib/util/exceptions.h> -//#include <vespa/config/helper/legacy.h> #include <vespa/log/log.h> - LOG_SETUP(".process"); namespace storage { @@ -13,8 +11,7 @@ namespace storage { Process::Process(const config::ConfigUri & configUri) : _configUri(configUri), _configSubscriber(_configUri.getContext()) -{ -} +{ } void Process::setupConfig(uint64_t subscribeTimeout) |