aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-20 21:24:22 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-02-20 23:46:18 +0000
commit1bb2800fb1bf312689115a7230b1d3ead74d4ac6 (patch)
tree29c84e9a2b9451e0fc4cd8d5e2908c26eb1758fd /searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
parent1cfea65b9bc71b472e9dc3370b120cf428b6ece0 (diff)
Use a common FNET_Transport owned by Proton in both SceduledExecutor and TransactionLogServer.
This reduces the number of Transport object by 1 per document type and netto 1 in Proton. Each of them contains 2 threads. In addition it uses a common Transport for the RpcFileAcquirer objects used during config fetching. This prevents creating 3 temporary Transport objects on every reconfig.
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp34
1 files changed, 21 insertions, 13 deletions
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 b9e3549053a..397250f3d1e 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
@@ -36,6 +36,8 @@
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/config/subscription/sourcespec.h>
+#include <vespa/fastos/thread.h>
+#include <vespa/fnet/transport.h>
using namespace cloud::config::filedistribution;
using namespace document;
@@ -261,7 +263,7 @@ struct MyConfigSnapshot
DocBuilder _builder;
DocumentDBConfig::SP _cfg;
BootstrapConfig::SP _bootstrap;
- MyConfigSnapshot(const Schema &schema, const vespalib::string &cfgDir)
+ MyConfigSnapshot(FNET_Transport & transport, const Schema &schema, const vespalib::string &cfgDir)
: _schema(schema),
_builder(_schema),
_cfg(),
@@ -279,7 +281,7 @@ struct MyConfigSnapshot
::config::DirSpec spec(cfgDir);
DocumentDBConfigHelper mgr(spec, "searchdocument");
mgr.forwardConfig(_bootstrap);
- mgr.nextGeneration(1ms);
+ mgr.nextGeneration(transport, 1ms);
_cfg = mgr.getConfig();
}
};
@@ -287,35 +289,41 @@ struct MyConfigSnapshot
template <typename Traits>
struct FixtureBase
{
- ThreadStackExecutor _summaryExecutor;
+ FastOS_ThreadPool _threadPool;
+ FNET_Transport _transport;
+ ThreadStackExecutor _summaryExecutor;
ExecutorThreadingService _writeService;
- typename Traits::Config _cfg;
+ typename Traits::Config _cfg;
std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB;
- BucketDBHandler _bucketDBHandler;
+ BucketDBHandler _bucketDBHandler;
typename Traits::Context _ctx;
- typename Traits::Schema _baseSchema;
- MyConfigSnapshot::UP _snapshot;
- DirectoryHandler _baseDir;
- typename Traits::SubDB _subDb;
- IFeedView::SP _tmpFeedView;
+ typename Traits::Schema _baseSchema;
+ MyConfigSnapshot::UP _snapshot;
+ DirectoryHandler _baseDir;
+ typename Traits::SubDB _subDb;
+ IFeedView::SP _tmpFeedView;
FixtureBase()
- : _summaryExecutor(1, 64_Ki),
+ : _threadPool(64_Ki),
+ _transport(),
+ _summaryExecutor(1, 64_Ki),
_writeService(_summaryExecutor),
_cfg(),
_bucketDB(std::make_shared<bucketdb::BucketDBOwner>()),
_bucketDBHandler(*_bucketDB),
_ctx(_writeService, _bucketDB, _bucketDBHandler),
_baseSchema(),
- _snapshot(std::make_unique<MyConfigSnapshot>(_baseSchema, Traits::ConfigDir::dir())),
+ _snapshot(std::make_unique<MyConfigSnapshot>(_transport, _baseSchema, Traits::ConfigDir::dir())),
_baseDir(BASE_DIR + "/" + SUB_NAME, BASE_DIR),
_subDb(_cfg._cfg, _ctx._ctx),
_tmpFeedView()
{
+ _transport.Start(&_threadPool);
init();
}
~FixtureBase() {
_writeService.master().execute(makeLambdaTask([this]() { _subDb.close(); }));
_writeService.shutdown();
+ _transport.ShutDown(true);
}
void setBucketStateCalculator(const std::shared_ptr<IBucketStateCalculator> & calc) {
vespalib::Gate gate;
@@ -346,7 +354,7 @@ struct FixtureBase
runInMasterAndSync([&]() { performReconfig(serialNum, reconfigSchema, reconfigConfigDir); });
}
void performReconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) {
- auto newCfg = std::make_unique<MyConfigSnapshot>(reconfigSchema, reconfigConfigDir);
+ auto newCfg = std::make_unique<MyConfigSnapshot>(_transport, reconfigSchema, reconfigConfigDir);
DocumentDBConfig::ComparisonResult cmpResult;
cmpResult.attributesChanged = true;
cmpResult.documenttypesChanged = true;