diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-29 19:37:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 19:37:57 +0100 |
commit | e3fc16242cedf9b3efed69d090858bcd1a545142 (patch) | |
tree | fe5c6b596a40e6e6546153292d781b30b34934aa | |
parent | 4baa67d2e88c466799e11118e11ceb3e28f365e2 (diff) | |
parent | 093a52c7f0f91ef9ed6994bf64a323cc2e647ea3 (diff) |
Merge pull request #15093 from vespa-engine/balder/remove-allow-early-ack-1
Remove allow early ack
19 files changed, 6 insertions, 109 deletions
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index f39b4291182..09c4c17220e 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -880,7 +880,7 @@ MaintenanceControllerFixture::injectMaintenanceJobs() _fh, _fh, _bmc, _clusterStateHandler, _bucketHandler, _calc, _diskMemUsageNotifier, - _jobTrackers, *this, + _jobTrackers, _readyAttributeManager, _notReadyAttributeManager, std::make_unique<const AttributeConfigInspector>(AttributesConfigBuilder()), diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.cpp index 1f979d1566c..b04bac5ef26 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.cpp @@ -7,7 +7,6 @@ namespace proton::documentmetastore { LidReuseDelayerConfig::LidReuseDelayerConfig(const DocumentDBConfig & configSnapshot) : _visibilityDelay(configSnapshot.getMaintenanceConfigSP()->getVisibilityDelay()), - _allowEarlyAck(configSnapshot.getMaintenanceConfigSP()->allowEarlyAck()), _hasIndexedOrAttributeFields(configSnapshot.getSchemaSP()->getNumIndexFields() > 0 || configSnapshot.getSchemaSP()->getNumAttributeFields() > 0) { @@ -19,7 +18,6 @@ LidReuseDelayerConfig::LidReuseDelayerConfig() LidReuseDelayerConfig::LidReuseDelayerConfig(vespalib::duration visibilityDelay, bool hasIndexedOrAttributeFields_in) : _visibilityDelay(visibilityDelay), - _allowEarlyAck(visibilityDelay > 1ms), _hasIndexedOrAttributeFields(hasIndexedOrAttributeFields_in) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.h index c81a2ff399f..82dab433a22 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_reuse_delayer_config.h @@ -15,7 +15,6 @@ class LidReuseDelayerConfig { private: vespalib::duration _visibilityDelay; - bool _allowEarlyAck; bool _hasIndexedOrAttributeFields; public: LidReuseDelayerConfig(); @@ -23,7 +22,6 @@ public: explicit LidReuseDelayerConfig(const DocumentDBConfig &configSnapshot); vespalib::duration visibilityDelay() const { return _visibilityDelay; } bool hasIndexedOrAttributeFields() const { return _hasIndexedOrAttributeFields; } - bool allowEarlyAck() const { return _allowEarlyAck; } }; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.cpp index ed2202c830b..03dfd83a132 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.cpp @@ -16,7 +16,6 @@ LidReuseDelayer::LidReuseDelayer(IThreadingService &writeService, IStore &docume : _writeService(writeService), _documentMetaStore(documentMetaStore), _immediateCommit(config.visibilityDelay() == vespalib::duration::zero()), - _allowEarlyAck(config.allowEarlyAck()), _config(config), _pendingLids() { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.h index 88e05c8db0c..0fe16636e1d 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lidreusedelayer.h @@ -27,7 +27,6 @@ class LidReuseDelayer searchcorespi::index::IThreadingService &_writeService; IStore &_documentMetaStore; const bool _immediateCommit; - const bool _allowEarlyAck; LidReuseDelayerConfig _config; std::vector<uint32_t> _pendingLids; // lids waiting for commit @@ -39,7 +38,6 @@ public: bool delayReuse(const std::vector<uint32_t> &lids); std::vector<uint32_t> getReuseLids(); - bool allowEarlyAck() const { return _allowEarlyAck; } const LidReuseDelayerConfig & getConfig() const { return _config; } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt index e81bb3c0037..5b9269917d7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt @@ -27,7 +27,6 @@ vespa_add_library(searchcore_server STATIC document_subdb_initializer_result.cpp documentbucketmover.cpp documentdb.cpp - documentdb_commit_job.cpp documentdb_metrics_updater.cpp documentdbconfig.cpp documentdbconfigmanager.cpp diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp index 5f7f26dfadd..6f52a49749e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.cpp @@ -218,16 +218,6 @@ CombiningFeedView::heartBeat(search::SerialNum serialNum) } } -bool -CombiningFeedView::allowEarlyAck() const { - for (const auto &view : _views) { - if ( ! view->allowEarlyAck() ) { - return false; - } - } - return true; -} - void CombiningFeedView::sync() { diff --git a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h index 15bbf73ac04..ce5cb303aba 100644 --- a/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/combiningfeedview.h @@ -84,7 +84,6 @@ public: // Called by document db executor void setCalculator(const IBucketStateCalculator::SP &newCalc); - bool allowEarlyAck() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h index 5ed0ad7492c..80064b7b5d7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h @@ -134,8 +134,6 @@ public: return _sessionCachePruneInterval; } vespalib::duration getVisibilityDelay() const { return _visibilityDelay; } - bool hasVisibilityDelay() const { return _visibilityDelay > vespalib::duration::zero(); } - bool allowEarlyAck() const { return _visibilityDelay > 1ms; } const DocumentDBLidSpaceCompactionConfig &getLidSpaceCompactionConfig() const { return _lidSpaceCompaction; } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 58152a6a21b..b35e1a88495 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -959,7 +959,6 @@ DocumentDB::injectMaintenanceJobs(const DocumentDBMaintenanceConfig &config, std _calc, // IBucketStateCalculator::SP _dmUsageForwarder, _jobTrackers, - _visibility, // ICommitable _subDBs.getReadySubDB()->getAttributeManager(), _subDBs.getNotReadySubDB()->getAttributeManager(), std::move(attribute_config_inspector), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.cpp deleted file mode 100644 index 80ef7a74f6d..00000000000 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "documentdb_commit_job.h" -#include <vespa/searchcore/proton/common/icommitable.h> - -namespace proton { - -DocumentDBCommitJob::DocumentDBCommitJob(ICommitable & committer, vespalib::duration visibilityDelay) : - IMaintenanceJob("documentdb_commit", visibilityDelay, visibilityDelay), - _committer(committer) -{ -} - -bool -DocumentDBCommitJob::run() -{ - _committer.commit(); - return true; -} - -} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.h b/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.h deleted file mode 100644 index c375d513276..00000000000 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb_commit_job.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "i_maintenance_job.h" -#include <vespa/vespalib/util/time.h> - -namespace proton { - -class ICommitable; - -/** - * Job that regularly commits the documentdb. - */ -class DocumentDBCommitJob : public IMaintenanceJob -{ -private: - ICommitable & _committer; - -public: - DocumentDBCommitJob(ICommitable & committer, vespalib::duration visibilityDelay); - - bool run() override; -}; - -} // namespace proton - diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index 2230250d355..e93388cdea3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -521,7 +521,7 @@ FeedHandler::initiateCommit() { onCommitDone(numPendingAtStart); })); auto commitResult = _tlsWriter->startCommit(onCommitDoneContext); - if (_activeFeedView && ! _activeFeedView->allowEarlyAck()) { + if (_activeFeedView) { using KeepAlivePair = search::KeepAlive<std::pair<CommitResult, DoneCallback>>; auto pair = std::make_pair(std::move(commitResult), std::move(onCommitDoneContext)); _activeFeedView->forceCommit(_serialNum, std::make_shared<KeepAlivePair>(std::move(pair))); diff --git a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h index d575b08e47b..aea8c909b8c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h @@ -65,7 +65,6 @@ public: virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation & pruneOp) = 0; virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) = 0; virtual ILidCommitState & getUncommittedLidsTracker() = 0; - virtual bool allowEarlyAck() const = 0; virtual bool isDrained() const = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp index d4b542a0af8..d7505f89bde 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "bucketmovejob.h" -#include "documentdb_commit_job.h" #include "heart_beat_job.h" #include "job_tracked_maintenance_job.h" #include "lid_space_compaction_job.h" @@ -97,7 +96,6 @@ MaintenanceJobsInjector::injectJobs(MaintenanceController &controller, const std::shared_ptr<IBucketStateCalculator> &calc, IDiskMemUsageNotifier &diskMemUsageNotifier, DocumentDBJobTrackers &jobTrackers, - ICommitable &commit, IAttributeManagerSP readyAttributeManager, IAttributeManagerSP notReadyAttributeManager, std::unique_ptr<const AttributeConfigInspector> attribute_config_inspector, @@ -105,9 +103,6 @@ MaintenanceJobsInjector::injectJobs(MaintenanceController &controller, AttributeUsageFilter &attributeUsageFilter) { controller.registerJobInMasterThread(std::make_unique<HeartBeatJob>(hbHandler, config.getHeartBeatConfig())); controller.registerJobInDefaultPool(std::make_unique<PruneSessionCacheJob>(scPruner, config.getSessionCachePruneInterval())); - if (config.hasVisibilityDelay() && config.allowEarlyAck()) { - controller.registerJobInMasterThread(std::make_unique<DocumentDBCommitJob>(commit, config.getVisibilityDelay())); - } const MaintenanceDocumentSubDB &mRemSubDB(controller.getRemSubDB()); auto pruneRDjob = std::make_unique<PruneRemovedDocumentsJob>(config.getPruneRemovedDocumentsConfig(), *mRemSubDB.meta_store(), mRemSubDB.sub_db_id(), docTypeName, prdHandler, fbHandler); diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h index a60cad1cb2b..44308d49dab 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h +++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h @@ -52,7 +52,6 @@ struct MaintenanceJobsInjector const std::shared_ptr<IBucketStateCalculator> &calc, IDiskMemUsageNotifier &diskMemUsageNotifier, DocumentDBJobTrackers &jobTrackers, - ICommitable & commit, IAttributeManagerSP readyAttributeManager, IAttributeManagerSP notReadyAttributeManager, std::unique_ptr<const AttributeConfigInspector> attribute_config_inspector, diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index a61894f79b6..56f25b11d9f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -210,12 +210,8 @@ moveMetaData(documentmetastore::IStore &meta_store, const DocumentId & doc_id, c } std::unique_ptr<PendingLidTrackerBase> -createUncommitedLidTracker(bool allowEarlyAck) { - if (allowEarlyAck) { - return std::make_unique<TwoPhasePendingLidTracker>(); - } else { - return std::make_unique<PendingLidTracker>(); - } +createUncommitedLidTracker() { + return std::make_unique<PendingLidTracker>(); } } // namespace @@ -229,7 +225,7 @@ StoreOnlyFeedView::StoreOnlyFeedView(const Context &ctx, const PersistentParams _docType(nullptr), _lidReuseDelayer(ctx._writeService, _documentMetaStoreContext->get(), ctx._lidReuseDelayerConfig), _pendingLidsForDocStore(), - _pendingLidsForCommit(createUncommitedLidTracker(_lidReuseDelayer.allowEarlyAck())), + _pendingLidsForCommit(createUncommitedLidTracker()), _schema(ctx._schema), _writeService(ctx._writeService), _params(params), @@ -280,14 +276,6 @@ StoreOnlyFeedView::get_pending_lid_token(const DocumentOperation &op) } void -StoreOnlyFeedView::considerEarlyAck(FeedToken & token) -{ - if (allowEarlyAck() && token) { - token.reset(); - } -} - -void StoreOnlyFeedView::putAttributes(SerialNum, Lid, const Document &, OnPutDoneType) {} void @@ -329,7 +317,6 @@ StoreOnlyFeedView::internalPut(FeedToken token, const PutOperation &putOp) PendingNotifyRemoveDone pendingNotifyRemoveDone = adjustMetaStore(putOp, docId.getGlobalId(), docId); auto uncommitted = get_pending_lid_token(putOp); - considerEarlyAck(token); bool docAlreadyExists = putOp.getValidPrevDbdId(_params._subDbId); @@ -350,11 +337,6 @@ StoreOnlyFeedView::internalPut(FeedToken token, const PutOperation &putOp) } } -bool -StoreOnlyFeedView::allowEarlyAck() const { - return _lidReuseDelayer.allowEarlyAck(); -} - void StoreOnlyFeedView::heartBeatIndexedFields(SerialNum ) {} @@ -487,7 +469,6 @@ StoreOnlyFeedView::internalUpdate(FeedToken token, const UpdateOperation &updOp) _metaStore.commit(serialNum, serialNum); } auto uncommitted = get_pending_lid_token(updOp); - considerEarlyAck(token); auto onWriteDone = createUpdateDoneContext(std::move(token), std::move(uncommitted), updOp.getUpdate()); UpdateScope updateScope(*_schema, upd); @@ -611,7 +592,6 @@ StoreOnlyFeedView::internalRemove(FeedToken token, const RemoveOperationWithDocI PendingNotifyRemoveDone pendingNotifyRemoveDone = adjustMetaStore(rmOp, docId.getGlobalId(), docId); auto uncommitted = get_pending_lid_token(rmOp); - considerEarlyAck(token); if (rmOp.getValidDbdId(_params._subDbId)) { auto clearDoc = std::make_unique<Document>(*_docType, docId); @@ -637,7 +617,6 @@ StoreOnlyFeedView::internalRemove(FeedToken token, const RemoveOperationWithGid DocumentId dummy; PendingNotifyRemoveDone pendingNotifyRemoveDone = adjustMetaStore(rmOp, rmOp.getGlobalId(), dummy); auto uncommitted = _pendingLidsForCommit->produce(rmOp.getLid()); - considerEarlyAck(token); if (rmOp.getValidPrevDbdId(_params._subDbId)) { if (rmOp.changedDbdId()) { @@ -756,8 +735,7 @@ StoreOnlyFeedView::prepareDeleteBucket(DeleteBucketOperation &delOp) _params._docTypeName.toString().c_str(), bucket.toString().c_str(), lidsToRemove.size()); if (!lidsToRemove.empty()) { - LidVectorContext::SP ctx(new LidVectorContext(_metaStore.getCommittedDocIdLimit(), lidsToRemove)); - delOp.setLidsToRemove(_params._subDbId, ctx); + delOp.setLidsToRemove(_params._subDbId, std::make_shared<LidVectorContext>(_metaStore.getCommittedDocIdLimit(), lidsToRemove)); } } diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h index cf8eb35caf0..f2819170d5e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h @@ -186,9 +186,6 @@ private: Lid lid, std::shared_ptr<search::IDestructorCallback> moveDoneCtx); IPendingLidTracker::Token get_pending_lid_token(const DocumentOperation &op); - - // Ack token early if visibility delay is nonzero - void considerEarlyAck(FeedToken &token); void makeUpdatedDocument(SerialNum serialNum, Lid lid, const DocumentUpdate & update, OnOperationDoneType onWriteDone, PromisedDoc promisedDoc, PromisedStream promisedStream); @@ -254,7 +251,6 @@ public: void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &pruneOp) override; void handleCompactLidSpace(const CompactLidSpaceOperation &op) override; ILidCommitState & getUncommittedLidsTracker() override; - bool allowEarlyAck() const final override; }; } diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h index 59afbb8f197..b50e47e8f9c 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h @@ -34,7 +34,6 @@ struct DummyFeedView : public IFeedView void handleCompactLidSpace(const CompactLidSpaceOperation &) override {} void forceCommit(search::SerialNum, DoneCallback) override { } ILidCommitState & getUncommittedLidsTracker() override; - bool allowEarlyAck() const override { return false; } bool isDrained() const override { return true; } }; |