aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-06-25 14:20:58 +0000
committerGeir Storli <geirst@verizonmedia.com>2020-06-25 15:53:38 +0000
commit4350799ad50b3377d07857838fab9aac3926b8e4 (patch)
tree222c6107ba9e99eb9161605578a5057fc623421d /searchcore
parent7b864b8806d4a38dab619c5c24c9fa232a835a75 (diff)
Expose the shared executor via attribute manager interface.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp40
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp19
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_test.cpp4
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp5
-rw-r--r--searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp12
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp4
-rw-r--r--searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h13
14 files changed, 95 insertions, 52 deletions
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 407b14c5f7d..c222bf4e18f 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
@@ -1,6 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
#include <vespa/config-attributes.h>
#include <vespa/fastos/file.h>
+#include <vespa/searchcommon/attribute/i_attribute_functor.h>
#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h>
#include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h>
@@ -9,24 +11,22 @@
#include <vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/attribute/sequential_attributes_initializer.h>
-#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
+#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchcore/proton/initializer/initializer_task.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
#include <vespa/searchcore/proton/server/executor_thread_service.h>
#include <vespa/searchcore/proton/test/attribute_utils.h>
#include <vespa/searchcore/proton/test/attribute_vectors.h>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/attributefactory.h>
-#include <vespa/searchcommon/attribute/i_attribute_functor.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
-#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/imported_attribute_vector.h>
#include <vespa/searchlib/attribute/imported_attribute_vector_factory.h>
#include <vespa/searchlib/attribute/predicate_attribute.h>
#include <vespa/searchlib/attribute/reference_attribute.h>
#include <vespa/searchlib/attribute/singlenumericattribute.hpp>
-#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/searchlib/common/indexmetainfo.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/predicate/predicate_index.h>
@@ -34,6 +34,7 @@
#include <vespa/searchlib/test/directory_handler.h>
#include <vespa/searchlib/test/mock_gid_to_lid_mapping.h>
#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
@@ -152,15 +153,21 @@ struct BaseFixture
DirectoryHandler _dirHandler;
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
BaseFixture();
~BaseFixture();
+ proton::AttributeManager::SP make_manager() {
+ return std::make_shared<proton::AttributeManager>(test_dir, "test.subdb", TuneFileAttributes(),
+ _fileHeaderContext, _attributeFieldWriter, _shared, _hwInfo);
+ }
};
BaseFixture::BaseFixture()
: _dirHandler(test_dir),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo()
{
}
@@ -185,8 +192,7 @@ struct AttributeManagerFixture
};
AttributeManagerFixture::AttributeManagerFixture(BaseFixture &bf)
- : _msp(std::make_shared<proton::AttributeManager>(test_dir, "test.subdb", TuneFileAttributes(),
- bf._fileHeaderContext, bf._attributeFieldWriter, bf._hwInfo)),
+ : _msp(bf.make_manager()),
_m(*_msp),
_builder()
{}
@@ -503,11 +509,7 @@ TEST_F("require that new attributes after reconfig are initialized", Fixture)
TEST_F("require that removed attributes cannot resurrect", BaseFixture)
{
- proton::AttributeManager::SP am1(
- new proton::AttributeManager(test_dir, "test.subdb",
- TuneFileAttributes(),
- f._fileHeaderContext,
- f._attributeFieldWriter, f._hwInfo));
+ auto am1 = f.make_manager();
{
AttributeVector::SP a1 = am1->addAttribute({"a1", INT32_SINGLE}, 0);
fillAttribute(a1, 2, 10, 15);
@@ -801,9 +803,7 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture)
predicateParams2.setArity(4);
predicate2.setPredicateParams(predicateParams2);
- auto am1(std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo));
+ auto am1 = f.make_manager();
am1->addAttribute({"a1", INT32_SINGLE}, 1);
am1->addAttribute({"a2", INT32_SINGLE}, 2);
am1->addAttribute({"a3", generic_tensor}, 3);
@@ -840,17 +840,13 @@ void assertShrinkTargetSerial(proton::AttributeManager &mgr, const vespalib::str
TEST_F("require that we can guess flushed serial number for shrink flushtarget", BaseFixture)
{
- auto am1(std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo));
+ auto am1 = f.make_manager();
am1->addAttribute({"a1", INT32_SINGLE}, 1);
am1->addAttribute({"a2", INT32_SINGLE}, 2);
TEST_DO(assertShrinkTargetSerial(*am1, "a1", 0));
TEST_DO(assertShrinkTargetSerial(*am1, "a2", 1));
am1->flushAll(10);
- am1 = std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo);
+ am1 = f.make_manager();
am1->addAttribute({"a1", INT32_SINGLE}, 1);
am1->addAttribute({"a2", INT32_SINGLE}, 2);
TEST_DO(assertShrinkTargetSerial(*am1, "a1", 10));
@@ -859,9 +855,7 @@ TEST_F("require that we can guess flushed serial number for shrink flushtarget",
TEST_F("require that shrink flushtarget is handed over to new attribute manager", BaseFixture)
{
- auto am1(std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo));
+ auto am1 = f.make_manager();
am1->addAttribute({"a1", INT32_SINGLE}, 4);
AttrSpecList newSpec;
newSpec.push_back(AttributeSpec("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 788aa4fb1ee..4951d0e3ed3 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
@@ -1,19 +1,21 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("attribute_populator_test");
-#include <vespa/vespalib/testkit/testapp.h>
-#include <vespa/document/repo/configbuilder.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
+#include <vespa/document/repo/configbuilder.h>
#include <vespa/searchcore/proton/attribute/attribute_populator.h>
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/test/test.h>
-#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/test/directory_handler.h>
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/log/log.h>
+LOG_SETUP("attribute_populator_test");
+
using document::config_builder::DocumenttypesConfigBuilderHelper;
using document::config_builder::Struct;
using vespalib::ForegroundTaskExecutor;
@@ -62,6 +64,7 @@ struct Fixture
DirectoryHandler _testDir;
DummyFileHeaderContext _fileHeader;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
AttributeManager::SP _mgr;
std::unique_ptr<AttributePopulator> _pop;
@@ -70,10 +73,10 @@ struct Fixture
: _testDir(TEST_DIR),
_fileHeader(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(),
- _mgr(new AttributeManager(TEST_DIR, "test.subdb",
- TuneFileAttributes(),
- _fileHeader, _attributeFieldWriter, _hwInfo)),
+ _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(),
+ _fileHeader, _attributeFieldWriter, _shared, _hwInfo)),
_pop(),
_ctx()
{
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp
index dabab649497..3c128e35d08 100644
--- a/searchcore/src/tests/proton/attribute/attribute_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp
@@ -44,6 +44,7 @@
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/vespalib/util/sequencedtaskexecutorobserver.h>
+#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
LOG_SETUP("attribute_test");
@@ -573,6 +574,7 @@ public:
DirectoryHandler _dirHandler;
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
proton::AttributeManager::SP _baseMgr;
FilterAttributeManager _filterMgr;
@@ -581,11 +583,13 @@ public:
: _dirHandler(test_dir),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(),
_baseMgr(new proton::AttributeManager(test_dir, "test.subdb",
TuneFileAttributes(),
_fileHeaderContext,
_attributeFieldWriter,
+ _shared,
_hwInfo)),
_filterMgr(ACCEPTED_ATTRIBUTES, _baseMgr)
{
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
index 4604129248b..09030be63ae 100644
--- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
@@ -246,6 +246,7 @@ struct BaseFixture
test::DirectoryHandler _dirHandler;
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
BaseFixture();
BaseFixture(const HwInfo &hwInfo);
@@ -256,12 +257,14 @@ BaseFixture::BaseFixture()
: _dirHandler(test_dir),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo()
{ }
BaseFixture::BaseFixture(const HwInfo &hwInfo)
: _dirHandler(test_dir),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(hwInfo)
{}
BaseFixture::~BaseFixture() = default;
@@ -289,7 +292,7 @@ struct AttributeManagerFixture
AttributeManagerFixture::AttributeManagerFixture(BaseFixture &bf)
: _msp(std::make_shared<AttributeManager>(test_dir, "test.subdb", TuneFileAttributes(),
- bf._fileHeaderContext, bf._attributeFieldWriter, bf._hwInfo)),
+ bf._fileHeaderContext, bf._attributeFieldWriter, bf._shared, bf._hwInfo)),
_m(*_msp)
{}
AttributeManagerFixture::~AttributeManagerFixture() = default;
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 01452f1361e..87473f3da97 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
@@ -1,16 +1,17 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchcore/proton/attribute/attribute_manager_explorer.h>
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/common/hw_info.h>
-#include <vespa/searchcore/proton/test/attribute_vectors.h>
#include <vespa/searchcore/proton/test/attribute_utils.h>
-#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/searchcore/proton/test/attribute_vectors.h>
+#include <vespa/searchlib/attribute/singlenumericattribute.hpp>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/test/directory_handler.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/searchlib/attribute/singlenumericattribute.hpp>
+#include <vespa/vespalib/testkit/testapp.h>
+#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
LOG_SETUP("attributes_state_explorer_test");
@@ -30,6 +31,7 @@ struct Fixture
DirectoryHandler _dirHandler;
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
AttributeManager::SP _mgr;
AttributeManagerExplorer _explorer;
@@ -37,10 +39,12 @@ struct Fixture
: _dirHandler(TEST_DIR),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(),
_mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(),
_fileHeaderContext,
_attributeFieldWriter,
+ _shared,
_hwInfo)),
_explorer(_mgr)
{
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 89930a6b1a3..15f7d5798ea 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -192,7 +192,7 @@ Fixture::initViewSet(ViewSet &views)
views._reconfigurer, views._writeService, _summaryExecutor,
TuneFileIndexManager(), TuneFileAttributes(), views._fileHeaderContext);
auto attrMgr = make_shared<AttributeManager>(BASE_DIR, "test.subdb", TuneFileAttributes(), views._fileHeaderContext,
- views._writeService.attributeFieldWriter(),views._hwInfo);
+ views._writeService.attributeFieldWriter(), views._writeService.shared(), views._hwInfo);
auto summaryMgr = make_shared<SummaryManager>
(_summaryExecutor, search::LogDocumentStore::Config(), search::GrowStrategy(), BASE_DIR, views._docTypeName,
TuneFileSummary(), views._fileHeaderContext,views._noTlSyncer, search::IBucketizer::SP());
@@ -273,7 +273,7 @@ struct MyFastAccessFeedView
_writeService, *_lidReuseDelayer, _commitTimeTracker);
StoreOnlyFeedView::PersistentParams params(1, 1, DocTypeName(DOC_TYPE), 0, SubDbType::NOTREADY);
auto mgr = make_shared<AttributeManager>(BASE_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext,
- _writeService.attributeFieldWriter(), _hwInfo);
+ _writeService.attributeFieldWriter(), _writeService.shared(), _hwInfo);
IAttributeWriter::SP writer(new AttributeWriter(mgr));
FastAccessFeedView::Context fastUpdateCtx(writer, _docIdLimit);
_feedView.set(FastAccessFeedView::SP(new FastAccessFeedView(storeOnlyCtx, params, fastUpdateCtx)));;
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 898825016b3..06c01914c8d 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
@@ -11,11 +11,12 @@
#include <vespa/searchcore/proton/reprocessing/i_reprocessing_handler.h>
#include <vespa/searchcore/proton/test/attribute_utils.h>
#include <vespa/searchlib/attribute/attributefactory.h>
-#include <vespa/vespalib/util/foregroundtaskexecutor.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/test/directory_handler.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <vespa/vespalib/util/foregroundtaskexecutor.h>
+#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/log/log.h>
LOG_SETUP("attribute_reprocessing_initializer_test");
@@ -54,6 +55,7 @@ struct MyConfig
{
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
AttributeManager::SP _mgr;
search::index::Schema _schema;
@@ -87,10 +89,10 @@ struct MyConfig
MyConfig::MyConfig()
: _fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(),
_mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(),
- _fileHeaderContext,
- _attributeFieldWriter, _hwInfo)),
+ _fileHeaderContext, _attributeFieldWriter, _shared, _hwInfo)),
_schema()
{}
MyConfig::~MyConfig() = default;
@@ -132,6 +134,7 @@ public:
DirectoryHandler _dirHandler;
DummyFileHeaderContext _fileHeaderContext;
ForegroundTaskExecutor _attributeFieldWriter;
+ vespalib::ThreadStackExecutor _shared;
HwInfo _hwInfo;
AttributeManager::SP _mgr;
MyConfig _oldCfg;
@@ -143,10 +146,10 @@ public:
: _dirHandler(TEST_DIR),
_fileHeaderContext(),
_attributeFieldWriter(),
+ _shared(1, 128 * 1024),
_hwInfo(),
- _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(),
- _fileHeaderContext,
- _attributeFieldWriter, _hwInfo)),
+ _mgr(new AttributeManager(TEST_DIR, "test.subdb", TuneFileAttributes(), _fileHeaderContext,
+ _attributeFieldWriter, _shared, _hwInfo)),
_oldCfg(),
_newCfg(),
_inspector(_oldCfg, _newCfg),
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index b5937438a9f..504f6841daf 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -225,6 +225,7 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir,
const TuneFileAttributes &tuneFileAttributes,
const FileHeaderContext &fileHeaderContext,
vespalib::ISequencedTaskExecutor &attributeFieldWriter,
+ vespalib::ThreadExecutor& shared_executor,
const HwInfo &hwInfo)
: proton::IAttributeManager(),
_attributes(),
@@ -237,17 +238,18 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir,
_factory(std::make_shared<AttributeFactory>()),
_interlock(std::make_shared<search::attribute::Interlock>()),
_attributeFieldWriter(attributeFieldWriter),
+ _shared_executor(shared_executor),
_hwInfo(hwInfo),
_importedAttributes()
{
}
-
AttributeManager::AttributeManager(const vespalib::string &baseDir,
const vespalib::string &documentSubDbName,
const search::TuneFileAttributes &tuneFileAttributes,
const search::common::FileHeaderContext &fileHeaderContext,
vespalib::ISequencedTaskExecutor &attributeFieldWriter,
+ vespalib::ThreadExecutor& shared_executor,
const IAttributeFactory::SP &factory,
const HwInfo &hwInfo)
: proton::IAttributeManager(),
@@ -261,6 +263,7 @@ AttributeManager::AttributeManager(const vespalib::string &baseDir,
_factory(factory),
_interlock(std::make_shared<search::attribute::Interlock>()),
_attributeFieldWriter(attributeFieldWriter),
+ _shared_executor(shared_executor),
_hwInfo(hwInfo),
_importedAttributes()
{
@@ -280,6 +283,7 @@ AttributeManager::AttributeManager(const AttributeManager &currMgr,
_factory(currMgr._factory),
_interlock(currMgr._interlock),
_attributeFieldWriter(currMgr._attributeFieldWriter),
+ _shared_executor(currMgr._shared_executor),
_hwInfo(currMgr._hwInfo),
_importedAttributes()
{
@@ -539,6 +543,11 @@ AttributeManager::getAttributeFieldWriter() const
return _attributeFieldWriter;
}
+vespalib::ThreadExecutor&
+AttributeManager::get_shared_executor() const
+{
+ return _shared_executor;
+}
AttributeVector *
AttributeManager::getWritableAttribute(const vespalib::string &name) const
@@ -550,14 +559,12 @@ AttributeManager::getWritableAttribute(const vespalib::string &name) const
return itr->second.getAttribute().get();
}
-
const std::vector<AttributeVector *> &
AttributeManager::getWritableAttributes() const
{
return _writableAttributes;
}
-
void
AttributeManager::asyncForEachAttribute(std::shared_ptr<IConstAttributeFunctor> func) const
{
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
index 350b986add4..10c017c84d3 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
@@ -17,6 +17,8 @@ namespace search::common { class FileHeaderContext; }
namespace searchcorespi { class IFlushTarget; }
+namespace vespalib { class ThreadExecutor; }
+
namespace proton {
class AttributeDiskLayout;
@@ -78,6 +80,7 @@ private:
IAttributeFactory::SP _factory;
std::shared_ptr<search::attribute::Interlock> _interlock;
vespalib::ISequencedTaskExecutor &_attributeFieldWriter;
+ vespalib::ThreadExecutor& _shared_executor;
HwInfo _hwInfo;
std::unique_ptr<ImportedAttributesRepo> _importedAttributes;
@@ -104,6 +107,7 @@ public:
const search::TuneFileAttributes &tuneFileAttributes,
const search::common::FileHeaderContext & fileHeaderContext,
vespalib::ISequencedTaskExecutor &attributeFieldWriter,
+ vespalib::ThreadExecutor& shared_executor,
const HwInfo &hwInfo);
AttributeManager(const vespalib::string &baseDir,
@@ -111,6 +115,7 @@ public:
const search::TuneFileAttributes &tuneFileAttributes,
const search::common::FileHeaderContext & fileHeaderContext,
vespalib::ISequencedTaskExecutor &attributeFieldWriter,
+ vespalib::ThreadExecutor& shared_executor,
const IAttributeFactory::SP &factory,
const HwInfo &hwInfo);
@@ -166,6 +171,8 @@ public:
vespalib::ISequencedTaskExecutor &getAttributeFieldWriter() const override;
+ vespalib::ThreadExecutor& get_shared_executor() const override;
+
search::AttributeVector *getWritableAttribute(const vespalib::string &name) const override;
const std::vector<search::AttributeVector *> &getWritableAttributes() const override;
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 90d0c0cab3d..3b1269b031c 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
@@ -161,13 +161,17 @@ FilterAttributeManager::getFlushedSerialNum(const vespalib::string &name) const
return 0;
}
-
vespalib::ISequencedTaskExecutor &
FilterAttributeManager::getAttributeFieldWriter() const
{
return _mgr->getAttributeFieldWriter();
}
+vespalib::ThreadExecutor&
+FilterAttributeManager::get_shared_executor() const
+{
+ return _mgr->get_shared_executor();
+}
search::AttributeVector *
FilterAttributeManager::getWritableAttribute(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 b183f7ed3b3..0b478a34144 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h
@@ -47,6 +47,7 @@ public:
void pruneRemovedFields(search::SerialNum serialNum) override;
const IAttributeFactory::SP &getFactory() const override;
vespalib::ISequencedTaskExecutor & getAttributeFieldWriter() const override;
+ vespalib::ThreadExecutor& get_shared_executor() const override;
search::AttributeVector * getWritableAttribute(const vespalib::string &name) const override;
const std::vector<search::AttributeVector *> & getWritableAttributes() const override;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
index 25d0a508438..fa5c52617fd 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_manager.h
@@ -14,7 +14,10 @@ namespace search { class IDestructorCallback;}
namespace search::attribute { class IAttributeFunctor; }
-namespace vespalib { class ISequencedTaskExecutor; }
+namespace vespalib {
+ class ISequencedTaskExecutor;
+ class ThreadExecutor;
+}
namespace proton {
@@ -74,6 +77,8 @@ struct IAttributeManager : public search::IAttributeManager
virtual vespalib::ISequencedTaskExecutor &getAttributeFieldWriter() const = 0;
+ virtual vespalib::ThreadExecutor& get_shared_executor() const = 0;
+
/*
* Get pointer to named writable attribute. If attribute isn't
* found or is an extra attribute then nullptr is returned.
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 542923043ef..063561347b4 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
@@ -69,6 +69,7 @@ FastAccessDocSubDB::createAttributeManagerInitializer(const DocumentDBConfig &co
configSnapshot.getTuneFileDocumentDBSP()->_attr,
_fileHeaderContext,
_writeService.attributeFieldWriter(),
+ _writeService.shared(),
attrFactory,
_hwInfo);
return std::make_shared<AttributeManagerInitializer>(configSerialNum,
diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h
index 8e5d3018532..3c301e66057 100644
--- a/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/test/mock_attribute_manager.h
@@ -14,13 +14,15 @@ private:
std::vector<search::AttributeVector*> _writables;
std::unique_ptr<ImportedAttributesRepo> _importedAttributes;
vespalib::ISequencedTaskExecutor* _writer;
+ vespalib::ThreadExecutor* _shared;
public:
MockAttributeManager()
: _mock(),
_writables(),
_importedAttributes(),
- _writer()
+ _writer(),
+ _shared()
{}
search::AttributeVector::SP addAttribute(const vespalib::string &name, const search::AttributeVector::SP &attr) {
@@ -28,11 +30,12 @@ public:
_writables.push_back(attr.get());
return attr;
}
-
void set_writer(vespalib::ISequencedTaskExecutor& writer) {
_writer = &writer;
}
-
+ void set_shared_executor(vespalib::ThreadExecutor& shared) {
+ _shared = &shared;
+ }
search::AttributeGuard::UP getAttribute(const vespalib::string &name) const override {
return _mock.getAttribute(name);
}
@@ -69,6 +72,10 @@ public:
assert(_writer != nullptr);
return *_writer;
}
+ vespalib::ThreadExecutor& get_shared_executor() const override {
+ assert(_shared != nullptr);
+ return *_shared;
+ }
search::AttributeVector *getWritableAttribute(const vespalib::string &name) const override {
auto attr = getAttribute(name);
if (attr) {