diff options
author | Geir Storli <geirstorli@yahoo.no> | 2016-11-03 14:49:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 14:49:20 +0100 |
commit | 851e047babf8274eece4f467af77ce60e47f4b50 (patch) | |
tree | bf545753bbb47ff67795eb78fda246a15c1d87e8 /searchcore | |
parent | edf4bc671bace82abd89788888c83bbad49c9497 (diff) | |
parent | a29f3819953d0769299474efb1fbaae8af2e69c0 (diff) |
Merge pull request #1007 from yahoo/toregge/use-memory-buffer-for-attribute-save-if-disk-is-slow-rebased
Toregge/use memory buffer for attribute save if disk is slow rebased
Diffstat (limited to 'searchcore')
27 files changed, 259 insertions, 69 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index c9ce9b88477..a988ed99ace 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -19,6 +19,7 @@ LOG_SETUP("persistenceconformance_test"); #include <vespa/searchlib/transactionlog/translogserver.h> #include <tests/proton/common/dummydbowner.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/mock_hw_info.h> using namespace config; using namespace proton; @@ -188,7 +189,8 @@ public: _config_stores.getConfigStore( docType.toString()), std::make_shared<vespalib::ThreadStackExecutor> - (16, 128 * 1024))); + (16, 128 * 1024), + std::make_shared<vespalib::MockHwInfo>())); } }; diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 34c67da4ac8..62d4e0823eb 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -30,6 +30,7 @@ LOG_SETUP("attribute_manager_test"); #include <vespa/searchlib/attribute/singlenumericattribute.hpp> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/vespalib/util/mock_hw_info.h> #include <vespa/config-attributes.h> namespace vespa { namespace config { namespace search {}}} @@ -106,10 +107,12 @@ struct BaseFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; BaseFixture() : _dirHandler(test_dir), _fileHeaderContext(), - _attributeFieldWriter() + _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()) { } }; @@ -123,7 +126,7 @@ struct AttributeManagerFixture AttributeManagerFixture(BaseFixture &bf) : _msp(std::make_shared<proton::AttributeManager> (test_dir, "test.subdb", TuneFileAttributes(), bf._fileHeaderContext, - bf._attributeFieldWriter)), + bf._attributeFieldWriter, bf._hwInfo)), _m(*_msp), _aw(_msp) { @@ -435,7 +438,7 @@ TEST_F("require that removed attributes can resurrect", BaseFixture) new proton::AttributeManager(test_dir, "test.subdb", TuneFileAttributes(), f._fileHeaderContext, - f._attributeFieldWriter)); + f._attributeFieldWriter, f._hwInfo)); { AttributeVector::SP a1 = am1->addAttribute("a1", INT32_SINGLE, diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp index 36e50249b89..1f69d9136cf 100644 --- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp @@ -11,6 +11,7 @@ LOG_SETUP("attribute_populator_test"); #include <vespa/searchlib/index/docbuilder.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/vespalib/util/mock_hw_info.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> using namespace document; @@ -55,6 +56,7 @@ struct Fixture test::DirectoryHandler _testDir; DummyFileHeaderContext _fileHeader; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; AttributeManager::SP _mgr; AttributePopulator _pop; DocContext _ctx; @@ -62,9 +64,10 @@ struct Fixture : _testDir(TEST_DIR), _fileHeader(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), - _fileHeader, _attributeFieldWriter)), + _fileHeader, _attributeFieldWriter, _hwInfo)), _pop(_mgr, 1, "test"), _ctx() { diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index c8cce9fb2a0..c8676efd551 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -19,6 +19,7 @@ LOG_SETUP("attribute_test"); #include <vespa/searchlib/index/docbuilder.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/util/filekit.h> +#include <vespa/vespalib/util/mock_hw_info.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/document/predicate/predicate_slime_builder.h> @@ -102,6 +103,7 @@ struct Fixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; proton::AttributeManager::SP _m; AttributeWriter aw; @@ -109,9 +111,10 @@ struct Fixture : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _m(std::make_shared<proton::AttributeManager> (test_dir, "test.subdb", TuneFileAttributes(), - _fileHeaderContext, _attributeFieldWriter)), + _fileHeaderContext, _attributeFieldWriter, _hwInfo)), aw(_m) { } @@ -527,16 +530,20 @@ struct FilterFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; + proton::AttributeManager::SP _baseMgr; FilterAttributeManager _filterMgr; FilterFixture() : _dirHandler(test_dir), _fileHeaderContext(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _baseMgr(new proton::AttributeManager(test_dir, "test.subdb", TuneFileAttributes(), _fileHeaderContext, - _attributeFieldWriter)), + _attributeFieldWriter, + _hwInfo)), _filterMgr(ACCEPTED_ATTRIBUTES, _baseMgr) { _baseMgr->addAttribute("a1", INT32_SINGLE, createSerialNum); diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 53904e14658..2d43e0b06db 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -16,7 +16,7 @@ LOG_SETUP("attributeflush_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/searchcore/proton/test/directory_handler.h> - +#include <vespa/vespalib/util/mock_hw_info.h> #include <vespa/searchlib/attribute/attributevector.hpp> using namespace document; @@ -197,7 +197,7 @@ private: requireThatFlushableAttributeReportsMemoryUsage(void); void - requireThatFlushableAttributeManagesSyncTokenInfo(void); + requireThatFlushableAttributeManagesSyncTokenInfo(); void requireThatFlushTargetsCanBeRetrieved(void); @@ -216,6 +216,9 @@ private: void requireThatShrinkWorks(); + + void requireThatFlushedAttributeCanBeLoaded(std::shared_ptr<vespalib::IHwInfo> hwInfo); + void requireThatFlushedAttributeCanBeLoaded(); public: int Main(void); @@ -229,10 +232,19 @@ struct BaseFixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; BaseFixture() : _dirHandler(test_dir), _fileHeaderContext(), - _attributeFieldWriter() + _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()) + { + } + BaseFixture(const std::shared_ptr<IHwInfo> &hwInfo) + : _dirHandler(test_dir), + _fileHeaderContext(), + _attributeFieldWriter(), + _hwInfo(hwInfo) { } }; @@ -246,7 +258,7 @@ struct AttributeManagerFixture AttributeManagerFixture(BaseFixture &bf) : _msp(std::make_shared<AttributeManager> (test_dir, "test.subdb", TuneFileAttributes(), bf._fileHeaderContext, - bf._attributeFieldWriter)), + bf._attributeFieldWriter, bf._hwInfo)), _m(*_msp), _aw(_msp) { @@ -254,6 +266,11 @@ struct AttributeManagerFixture AttributeVector::SP addAttribute(const vespalib::string &name) { return _m.addAttribute(name, getInt32Config(), createSerialNum); } + AttributeVector::SP addPostingAttribute(const vespalib::string &name) { + AVConfig cfg(getInt32Config()); + cfg.setFastSearch(true); + return _m.addAttribute(name, cfg, createSerialNum); + } }; struct Fixture : public BaseFixture, public AttributeManagerFixture @@ -263,6 +280,11 @@ struct Fixture : public BaseFixture, public AttributeManagerFixture AttributeManagerFixture(*static_cast<BaseFixture *>(this)) { } + Fixture(const std::shared_ptr<IHwInfo> &hwInfo) + : BaseFixture(hwInfo), + AttributeManagerFixture(*static_cast<BaseFixture *>(this)) + { + } }; @@ -318,7 +340,7 @@ Test::requireThatFlushableAttributeReportsMemoryUsage(void) void -Test::requireThatFlushableAttributeManagesSyncTokenInfo(void) +Test::requireThatFlushableAttributeManagesSyncTokenInfo() { Fixture f; AttributeManager &am = f._m; @@ -386,7 +408,8 @@ Test::requireThatCleanUpIsPerformedAfterFlush(void) EXPECT_TRUE(info.save()); FlushableAttribute fa(av, "flush", TuneFileAttributes(), - f._fileHeaderContext, f._attributeFieldWriter); + f._fileHeaderContext, f._attributeFieldWriter, + f._hwInfo); fa.initFlush(30)->run(); EXPECT_TRUE(info.load()); @@ -536,6 +559,43 @@ Test::requireThatShrinkWorks() EXPECT_EQUAL(100u, av->getCommittedDocIdLimit()); } +void +Test::requireThatFlushedAttributeCanBeLoaded(std::shared_ptr<vespalib::IHwInfo> hwInfo) +{ + constexpr uint32_t numDocs = 100; + BaseFixture f(hwInfo); + vespalib::string attrName(hwInfo->spinningDisk() ? "a11spin" : "a11ssd"); + { + AttributeManagerFixture amf(f); + AttributeManager &am = amf._m; + AttributeVector::SP av = amf.addPostingAttribute(attrName); + IntegerAttribute & ia = static_cast<IntegerAttribute &>(*av); + EXPECT_EQUAL(1, av->getNumDocs()); + av->addDocs(numDocs); + EXPECT_EQUAL(numDocs + 1, av->getNumDocs()); + for (uint32_t i = 0; i < numDocs; ++i) { + ia.update(i + 1, i + 43); + } + av->commit(); + IFlushTarget::SP ft = am.getFlushable(attrName); + ft->initFlush(5)->run(); + } + { + AttributeManagerFixture amf(f); + AttributeVector::SP av = amf.addPostingAttribute(attrName); + EXPECT_EQUAL(numDocs + 1, av->getNumDocs()); + for (uint32_t i = 0; i < numDocs; ++i) { + EXPECT_EQUAL(i + 43, av->getInt(i + 1)); + } + } +} + +void +Test::requireThatFlushedAttributeCanBeLoaded() +{ + TEST_DO(requireThatFlushedAttributeCanBeLoaded(std::make_shared<vespalib::MockHwInfo>(false))); + TEST_DO(requireThatFlushedAttributeCanBeLoaded(std::make_shared<vespalib::MockHwInfo>(true))); +} int Test::Main(void) @@ -555,6 +615,7 @@ Test::Main(void) TEST_DO(requireThatOnlyOneFlusherCanRunAtTheSameTime()); TEST_DO(requireThatLastFlushTimeIsReported()); TEST_DO(requireThatShrinkWorks()); + TEST_DO(requireThatFlushedAttributeCanBeLoaded()); TEST_DONE(); } diff --git a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp index 43eeec6086a..b7089623e97 100644 --- a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp @@ -11,6 +11,7 @@ LOG_SETUP("attributes_state_explorer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> #include <vespa/vespalib/test/insertion_operators.h> +#include <vespa/vespalib/util/mock_hw_info.h> using namespace proton; using namespace proton::test; @@ -26,15 +27,18 @@ struct Fixture DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; AttributeManager::SP _mgr; AttributeManagerExplorer _explorer; Fixture() : _dirHandler(TEST_DIR), _fileHeaderContext(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, - _attributeFieldWriter)), + _attributeFieldWriter, + _hwInfo)), _explorer(_mgr) { addAttribute("regular"); diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index dbd4839732d..8d71bba6841 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -24,6 +24,7 @@ LOG_SETUP("docsummary_test"); #include <vespa/vespalib/tensor/tensor_factory.h> #include <vespa/vespalib/tensor/default_tensor.h> #include <vespa/searchlib/tensor/tensor_attribute.h> +#include <vespa/vespalib/util/mock_hw_info.h> using namespace document; using namespace search; @@ -143,6 +144,7 @@ public: DocumentDBConfig::DocumenttypesConfigSP _documenttypesConfig; const DocumentTypeRepo::SP _repo; TuneFileDocumentDB::SP _tuneFileDocumentDB; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; std::unique_ptr<DocumentDB> _ddb; AttributeWriter::UP _aw; ISummaryAdapter::SP _sa; @@ -161,6 +163,7 @@ public: _documenttypesConfig(new DocumenttypesConfig()), _repo(repo), _tuneFileDocumentDB(new TuneFileDocumentDB()), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _ddb(), _aw(), _sa() @@ -191,7 +194,8 @@ public: ConfigStore::UP(new MemoryConfigStore), std::make_shared<vespalib:: ThreadStackExecutor> - (16, 128 * 1024))), + (16, 128 * 1024), + _hwInfo)), _ddb->start(); _ddb->waitForOnlineState(); _aw = AttributeWriter::UP(new AttributeWriter(_ddb-> diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 114b66f90a8..556e10a7a6c 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -24,6 +24,7 @@ LOG_SETUP("configurer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/transactionlog/nosyncproxy.h> #include <vespa/vespalib/io/fileutil.h> +#include <vespa/vespalib/util/mock_hw_info.h> using namespace config; using namespace document; @@ -93,6 +94,7 @@ struct ViewSet CommitTimeTracker _commitTimeTracker; VarHolder<SearchView::SP> searchView; VarHolder<SearchableFeedView::SP> feedView; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; ViewSet() : _reconfigurer(), _fileHeaderContext(), @@ -107,7 +109,8 @@ struct ViewSet _lidReuseDelayer(), _commitTimeTracker(TimeStamp()), searchView(), - feedView() + feedView(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()) { } @@ -173,7 +176,8 @@ Fixture::initViewSet(ViewSet &views) TuneFileAttributes(), views._fileHeaderContext, views._writeService. - attributeFieldWriter())); + attributeFieldWriter(), + views._hwInfo)); ProtonConfig protonCfg; SummaryManager::SP summaryMgr( new SummaryManager(_summaryExecutor, ProtonConfig::Summary(), @@ -248,6 +252,8 @@ struct MyFastAccessFeedView DummyFileHeaderContext _fileHeaderContext; DocIdLimit _docIdLimit; IThreadingService &_writeService; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; + IDocumentMetaStoreContext::SP _dmsc; std::unique_ptr<documentmetastore::ILidReuseDelayer> _lidReuseDelayer; CommitTimeTracker _commitTimeTracker; @@ -258,6 +264,7 @@ struct MyFastAccessFeedView _fileHeaderContext(), _docIdLimit(0), _writeService(writeService), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _dmsc(), _lidReuseDelayer(), _commitTimeTracker(TimeStamp()), @@ -281,7 +288,8 @@ struct MyFastAccessFeedView TuneFileAttributes(), _fileHeaderContext, _writeService. - attributeFieldWriter())); + attributeFieldWriter(), + _hwInfo)); IAttributeWriter::SP writer(new AttributeWriter(mgr)); FastAccessFeedView::Context fastUpdateCtx(writer, _docIdLimit); _feedView.set(FastAccessFeedView::SP(new FastAccessFeedView(storeOnlyCtx, 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 a5e7aec421b..d72ddc5a2a8 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 @@ -21,6 +21,7 @@ LOG_SETUP("document_subdbs_test"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/util/mock_hw_info.h> #include <iostream> @@ -127,6 +128,7 @@ struct MyStoreOnlyContext MyFileHeaderContext _fileHeader; LegacyDocumentDBMetrics _metrics; vespalib::Lock _configLock; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; StoreOnlyContext _ctx; MyStoreOnlyContext(IThreadingService &writeService, ThreadStackExecutorBase &summaryExecutor, @@ -139,6 +141,7 @@ struct MyStoreOnlyContext _fileHeader(), _metrics(DOCTYPE_NAME, 1), _configLock(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _ctx(_owner, _syncProxy, _getSerialNum, @@ -148,7 +151,8 @@ struct MyStoreOnlyContext bucketDB, bucketDBHandlerInitializer, _metrics, - _configLock) + _configLock, + _hwInfo) { } const MySubDBOwner &getOwner() const { diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index e95e8adc4c8..125127d5af9 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -21,6 +21,7 @@ LOG_SETUP("documentdb_test"); #include <vespa/searchlib/transactionlog/translogserver.h> #include <tests/proton/common/dummydbowner.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/util/mock_hw_info.h> using document::DocumentType; using document::DocumentTypeRepo; @@ -56,6 +57,7 @@ struct Fixture { DummyWireService _dummy; DummyDBOwner _dummyDBOwner; vespalib::ThreadStackExecutor _summaryExecutor; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; DocumentDB::SP _db; DummyFileHeaderContext _fileHeaderContext; TransLogServer _tls; @@ -66,9 +68,16 @@ struct Fixture { }; Fixture::Fixture() - : _summaryExecutor(8, 128*1024), - _tls("tmp", 9014, ".", _fileHeaderContext) { - + : _dummy(), + _dummyDBOwner(), + _summaryExecutor(8, 128*1024), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), + _db(), + _fileHeaderContext(), + _tls("tmp", 9014, ".", _fileHeaderContext), + _queryLimiter(), + _clock() +{ DocumentDBConfig::DocumenttypesConfigSP documenttypesConfig(new DocumenttypesConfig()); DocumentType docType("typea", 0); DocumentTypeRepo::SP repo(new DocumentTypeRepo(docType)); @@ -90,7 +99,8 @@ Fixture::Fixture() _dummyDBOwner, _summaryExecutor, _summaryExecutor, NULL, _dummy, _fileHeaderContext, ConfigStore::UP(new MemoryConfigStore), std::make_shared<vespalib::ThreadStackExecutor> - (16, 128 * 1024))); + (16, 128 * 1024), + _hwInfo)); _db->start(); _db->waitForOnlineState(); } diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 38fe21aed74..cc77eb63c29 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -17,6 +17,7 @@ LOG_SETUP("documentmetastore_test"); #include <vespa/vespalib/util/threadstackexecutor.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/searchcore/proton/server/itlssyncer.h> +#include <vespa/vespalib/util/mock_hw_info.h> using namespace document; using search::AttributeVector; @@ -1832,13 +1833,16 @@ TEST("requireThatShrinkViaFlushTargetWorks") TuneFileAttributes tuneFileAttributes; DummyFileHeaderContext fileHeaderContext; DummyTlsSyncer dummyTlsSyncer; + std::shared_ptr<vespalib::IHwInfo> hwInfo = + std::make_shared<vespalib::MockHwInfo>(); vespalib::rmdir("dmsflush", true); vespalib::mkdir("dmsflush"); IFlushTarget::SP ft(new DocumentMetaStoreFlushTarget(dms, dummyTlsSyncer, "dmsflush", tuneFileAttributes, - fileHeaderContext)); + fileHeaderContext, + hwInfo)); populate(10, *dms); diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index 4670719897a..ebd5107f0a5 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -13,6 +13,7 @@ LOG_SETUP("attribute_reprocessing_initializer_test"); #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/vespalib/test/insertion_operators.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/mock_hw_info.h> #include <vespa/searchlib/common/foregroundtaskexecutor.h> using namespace proton; @@ -52,15 +53,17 @@ struct MyConfig { DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; AttributeManager::SP _mgr; search::index::Schema _schema; MyDocTypeInspector::SP _inspector; MyConfig() : _fileHeaderContext(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, - _attributeFieldWriter)), + _attributeFieldWriter, _hwInfo)), _schema(), _inspector(new MyDocTypeInspector()) { @@ -94,6 +97,7 @@ struct Fixture test::DirectoryHandler _dirHandler; DummyFileHeaderContext _fileHeaderContext; ForegroundTaskExecutor _attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; AttributeManager::SP _mgr; MyConfig _oldCfg; MyConfig _newCfg; @@ -103,9 +107,10 @@ struct Fixture : _dirHandler(TEST_DIR), _fileHeaderContext(), _attributeFieldWriter(), + _hwInfo(std::make_shared<vespalib::MockHwInfo>()), _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext, - _attributeFieldWriter)), + _attributeFieldWriter, _hwInfo)), _initializer(), _handler() { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index f126ab245c1..17c51f6ba58 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -12,6 +12,7 @@ LOG_SETUP(".proton.attribute.attributemanager"); #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/data/fileheader.h> +#include <vespa/vespalib/util/i_hw_info.h> #include <vespa/searchlib/attribute/interlock.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <memory> @@ -58,7 +59,8 @@ AttributeManager::addAttribute(const AttributeWrap &attribute) (new FlushableAttribute(attribute, _baseDir, _tuneFileAttributes, _fileHeaderContext, - _attributeFieldWriter)); + _attributeFieldWriter, + _hwInfo)); _writableAttributes.push_back(attribute.get()); } } @@ -177,7 +179,8 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, const TuneFileAttributes &tuneFileAttributes, const FileHeaderContext &fileHeaderContext, search::ISequencedTaskExecutor & - attributeFieldWriter) + attributeFieldWriter, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : proton::IAttributeManager(), _attributes(), _flushables(), @@ -188,7 +191,8 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, _fileHeaderContext(fileHeaderContext), _factory(new AttributeFactory()), _interlock(std::make_shared<search::attribute::Interlock>()), - _attributeFieldWriter(attributeFieldWriter) + _attributeFieldWriter(attributeFieldWriter), + _hwInfo(hwInfo) { createBaseDir(); } @@ -200,7 +204,8 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, const search::common::FileHeaderContext &fileHeaderContext, search::ISequencedTaskExecutor & attributeFieldWriter, - const IAttributeFactory::SP &factory) + const IAttributeFactory::SP &factory, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : proton::IAttributeManager(), _attributes(), _flushables(), @@ -211,7 +216,8 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir, _fileHeaderContext(fileHeaderContext), _factory(factory), _interlock(std::make_shared<search::attribute::Interlock>()), - _attributeFieldWriter(attributeFieldWriter) + _attributeFieldWriter(attributeFieldWriter), + _hwInfo(hwInfo) { createBaseDir(); } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h index 15d1c25bbc0..5dad0ca0cef 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h @@ -12,6 +12,8 @@ #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchcommon/common/schema.h> +namespace vespalib { class IHwInfo; } + namespace search { @@ -64,6 +66,7 @@ private: IAttributeFactory::SP _factory; std::shared_ptr<search::attribute::Interlock> _interlock; search::ISequencedTaskExecutor &_attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; search::AttributeVector::SP internalAddAttribute(const vespalib::string &name, const Config &cfg, @@ -100,7 +103,8 @@ public: const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, - search::ISequencedTaskExecutor &attributeFieldWriter); + search::ISequencedTaskExecutor &attributeFieldWriter, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); AttributeManager(const vespalib::string &baseDir, const vespalib::string &documentSubDbName, @@ -108,7 +112,8 @@ public: const search::common::FileHeaderContext & fileHeaderContext, search::ISequencedTaskExecutor &attributeFieldWriter, - const IAttributeFactory::SP &factory); + const IAttributeFactory::SP &factory, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); AttributeManager(const AttributeManager &currMgr, const Spec &newSpec, diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index f834ce64c67..d84f44d5ffd 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -12,6 +12,7 @@ LOG_SETUP(".proton.attribute.flushableattribute"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/closuretask.h> +#include <vespa/vespalib/util/i_hw_info.h> #include <fstream> #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> @@ -73,16 +74,24 @@ FlushableAttribute::Flusher::saveAttribute() vespalib::mkdir(_flushFile.getDirName(), false); SerialNumFileHeaderContext fileHeaderContext(_fattr._fileHeaderContext, _syncToken); - if (_saver) { - search::AttributeFileSaveTarget saveTarget(_fattr._tuneFileAttributes, - fileHeaderContext); - bool saveSuccess = _saver->save(saveTarget); + bool saveSuccess = true; + if (_saver && _saver->hasGenerationGuard() && + _fattr._hwInfo->spinningDisk()) { + saveSuccess = _saver->save(_saveTarget); _saver.reset(); - return saveSuccess; - } else { - return _saveTarget.writeToFile(_fattr._tuneFileAttributes, - fileHeaderContext); } + if (saveSuccess) { + if (_saver) { + search::AttributeFileSaveTarget saveTarget(_fattr._tuneFileAttributes, + fileHeaderContext); + saveSuccess = _saver->save(saveTarget); + _saver.reset(); + } else { + saveSuccess = _saveTarget.writeToFile(_fattr._tuneFileAttributes, + fileHeaderContext); + } + } + return saveSuccess; } bool @@ -161,7 +170,8 @@ FlushableAttribute::FlushableAttribute(const AttributeVector::SP attr, const FileHeaderContext & fileHeaderContext, search::ISequencedTaskExecutor & - attributeFieldWriter) + attributeFieldWriter, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : IFlushTarget(vespalib::make_string( "attribute.%s", attr->getName().c_str()), @@ -177,7 +187,8 @@ FlushableAttribute::FlushableAttribute(const AttributeVector::SP attr, _tuneFileAttributes(tuneFileAttributes), _fileHeaderContext(fileHeaderContext), _lastFlushTime(), - _attributeFieldWriter(attributeFieldWriter) + _attributeFieldWriter(attributeFieldWriter), + _hwInfo(hwInfo) { if (!_snapInfo.load()) { _snapInfo.save(); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h index 1ae64e745ca..a400176ec3e 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h @@ -8,6 +8,8 @@ #include <vespa/searchlib/common/indexmetainfo.h> +namespace vespalib { class IHwInfo; } + namespace search { @@ -75,6 +77,7 @@ private: const search::common::FileHeaderContext &_fileHeaderContext; fastos::TimeStamp _lastFlushTime; search::ISequencedTaskExecutor &_attributeFieldWriter; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; Task::UP internalInitFlush(SerialNum currentSerial); @@ -92,7 +95,8 @@ public: const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & fileHeaderContext, - search::ISequencedTaskExecutor &attributeFieldWriter); + search::ISequencedTaskExecutor &attributeFieldWriter, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); virtual ~FlushableAttribute(); diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp index 4768b847fd4..40ecd54314d 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp @@ -6,12 +6,14 @@ LOG_SETUP(".proton.documentmetastore.documentmetastoreflushtarget"); #include <vespa/searchcore/proton/attribute/attributedisklayout.h> #include "documentmetastoreflushtarget.h" #include <vespa/searchlib/attribute/attributefilesavetarget.h> +#include <vespa/searchlib/attribute/attributememorysavetarget.h> #include <vespa/searchlib/attribute/attributesaver.h> #include <vespa/searchlib/util/dirtraverse.h> #include <vespa/searchlib/util/filekit.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/closuretask.h> +#include <vespa/vespalib/util/i_hw_info.h> #include <fstream> #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchcore/proton/server/itlssyncer.h> @@ -64,6 +66,30 @@ DocumentMetaStoreFlushTarget::Flusher::saveSnapInfo() } bool +DocumentMetaStoreFlushTarget::Flusher::saveDocumentMetaStore() +{ + vespalib::mkdir(_flushDir, false); + SerialNumFileHeaderContext fileHeaderContext(_dmsft._fileHeaderContext, + _syncToken); + bool saveSuccess = false; + if (_dmsft._hwInfo->spinningDisk()) { + search::AttributeMemorySaveTarget memorySaveTarget; + saveSuccess = _saver->save(memorySaveTarget); + _saver.reset(); + if (saveSuccess) { + saveSuccess = memorySaveTarget.writeToFile(_dmsft._tuneFileAttributes, + fileHeaderContext); + } + } else { + search::AttributeFileSaveTarget saveTarget(_dmsft._tuneFileAttributes, + fileHeaderContext); + saveSuccess = _saver->save(saveTarget); + _saver.reset(); + } + return saveSuccess; +} + +bool DocumentMetaStoreFlushTarget::Flusher::flush() { IndexMetaInfo::Snapshot newSnap(false, _syncToken, @@ -75,20 +101,11 @@ DocumentMetaStoreFlushTarget::Flusher::flush() if (!saveSnapInfo()) { return false; } - vespalib::mkdir(_flushDir, false); - vespalib::string flushFile(_flushDir + "/" + _dmsft._dms->getName()); - - SerialNumFileHeaderContext fileHeaderContext(_dmsft._fileHeaderContext, - _syncToken); - search::AttributeFileSaveTarget saveTarget(_dmsft._tuneFileAttributes, - fileHeaderContext); - if (!_saver->save(saveTarget)) { + if (!saveDocumentMetaStore()) { LOG(warning, "Could not write document meta store '%s' to disk", _dmsft._dms->getBaseFileName().c_str()); - _saver.reset(); return false; } - _saver.reset(); /* * Sync transaction log again. This is needed when background * flush is activated to ensure that same future will occur that has @@ -152,7 +169,8 @@ DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, ITlsSyncer &tlsSyncer, const vespalib::string & baseDir, const TuneFileAttributes &tuneFileAttributes, - const FileHeaderContext &fileHeaderContext) + const FileHeaderContext &fileHeaderContext, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : IFlushTarget("documentmetastore", Type::SYNC, Component::ATTRIBUTE), _dms(dms), _tlsSyncer(tlsSyncer), @@ -164,7 +182,8 @@ DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, _lastStats(), _tuneFileAttributes(tuneFileAttributes), _fileHeaderContext(fileHeaderContext), - _lastFlushTime() + _lastFlushTime(), + _hwInfo(hwInfo) { if (!_snapInfo.load()) { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h index b3851149412..66b7da80697 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h @@ -8,6 +8,8 @@ #include <vespa/searchlib/common/tunefileinfo.h> #include "documentmetastore.h" +namespace vespalib { class IHwInfo; } + namespace search { @@ -43,6 +45,8 @@ private: std::unique_ptr<search::AttributeSaver> _saver; uint64_t _syncToken; vespalib::string _flushDir; + + bool saveDocumentMetaStore(); // not updating snap info. public: Flusher(DocumentMetaStoreFlushTarget &dmsft, uint64_t syncToken); ~Flusher(); @@ -72,6 +76,7 @@ private: const search::TuneFileAttributes _tuneFileAttributes; const search::common::FileHeaderContext &_fileHeaderContext; fastos::TimeStamp _lastFlushTime; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; static vespalib::string getSnapshotName(uint64_t syncToken); @@ -92,7 +97,8 @@ public: const search::TuneFileAttributes & tuneFileAttributes, const search::common::FileHeaderContext & - fileHeaderContext); + fileHeaderContext, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); virtual ~DocumentMetaStoreFlushTarget(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 1e15f68d7ab..2dfe50da10f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -87,7 +87,8 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, MetricsWireService &metricsWireService, const FileHeaderContext &fileHeaderContext, ConfigStore::UP config_store, - InitializeThreads initializeThreads) + InitializeThreads initializeThreads, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : IDocumentDBConfigOwner(), IReplayConfig(), FeedHandler::IOwner(), @@ -152,7 +153,8 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, clock, _configLock, _baseDir, - protonCfg), + protonCfg, + hwInfo), _maintenanceController(_writeService.master(), _docTypeName), _visibility(_feedHandler, _writeService, _feedView), _lidSpaceCompactionHandlers(), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 2af766d0f41..5bf8bfebf41 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -41,6 +41,8 @@ using vespa::config::search::core::ProtonConfig; +namespace vespalib { class IHwInfo; } + namespace search { @@ -270,7 +272,8 @@ public: MetricsWireService &metricsWireService, const search::common::FileHeaderContext &fileHeaderContext, ConfigStore::UP config_store, - InitializeThreads initializeThreads); + InitializeThreads initializeThreads, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); /** * Expose a cost view of the session manager. This is used by the diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index f6fda5c0df7..643cfe7d87f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -38,7 +38,8 @@ DocumentSubDBCollection::DocumentSubDBCollection( const vespalib::Clock &clock, vespalib::Lock &configLock, const vespalib::string &baseDir, - const ProtonConfig &protonCfg) + const ProtonConfig &protonCfg, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : _subDBs(), _calc(), _readySubDbId(0), @@ -68,7 +69,8 @@ DocumentSubDBCollection::DocumentSubDBCollection( _bucketDB, *_bucketDBHandler, metrics, - configLock); + configLock, + hwInfo); _subDBs.push_back (new SearchableDocSubDB (SearchableDocSubDB::Config(FastAccessDocSubDB::Config diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index c0aea4804c8..1ed63648702 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -16,6 +16,8 @@ #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> #include <vespa/searchcore/proton/initializer/initializer_task.h> +namespace vespalib { class IHwInfo; } + namespace proton { class DocumentDBConfig; class LegacyDocumentDBMetrics; @@ -59,7 +61,8 @@ public: const vespalib::Clock &clock, vespalib::Lock &configLock, const vespalib::string &baseDir, - const vespa::config::search::core::ProtonConfig &protonCfg); + const vespa::config::search::core::ProtonConfig &protonCfg, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo); ~DocumentSubDBCollection(); void setBucketStateCalculator(const IBucketStateCalculator::SP &calc) { diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp index cb8abd1cfd9..2713c571dbf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp @@ -73,7 +73,8 @@ FastAccessDocSubDB::createAttributeManagerInitializer(const DocumentDBConfig &co configSnapshot.getTuneFileDocumentDBSP()->_attr, _fileHeaderContext, _writeService.attributeFieldWriter(), - attrFactory); + attrFactory, + _hwInfo); return std::make_shared<AttributeManagerInitializer>(configSerialNum, documentMetaStoreInitTask, documentMetaStore, diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index b48ba6e50e0..81abec94a8a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -34,6 +34,7 @@ LOG_SETUP(".proton.server.proton"); #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/random.h> +#include <vespa/vespalib/util/hw_info.h> using document::DocumentTypeRepo; using vespalib::FileHeader; @@ -208,7 +209,8 @@ Proton::Proton(const config::ConfigUri & configUri, _abortInit(false), _initStarted(false), _initComplete(false), - _initDocumentDbsInSequence(false) + _initDocumentDbsInSequence(false), + _hwInfo(std::make_shared<vespalib::HwInfo>()) { } @@ -733,7 +735,8 @@ Proton::addDocumentDB(const document::DocumentType &docType, *_metricsEngine, _fileHeaderContext, std::move(config_store), - initializeThreads)); + initializeThreads, + _hwInfo)); _protonConfigurer.registerDocumentDB(docTypeName, ret.get()); try { ret->start(); diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index c9e70e60d09..f422edd00c1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -32,6 +32,8 @@ #include <vespa/vespalib/util/rwlock.h> #include <vespa/vespalib/util/varholder.h> +namespace vespalib { class IHwInfo; } + namespace proton { @@ -140,6 +142,7 @@ private: bool _initStarted; bool _initComplete; bool _initDocumentDbsInSequence; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; bool performDataDirectoryUpgrade(const vespalib::string &baseDir); void loadLibrary(const vespalib::string &libName); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index fd89a34250d..c6d827359e5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -84,6 +84,7 @@ StoreOnlyDocSubDB::StoreOnlyDocSubDB(const Config &cfg, _iSearchView(), _iFeedView(), _configLock(ctx._configLock), + _hwInfo(ctx._hwInfo), _getSerialNum(ctx._getSerialNum), _tlsSyncer(ctx._writeService.master(), ctx._getSerialNum, ctx._tlSyncer), _dmsFlushTarget(), @@ -242,7 +243,7 @@ StoreOnlyDocSubDB::setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP _tlsSyncer, baseDir, dmsResult->tuneFile(), - _fileHeaderContext)); + _fileHeaderContext, _hwInfo)); } DocumentSubDbInitializer::UP diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index bee288b7cc0..0b2b46368dc 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -23,6 +23,8 @@ #include <vespa/vespalib/util/varholder.h> +namespace vespalib { class IHwInfo; } + namespace proton { @@ -147,6 +149,7 @@ public: bucketdb::IBucketDBHandlerInitializer &_bucketDBHandlerInitializer; LegacyDocumentDBMetrics &_metrics; vespalib::Lock &_configLock; + const std::shared_ptr<vespalib::IHwInfo> &_hwInfo; Context(IDocumentSubDB::IOwner &owner, search::transactionlog::SyncProxy &tlSyncer, @@ -158,7 +161,8 @@ public: bucketdb::IBucketDBHandlerInitializer & bucketDBHandlerInitializer, LegacyDocumentDBMetrics &metrics, - vespalib::Lock &configLock) + vespalib::Lock &configLock, + const std::shared_ptr<vespalib::IHwInfo> &hwInfo) : _owner(owner), _tlSyncer(tlSyncer), _getSerialNum(getSerialNum), @@ -168,7 +172,8 @@ public: _bucketDB(bucketDB), _bucketDBHandlerInitializer(bucketDBHandlerInitializer), _metrics(metrics), - _configLock(configLock) + _configLock(configLock), + _hwInfo(hwInfo) { } }; @@ -199,6 +204,7 @@ protected: vespalib::VarHolder<ISearchHandler::SP> _iSearchView; vespalib::VarHolder<IFeedView::SP> _iFeedView; vespalib::Lock &_configLock; + std::shared_ptr<vespalib::IHwInfo> _hwInfo; private: const IGetSerialNum &_getSerialNum; TlsSyncer _tlsSyncer; |