diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-10-16 11:12:34 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-10-16 11:15:27 +0200 |
commit | 1dee85e5547d7d56da61777facadc5a225254a1e (patch) | |
tree | 9886677e83090bfd4dc10bf6ab85eccf624739c8 /searchcore | |
parent | a4e825b9d0da0143700b253b47b01fe79c635684 (diff) |
Remove stoponioerrors from proton config.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/apps/proton/CMakeLists.txt | 1 | ||||
-rw-r--r-- | searchcore/src/apps/proton/downpersistence.cpp | 140 | ||||
-rw-r--r-- | searchcore/src/apps/proton/downpersistence.h | 54 | ||||
-rw-r--r-- | searchcore/src/apps/proton/proton.cpp | 50 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/config/proton.def | 3 |
5 files changed, 7 insertions, 241 deletions
diff --git a/searchcore/src/apps/proton/CMakeLists.txt b/searchcore/src/apps/proton/CMakeLists.txt index c42ed048ce1..6a1e0263a89 100644 --- a/searchcore/src/apps/proton/CMakeLists.txt +++ b/searchcore/src/apps/proton/CMakeLists.txt @@ -1,7 +1,6 @@ # Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. vespa_add_executable(searchcore_proton_app SOURCES - downpersistence.cpp proton.cpp OUTPUT_NAME vespa-proton-bin INSTALL sbin diff --git a/searchcore/src/apps/proton/downpersistence.cpp b/searchcore/src/apps/proton/downpersistence.cpp deleted file mode 100644 index bd111cef675..00000000000 --- a/searchcore/src/apps/proton/downpersistence.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "downpersistence.h" - -#include <vespa/persistence/spi/persistenceprovider.h> -#include <vespa/searchlib/util/statefile.h> -#include <vespa/document/fieldvalue/document.h> -#include <vespa/document/update/documentupdate.h> - -namespace storage::spi { - -namespace { - -Result errorResult(Result::ErrorType::FATAL_ERROR, "Node is down"); - -} - -DownPersistence::DownPersistence(const vespalib::string &downReason) - : _downReason(downReason) -{ -} - -DownPersistence::~DownPersistence() = default; - -Result -DownPersistence::initialize() -{ - return Result(); -} - -BucketIdListResult -DownPersistence::listBuckets(BucketSpace) const -{ - return BucketIdListResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -Result -DownPersistence:: setClusterState(BucketSpace, const ClusterState&) -{ - return Result(); -} - -Result -DownPersistence:: setActiveState(const Bucket&, BucketInfo::ActiveState) -{ - return errorResult; -} - -BucketInfoResult -DownPersistence:: getBucketInfo(const Bucket&) const -{ - return BucketInfoResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -Result -DownPersistence::put(const Bucket&, Timestamp, Document::SP, Context&) -{ - return errorResult; -} - -RemoveResult -DownPersistence:: remove(const Bucket&, Timestamp, const DocumentId&, Context&) -{ - return RemoveResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -RemoveResult -DownPersistence::removeIfFound(const Bucket&, Timestamp,const DocumentId&, Context&) -{ - return RemoveResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -Result -DownPersistence::removeEntry(const Bucket&, Timestamp, Context&) -{ - return errorResult; -} - -UpdateResult DownPersistence::update(const Bucket&, Timestamp, DocumentUpdate::SP, Context&) -{ - return UpdateResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -GetResult -DownPersistence::get(const Bucket&, const document::FieldSet&, const DocumentId&, Context&) const -{ - return GetResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -CreateIteratorResult -DownPersistence::createIterator(const Bucket &, FieldSetSP, const Selection &, IncludedVersions, Context &) -{ - return CreateIteratorResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -IterateResult -DownPersistence::iterate(IteratorId, uint64_t, Context&) const -{ - return IterateResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - -Result -DownPersistence::destroyIterator(IteratorId, Context&) -{ - return errorResult; -} - -Result -DownPersistence::createBucket(const Bucket&, Context&) -{ - return errorResult; -} - -Result -DownPersistence::deleteBucket(const Bucket&, Context&) -{ - return errorResult; -} - - -BucketIdListResult -DownPersistence::getModifiedBuckets(BucketSpace) const -{ - return BucketIdListResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); -} - - -Result -DownPersistence::split(const Bucket&, const Bucket&, const Bucket&, Context&) -{ - return errorResult; -} - - -Result -DownPersistence::join(const Bucket&, const Bucket&, const Bucket&, Context&) -{ - return errorResult; -} - -} diff --git a/searchcore/src/apps/proton/downpersistence.h b/searchcore/src/apps/proton/downpersistence.h deleted file mode 100644 index d9195af67cb..00000000000 --- a/searchcore/src/apps/proton/downpersistence.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include <vespa/persistence/spi/persistenceprovider.h> - -namespace storage::spi { - -/* - * Persistence provider that returns error code for all operations - * except initialize(), getPartitionStates() and setClusterState(). - * - * getPartitionStates() reports one partition, which is down with - * reason "proton state string is " + stateString. - * - * This class is used when proton is supposed to be down except for - * reporting state to cluster controller. - */ -class DownPersistence : public PersistenceProvider -{ - const vespalib::string _downReason; - -public: - DownPersistence(const vespalib::string &downReason); - - typedef std::unique_ptr<PersistenceProvider> UP; - - ~DownPersistence() override; - - Result initialize() override; - BucketIdListResult listBuckets(BucketSpace bucketSpace) const override; - Result setClusterState(BucketSpace, const ClusterState&) override; - Result setActiveState(const Bucket&, BucketInfo::ActiveState) override; - BucketInfoResult getBucketInfo(const Bucket&) const override; - Result put(const Bucket&, Timestamp, DocumentSP, Context&) override; - RemoveResult remove(const Bucket&, Timestamp timestamp, const DocumentId& id, Context&) override; - RemoveResult removeIfFound(const Bucket&, Timestamp timestamp, const DocumentId& id, Context&) override; - Result removeEntry(const Bucket&, Timestamp, Context&) override; - UpdateResult update(const Bucket&, Timestamp timestamp, DocumentUpdateSP update, Context&) override; - GetResult get(const Bucket&, const document::FieldSet& fieldSet, const DocumentId& id, Context&) const override; - - CreateIteratorResult - createIterator(const Bucket &bucket, FieldSetSP fieldSet, const Selection &selection, IncludedVersions versions, - Context &context) override; - - IterateResult iterate(IteratorId id, uint64_t maxByteSize, Context&) const override; - Result destroyIterator(IteratorId id, Context&) override; - Result createBucket(const Bucket&, Context&) override; - Result deleteBucket(const Bucket&, Context&) override; - BucketIdListResult getModifiedBuckets(BucketSpace bucketSpace) const override; - Result split(const Bucket& source, const Bucket& target1, const Bucket& target2, Context&) override; - Result join(const Bucket& source1, const Bucket& source2, const Bucket& target, Context&) override; -}; - -} diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index beff0f363fe..691a61401de 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -91,22 +91,17 @@ App::parseParams() } -#include "downpersistence.h" - using storage::spi::PersistenceProvider; -using storage::spi::DownPersistence; #include <vespa/storageserver/app/servicelayerprocess.h> class ProtonServiceLayerProcess : public storage::ServiceLayerProcess { proton::Proton & _proton; metrics::MetricManager* _metricManager; - PersistenceProvider *_downPersistence; public: ProtonServiceLayerProcess(const config::ConfigUri & configUri, - proton::Proton & proton, - PersistenceProvider *downPersistence); + proton::Proton & proton); ~ProtonServiceLayerProcess() override { shutdown(); } void shutdown() override; @@ -125,16 +120,12 @@ public: }; ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri & configUri, - proton::Proton & proton, - PersistenceProvider * downPersistence) + proton::Proton & proton) : ServiceLayerProcess(configUri), _proton(proton), - _metricManager(nullptr), - _downPersistence(downPersistence) + _metricManager(nullptr) { - if (!downPersistence) { - setMetricManager(_proton.getMetricManager()); - } + setMetricManager(_proton.getMetricManager()); } void @@ -154,7 +145,7 @@ ProtonServiceLayerProcess::setupProvider() storage::spi::PersistenceProvider & ProtonServiceLayerProcess::getProvider() { - return _downPersistence ? *_downPersistence : _proton.getPersistence(); + return _proton.getPersistence(); } int64_t @@ -186,29 +177,13 @@ App::Main() } else { const ProtonConfig &protonConfig = configSnapshot->getProtonConfig(); vespalib::string basedir = protonConfig.basedir; - bool stopOnIOErrors = protonConfig.stoponioerrors; vespalib::mkdir(basedir, true); // TODO: Test that we can write to new file in directory stateFile = std::make_unique<search::StateFile>(basedir + "/state"); int stateGen = stateFile->getGen(); vespalib::string stateString = getStateString(*stateFile); - std::unique_ptr<PersistenceProvider> downPersistence; if (stateIsDown(stateString)) { LOG(error, "proton state string is %s", stateString.c_str()); - if (stopOnIOErrors) { - if ( !params.serviceidentity.empty()) { - downPersistence = std::make_unique<DownPersistence>("proton state string is " + stateString); - } else { - LOG(info, "Sleeping 900 seconds due to proton state"); - int sleepLeft = 900; - while (!(SIG::INT.check() || SIG::TERM.check()) && sleepLeft > 0) { - std::this_thread::sleep_for(1000ms); - --sleepLeft; - } - EV_STOPPING("proton", "shutdown after stop on io errors"); - return 1; - } - } } sigBusHandler = std::make_unique<search::SigBusHandler>(stateFile.get()); ioErrorHandler = std::make_unique<search::IOErrorHandler>(stateFile.get()); @@ -217,13 +192,11 @@ App::Main() } else { proton.getMetricManager().init(params.identity, proton.getThreadPool()); } - if (!downPersistence) { - proton.init(configSnapshot); - } + proton.init(configSnapshot); configSnapshot.reset(); std::unique_ptr<ProtonServiceLayerProcess> spiProton; if ( ! params.serviceidentity.empty()) { - spiProton = std::make_unique<ProtonServiceLayerProcess>(params.serviceidentity, proton, downPersistence.get()); + spiProton = std::make_unique<ProtonServiceLayerProcess>(params.serviceidentity, proton); spiProton->setupConfig(std::chrono::milliseconds(params.subscribeTimeout)); spiProton->createNode(); EV_STARTED("servicelayer"); @@ -240,15 +213,6 @@ App::Main() stateString = getStateString(*stateFile); if (stateIsDown(stateString)) { LOG(error, "proton state string is %s", stateString.c_str()); - if (stopOnIOErrors) { - if (spiProton) { - // report down state to cluster controller. - spiProton->getNode().notifyPartitionDown(0, "proton state string is " + stateString); - std::this_thread::sleep_for(1000ms); - } - EV_STOPPING("proton", "shutdown after new stop on io errors"); - return 1; - } } } } diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index 52a7c9b05a1..abe774390f0 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -28,9 +28,6 @@ numthreadspersearch int default=1 restart ## Num summary threads numsummarythreads int default=16 restart -## Stop on io errors ? -stoponioerrors bool default=false restart - ## Perform extra validation of stored data on startup ## It requires a restart to be turned, but no restart to turned off. ## Hence it must always be followed by a manual restart. |