summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-09-30 18:23:29 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-09-30 18:23:29 +0200
commit0b557c51c7e06a4786366b3e97c24dd19df10221 (patch)
tree36619987d17ec1a2ee6f601c3542598b60cc5e39
parent7a74c1caf57ca0ac1801e91580acd35bea52d970 (diff)
Update so that the tls direct writer is not optional.
-rw-r--r--searchcore/src/apps/tests/persistenceconformance_test.cpp5
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp30
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp16
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp31
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/feedhandler.h17
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/tlswriter.h8
10 files changed, 40 insertions, 96 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp
index 905d0434886..d369fa84542 100644
--- a/searchcore/src/apps/tests/persistenceconformance_test.cpp
+++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp
@@ -189,11 +189,10 @@ public:
const_cast<DocumentDBFactory &>(*this),
_summaryExecutor,
_summaryExecutor,
- NULL,
+ _tls,
_metricsWireService,
_fileHeaderContext,
- _config_stores.getConfigStore(
- docType.toString()),
+ _config_stores.getConfigStore(docType.toString()),
std::make_shared<vespalib::ThreadStackExecutor>
(16, 128 * 1024),
HwInfo()));
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index f492dc44fc6..97a96c4bac6 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -201,38 +201,20 @@ public:
_sa()
{
assert(_mkdirOk);
- auto b = std::make_shared<BootstrapConfig>(1,
- _documenttypesConfig,
- _repo,
+ auto b = std::make_shared<BootstrapConfig>(1, _documenttypesConfig, _repo,
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
_tuneFileDocumentDB);
_configMgr.forwardConfig(b);
_configMgr.nextGeneration(0);
if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) { abort(); }
- _ddb.reset(new DocumentDB("tmpdb",
- _configMgr.getConfig(),
- "tcp/localhost:9013",
- _queryLimiter,
- _clock,
- DocTypeName(docTypeName),
- ProtonConfig(),
- *this,
- _summaryExecutor,
- _summaryExecutor,
- NULL,
- _dummy,
- _fileHeaderContext,
- ConfigStore::UP(new MemoryConfigStore),
- std::make_shared<vespalib::
- ThreadStackExecutor>
- (16, 128 * 1024),
- _hwInfo)),
+ _ddb.reset(new DocumentDB("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter, _clock,
+ DocTypeName(docTypeName), ProtonConfig(), *this, _summaryExecutor, _summaryExecutor,
+ _tls, _dummy, _fileHeaderContext, ConfigStore::UP(new MemoryConfigStore),
+ std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo)),
_ddb->start();
_ddb->waitForOnlineState();
- _aw = AttributeWriter::UP(new AttributeWriter(_ddb->
- getReadySubDB()->
- getAttributeManager()));
+ _aw = AttributeWriter::UP(new AttributeWriter(_ddb->getReadySubDB()->getAttributeManager()));
_sa = _ddb->getReadySubDB()->getSummaryAdapter();
}
~DBContext()
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index b9a04acb8da..157e964ad83 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -107,22 +107,16 @@ Fixture::Fixture()
config::DirSpec spec(TEST_PATH("cfg"));
DocumentDBConfigHelper mgr(spec, "typea");
BootstrapConfig::SP
- b(new BootstrapConfig(1,
- documenttypesConfig,
- repo,
+ b(new BootstrapConfig(1, documenttypesConfig, repo,
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
tuneFileDocumentDB));
mgr.forwardConfig(b);
mgr.nextGeneration(0);
- _db.reset(new DocumentDB(".", mgr.getConfig(), "tcp/localhost:9014",
- _queryLimiter, _clock, DocTypeName("typea"),
- ProtonConfig(),
- _myDBOwner, _summaryExecutor, _summaryExecutor, NULL, _dummy, _fileHeaderContext,
- ConfigStore::UP(new MemoryConfigStore),
- std::make_shared<vespalib::ThreadStackExecutor>
- (16, 128 * 1024),
- _hwInfo));
+ _db.reset(new DocumentDB(".", mgr.getConfig(), "tcp/localhost:9014", _queryLimiter, _clock, DocTypeName("typea"),
+ ProtonConfig(), _myDBOwner, _summaryExecutor, _summaryExecutor, _tls, _dummy,
+ _fileHeaderContext, ConfigStore::UP(new MemoryConfigStore),
+ std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo));
_db->start();
_db->waitForOnlineState();
}
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 1ccbff6e6cf..39a588f804d 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -411,12 +411,10 @@ struct MyTlsWriter : TlsWriter {
bool erase_return;
MyTlsWriter() : store_count(0), erase_count(0), erase_return(true) {}
- virtual void storeOperation(const FeedOperation &) override { ++store_count; }
- virtual bool erase(SerialNum) override { ++erase_count; return erase_return; }
+ void storeOperation(const FeedOperation &) override { ++store_count; }
+ bool erase(SerialNum) override { ++erase_count; return erase_return; }
- virtual SerialNum
- sync(SerialNum syncTo) override
- {
+ SerialNum sync(SerialNum syncTo) override {
return syncTo;
}
};
@@ -452,7 +450,7 @@ struct FeedHandlerFixture
_bucketDB(),
_bucketDBHandler(_bucketDB),
handler(writeService, tlsSpec, schema.getDocType(),
- feedMetrics._feed, _state, owner, writeFilter, replayConfig, NULL, &tls_writer)
+ feedMetrics._feed, _state, owner, writeFilter, replayConfig, tls, &tls_writer)
{
_state.enterLoadState();
_state.enterReplayTransactionLogState();
@@ -544,8 +542,7 @@ addLidToRemove(RemoveDocumentsOperation &op)
TEST_F("require that handleMove calls FeedView", FeedHandlerFixture)
{
DocumentContext doc_context("doc:test:foo", *f.schema.builder);
- MoveOperation op(doc_context.bucketId, Timestamp(2), doc_context.doc,
- DbDocumentId(0, 2), 1);
+ MoveOperation op(doc_context.bucketId, Timestamp(2), doc_context.doc, DbDocumentId(0, 2), 1);
op.setDbDocumentId(DbDocumentId(1, 2));
f.runAsMaster([&]() { f.handler.handleMove(op, IDestructorCallback::SP()); });
EXPECT_EQUAL(1, f.feedView.move_count);
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 024de835d7a..756d710a07a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -90,7 +90,7 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
IDocumentDBOwner & owner,
vespalib::ThreadExecutor & warmupExecutor,
vespalib::ThreadStackExecutorBase & summaryExecutor,
- search::transactionlog::Writer * tlsDirectWriter,
+ search::transactionlog::Writer & tlsDirectWriter,
MetricsWireService &metricsWireService,
const FileHeaderContext &fileHeaderContext,
ConfigStore::UP config_store,
@@ -136,31 +136,12 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
_state(),
_dmUsageForwarder(_writeService.master()),
_writeFilter(),
- _feedHandler(_writeService,
- tlsSpec,
- docTypeName,
+ _feedHandler(_writeService, tlsSpec, docTypeName,
getMetricsCollection().getLegacyMetrics().feed,
- _state,
- *this,
- _writeFilter,
- *this,
- tlsDirectWriter),
- _subDBs(*this,
- *this,
- _feedHandler,
- _docTypeName,
- _writeService,
- warmupExecutor,
- summaryExecutor,
- fileHeaderContext,
- metricsWireService,
- getMetricsCollection(),
- queryLimiter,
- clock,
- _configMutex,
- _baseDir,
- protonCfg,
- hwInfo),
+ _state, *this, _writeFilter, *this, tlsDirectWriter),
+ _subDBs(*this, *this, _feedHandler, _docTypeName, _writeService, warmupExecutor,
+ summaryExecutor, fileHeaderContext, metricsWireService, getMetricsCollection(),
+ queryLimiter, clock, _configMutex, _baseDir, protonCfg, hwInfo),
_maintenanceController(_writeService.master(), summaryExecutor, _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 d06ce9050b7..a3f99148e7c 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -242,7 +242,7 @@ public:
IDocumentDBOwner & owner,
vespalib::ThreadExecutor & warmupExecutor,
vespalib::ThreadStackExecutorBase & summaryExecutor,
- search::transactionlog::Writer * tlsDirectWriter,
+ search::transactionlog::Writer & tlsDirectWriter,
MetricsWireService &metricsWireService,
const search::common::FileHeaderContext &fileHeaderContext,
ConfigStore::UP config_store,
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
index 3fa2966af73..0ed3de93965 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp
@@ -467,8 +467,7 @@ FeedHandler::changeFeedState(FeedState::SP newState)
void
-FeedHandler::changeFeedState(FeedState::SP newState,
- const vespalib::LockGuard &)
+FeedHandler::changeFeedState(FeedState::SP newState, const vespalib::LockGuard &)
{
LOG(debug,
"Change feed state from '%s' -> '%s'",
@@ -485,8 +484,8 @@ FeedHandler::FeedHandler(IThreadingService &writeService,
IFeedHandlerOwner &owner,
const IResourceWriteFilter &writeFilter,
IReplayConfig &replayConfig,
- search::transactionlog::Writer *tlsDirectWriter,
- TlsWriter *tls_writer)
+ search::transactionlog::Writer & tlsDirectWriter,
+ TlsWriter * tlsWriter)
: search::transactionlog::TransLogClient::Session::Callback(),
IDocumentMoveHandler(),
IPruneRemovedDocumentsHandler(),
@@ -500,8 +499,8 @@ FeedHandler::FeedHandler(IThreadingService &writeService,
_writeFilter(writeFilter),
_replayConfig(replayConfig),
_tlsMgr(tlsSpec, docTypeName.getName()),
- _tlsMgrWriter(_tlsMgr, tlsDirectWriter),
- _tlsWriter(tls_writer ? *tls_writer : _tlsMgrWriter),
+ _tlsMgrWriter(_tlsMgr, &tlsDirectWriter),
+ _tlsWriter(tlsWriter ? *tlsWriter : _tlsMgrWriter),
_tlsReplayProgress(),
_serialNum(0),
_prunedSerialNum(0),
@@ -831,5 +830,4 @@ FeedHandler::storeRemoteOperation(const FeedOperation &op)
}
}
-
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h
index 71f1a47050f..32ff8f5d690 100644
--- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h
+++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h
@@ -72,11 +72,9 @@ private:
_tls_mgr(tls_mgr),
_tlsDirectWriter(tlsDirectWriter)
{ }
- virtual void storeOperation(const FeedOperation &op) override;
- virtual bool erase(SerialNum oldest_to_keep) override;
-
- virtual SerialNum
- sync(SerialNum syncTo) override;
+ void storeOperation(const FeedOperation &op) override;
+ bool erase(SerialNum oldest_to_keep) override;
+ SerialNum sync(SerialNum syncTo) override;
};
typedef searchcorespi::index::IThreadingService IThreadingService;
@@ -126,10 +124,7 @@ private:
void performRemove(FeedTokenUP token, RemoveOperation &op);
private:
void performGarbageCollect(FeedTokenUP token);
-
- void
- performCreateBucket(FeedTokenUP token, CreateBucketOperation &op);
-
+ void performCreateBucket(FeedTokenUP token, CreateBucketOperation &op);
void performDeleteBucket(FeedTokenUP token, DeleteBucketOperation &op);
void performSplit(FeedTokenUP token, SplitBucketOperation &op);
void performJoin(FeedTokenUP token, JoinBucketsOperation &op);
@@ -186,8 +181,8 @@ public:
IFeedHandlerOwner &owner,
const IResourceWriteFilter &writerFilter,
IReplayConfig &replayConfig,
- search::transactionlog::Writer *writer,
- TlsWriter *tlsWriter = NULL);
+ search::transactionlog::Writer & writer,
+ TlsWriter * tlsWriter = nullptr);
virtual
~FeedHandler();
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 664808acbc0..38ec899051d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -551,7 +551,7 @@ Proton::addDocumentDB(const document::DocumentType &docType,
*this,
*_warmupExecutor,
*_summaryExecutor,
- _tls->getTransLogServer().get(),
+ *_tls->getTransLogServer(),
*_metricsEngine,
_fileHeaderContext,
std::move(config_store),
diff --git a/searchcore/src/vespa/searchcore/proton/server/tlswriter.h b/searchcore/src/vespa/searchcore/proton/server/tlswriter.h
index da55e3d8590..0956c0ae011 100644
--- a/searchcore/src/vespa/searchcore/proton/server/tlswriter.h
+++ b/searchcore/src/vespa/searchcore/proton/server/tlswriter.h
@@ -5,6 +5,7 @@
#include <vespa/searchlib/common/serialnum.h>
namespace proton {
+
class FeedOperation;
/**
@@ -15,10 +16,7 @@ struct TlsWriter {
virtual void storeOperation(const FeedOperation &op) = 0;
virtual bool erase(search::SerialNum oldest_to_keep) = 0;
-
- virtual search::SerialNum
- sync(search::SerialNum syncTo) = 0;
+ virtual search::SerialNum sync(search::SerialNum syncTo) = 0;
};
-} // namespace proton
-
+}