diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-06 12:41:17 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-06 12:41:17 +0000 |
commit | 8fa7bf4abba72838a88886bef7062104c20dcbdd (patch) | |
tree | 73b83509291f6f3bba1f9f52b0a2598d2ac735a6 | |
parent | 31b70856e294a23b6a37a86225a521cb06c58c1a (diff) |
Use propagated bucket space instead of place holder.
9 files changed, 35 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp index 123002ecfd2..d4af7b214b6 100644 --- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp @@ -2,6 +2,7 @@ #include <vespa/log/log.h> LOG_SETUP("combiningfeedview_test"); +#include <vespa/persistence/spi/test.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> #include <vespa/searchcore/proton/server/combiningfeedview.h> #include <vespa/searchcore/proton/test/test.h> @@ -13,6 +14,7 @@ using document::DocumentUpdate; using search::IDestructorCallback; using search::SerialNum; using storage::spi::Timestamp; +using storage::spi::test::makeBucketSpace; using namespace proton; typedef std::vector<IFeedView::SP> FeedViewVector; @@ -142,7 +144,7 @@ struct Fixture _removed(_builder.getRepo(), _bucketDB, SubDbType::REMOVED), _notReady(_builder.getRepo(), _bucketDB, SubDbType::NOTREADY), _calc(new test::BucketStateCalculator()), - _view(getVector(_ready, _removed, _notReady), _calc) + _view(getVector(_ready, _removed, _notReady), makeBucketSpace(), _calc) { _builder.createDoc(1, 1); _builder.createDoc(2, 2); diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index 60b1216dbe2..547e400cd76 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -1,5 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/persistence/spi/test.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/common/hw_info.h> @@ -51,6 +52,7 @@ using search::test::DirectoryHandler; using searchcorespi::IFlushTarget; using searchcorespi::index::IThreadingService; using storage::spi::Timestamp; +using storage::spi::test::makeBucketSpace; using vespa::config::search::core::ProtonConfig; using vespalib::mkdir; @@ -78,6 +80,7 @@ struct MySubDBOwner : public IDocumentSubDBOwner uint32_t _syncCnt; MySubDBOwner() : _syncCnt(0) {} void syncFeedView() override { ++_syncCnt; } + document::BucketSpace getBucketSpace() const override { return makeBucketSpace(); } vespalib::string getName() const override { return "owner"; } uint32_t getDistributionKey() const override { return -1; } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp index a9dfeb12ed7..30ee6e1ba75 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp @@ -34,13 +34,15 @@ getRepo(const std::vector<IFeedView::SP> &views) }; CombiningFeedView::CombiningFeedView(const std::vector<IFeedView::SP> &views, + document::BucketSpace bucketSpace, const IBucketStateCalculator::SP &calc) : _repo(getRepo(views)), _views(views), _metaStores(), _calc(calc), _clusterUp(calc.get() != NULL && calc->clusterUp()), - _forceReady(!_clusterUp || !hasNotReadyFeedView()) + _forceReady(!_clusterUp || !hasNotReadyFeedView()), + _bucketSpace(bucketSpace) { _metaStores.reserve(views.size()); for (const auto &view : views) { @@ -273,7 +275,7 @@ CombiningFeedView::setCalculator(const IBucketStateCalculator::SP &newCalc) bool CombiningFeedView::shouldBeReady(const document::BucketId &bucket) const { - document::Bucket dbucket(document::BucketSpace::placeHolder(), bucket); + document::Bucket dbucket(_bucketSpace, bucket); LOG(debug, "shouldBeReady(%s): forceReady(%s), clusterUp(%s), calcReady(%s)", bucket.toString().c_str(), diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h index ef8616a25eb..ea4ac64176a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h @@ -29,6 +29,7 @@ private: IBucketStateCalculator::SP _calc; bool _clusterUp; bool _forceReady; + document::BucketSpace _bucketSpace; const ISimpleDocumentMetaStore * getDocumentMetaStorePtr() const override; @@ -59,6 +60,7 @@ public: typedef std::shared_ptr<CombiningFeedView> SP; CombiningFeedView(const std::vector<IFeedView::SP> &views, + document::BucketSpace bucketSpace, const IBucketStateCalculator::SP &calc); virtual ~CombiningFeedView(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index d0ff0832ce5..ada2c1b1069 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -1311,6 +1311,18 @@ DocumentDB::waitForOnlineState() _state.waitForOnlineState(); } +vespalib::string +DocumentDB::getName() const +{ + return _docTypeName.getName(); +} + +document::BucketSpace +DocumentDB::getBucketSpace() const +{ + return _bucketSpace; +} + uint32_t DocumentDB::getDistributionKey() const { diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index b97b5e310ea..cd0335b7b75 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -394,12 +394,15 @@ public: bool getDelayedConfig() const { return _state.getDelayedConfig(); } void replayConfig(SerialNum serialNum) override; const DocTypeName & getDocTypeName() const { return _docTypeName; } - document::BucketSpace getBucketSpace() const { return _bucketSpace; } void newConfigSnapshot(DocumentDBConfig::SP snapshot); void reconfigure(const DocumentDBConfig::SP & snapshot) override; int64_t getActiveGeneration() const; + /* + * Implements IDocumentSubDBOwner + */ void syncFeedView() override; - vespalib::string getName() const override { return _docTypeName.getName(); } + document::BucketSpace getBucketSpace() const override; + vespalib::string getName() const override; uint32_t getDistributionKey() const override; /** diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index a92c21576a2..c766cc89bb3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -4,6 +4,7 @@ #include "commit_and_wait_document_retriever.h" #include "document_subdb_collection_initializer.h" #include "documentsubdbcollection.h" +#include "i_document_subdb_owner.h" #include "maintenancecontroller.h" #include "searchabledocsubdb.h" @@ -34,6 +35,7 @@ DocumentSubDBCollection::DocumentSubDBCollection( const ProtonConfig &protonCfg, const HwInfo &hwInfo) : _subDBs(), + _owner(owner), _calc(), _readySubDbId(0), _remSubDbId(1), @@ -274,7 +276,7 @@ DocumentSubDBCollection::getFeedView() IFeedView::SP newFeedView; assert(views.size() >= 1); if (views.size() > 1) { - return IFeedView::SP(new CombiningFeedView(views, _calc)); + return IFeedView::SP(new CombiningFeedView(views, _owner.getBucketSpace(), _calc)); } else { assert(views.front() != NULL); return views.front(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 3146a65d3a3..7290250c59e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -62,6 +62,7 @@ private: using SessionManagerSP = std::shared_ptr<matching::SessionManager>; using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; SubDBVector _subDBs; + IDocumentSubDBOwner &_owner; IBucketStateCalculatorSP _calc; const uint32_t _readySubDbId; const uint32_t _remSubDbId; diff --git a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h index 3fa205bfbfe..fa19e5c77c4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/vespalib/stllike/string.h> +#include <vespa/document/bucket/bucketspace.h> #include <memory> namespace proton { @@ -15,6 +16,7 @@ class IDocumentSubDBOwner public: virtual ~IDocumentSubDBOwner() {} virtual void syncFeedView() = 0; + virtual document::BucketSpace getBucketSpace() const = 0; virtual vespalib::string getName() const = 0; virtual uint32_t getDistributionKey() const = 0; }; |