diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-30 11:33:38 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-30 11:37:43 +0000 |
commit | 85892cba3cf769d2ed8b39740e7f75e4ef1461da (patch) | |
tree | ba439d213e7377cb7c879f564e7ee226da939f9e /searchcore | |
parent | 6714a9d0b255933bdad7956db7928c67179cec50 (diff) |
GC unused TwoPhaseLidTracker
Diffstat (limited to 'searchcore')
5 files changed, 0 insertions, 150 deletions
diff --git a/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp b/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp index 3b42a399888..b276ed9e46d 100644 --- a/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp +++ b/searchcore/src/tests/proton/common/pendinglidtracker_test.cpp @@ -86,24 +86,4 @@ TEST("test pendinglidtracker for needcommit") { EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LIDV_2_1_3)); } -TEST("test two phase pendinglidtracker for needcommit") { - TwoPhasePendingLidTracker tracker; - ILidCommitState::State incomplete = ILidCommitState::State::NEED_COMMIT; - verifyPhase1ProduceAndNeedCommit(tracker, incomplete); - EXPECT_EQUAL(incomplete, tracker.getState()); - EXPECT_EQUAL(incomplete, tracker.getState(LID_1)); - EXPECT_EQUAL(incomplete, tracker.getState(LIDV_2_1_3)); - EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LIDV_2_3)); - { - ILidCommitState::State waiting = ILidCommitState::State::WAITING; - auto snapshot = tracker.produceSnapshot(); - EXPECT_EQUAL(waiting, tracker.getState()); - EXPECT_EQUAL(waiting, tracker.getState(LID_1)); - EXPECT_EQUAL(waiting, tracker.getState(LIDV_2_1_3)); - } - EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState()); - EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LID_1)); - EXPECT_EQUAL(ILidCommitState::State::COMPLETED, tracker.getState(LIDV_2_1_3)); -} - TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index a3148aa9372..cd6b23e5e26 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -9,7 +9,6 @@ #include <vespa/searchcore/proton/attribute/i_attribute_manager.h> #include <vespa/searchcore/proton/bucketdb/bucket_create_notifier.h> #include <vespa/searchcore/proton/common/doctypename.h> -#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/common/transient_memory_usage_provider.h> #include <vespa/searchcore/proton/documentmetastore/operation_listener.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> diff --git a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.cpp b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.cpp index dd6ca70248b..24ddacafaa8 100644 --- a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.cpp @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "pendinglidtracker.h" -#include <vespa/vespalib/stllike/hash_map.hpp> -#include <algorithm> #include <cassert> namespace proton { @@ -89,104 +87,4 @@ PendingLidTracker::pendingLids() const { return lids; } -TwoPhasePendingLidTracker::TwoPhasePendingLidTracker() - : _sequenceId(0), - _lastCommitStarted(0), - _lastCommitCompleted(0), - _pending() -{} - -TwoPhasePendingLidTracker::~TwoPhasePendingLidTracker() { - assert(_pending.empty()); -} - -IPendingLidTracker::Token -TwoPhasePendingLidTracker::produce(uint32_t lid) { - std::lock_guard guard(_mutex); - _pending[lid] = ++_sequenceId; - return Token(lid, *this); -} -void -TwoPhasePendingLidTracker::consume(uint32_t lid) { - (void) lid; -} - -ILidCommitState::State -TwoPhasePendingLidTracker::waitFor(MonitorGuard & guard, State state, uint32_t lid) const { - for (auto found = _pending.find(lid); found != _pending.end(); found = _pending.find(lid)) { - if (state == State::NEED_COMMIT) { - if (found->second > _lastCommitStarted) { - return State::NEED_COMMIT; - } - return State::WAITING; - } - _cond.wait(guard); - } - return State::COMPLETED; -} - -void -TwoPhasePendingLidTracker::consumeSnapshot(uint64_t sequenceIdWhenStarted) { - MonitorGuard guard(_mutex); - assert(sequenceIdWhenStarted >= _lastCommitCompleted); - _lastCommitCompleted = sequenceIdWhenStarted; - std::vector<uint32_t> committed; - for (const auto & entry : _pending) { - if (entry.second <= sequenceIdWhenStarted) - committed.push_back(entry.first); - } - for (uint32_t lid : committed) { - _pending.erase(lid); - } - _cond.notify_all(); -} - -ILidCommitState::LidList -TwoPhasePendingLidTracker::pendingLids() const { - MonitorGuard guard(_mutex); - LidList lids; - lids.reserve(_pending.size()); - for (const auto & entry : _pending) { - lids.push_back(entry.first); - } - return lids; -} - -namespace common::internal { - -class CommitList : public PendingLidTrackerBase::Payload { -public: - using LidList = ILidCommitState::LidList; - CommitList(uint64_t commitStarted, TwoPhasePendingLidTracker & tracker) - : _tracker(&tracker), - _commitStarted(commitStarted) - { } - CommitList(const CommitList &) = delete; - CommitList & operator = (const CommitList &) = delete; - CommitList & operator = (CommitList &&) = delete; - CommitList(CommitList && rhs) noexcept - : _tracker(rhs._tracker), - _commitStarted(rhs._commitStarted) - { - rhs._tracker = nullptr; - } - ~CommitList() override { - if (_tracker != nullptr) { - _tracker->consumeSnapshot(_commitStarted); - } - } -private: - TwoPhasePendingLidTracker * _tracker; - uint64_t _commitStarted; -}; - -} - -PendingLidTrackerBase::Snapshot -TwoPhasePendingLidTracker::produceSnapshot() { - MonitorGuard guard(_mutex); - _lastCommitStarted = _sequenceId; - return std::make_unique<common::internal::CommitList>(_lastCommitStarted, *this); -} - } diff --git a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h index ef0a1dbb1a3..079634f56bb 100644 --- a/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h +++ b/searchcore/src/vespa/searchcore/proton/common/pendinglidtracker.h @@ -60,30 +60,4 @@ private: vespalib::hash_map<uint32_t, uint32_t> _pending; }; -namespace common::internal { - class CommitList; -} -/** - * Use for tracking lids in 2 phases which is needed when visibility-delay is non-zero. - * It tracks lids that are in feed pipeline, lids where commit has been started and when they fully complete. - */ -class TwoPhasePendingLidTracker : public PendingLidTrackerBase -{ -public: - TwoPhasePendingLidTracker(); - ~TwoPhasePendingLidTracker() override; - Token produce(uint32_t lid) override; - Snapshot produceSnapshot() override; -private: - friend common::internal::CommitList; - void consume(uint32_t lid) override; - void consumeSnapshot(uint64_t sequenceIdWhenStarted); - LidList pendingLids() const override; - State waitFor(MonitorGuard & guard, State state, uint32_t lid) const override; - uint64_t _sequenceId; - uint64_t _lastCommitStarted; - uint64_t _lastCommitCompleted; - vespalib::hash_map<uint32_t, uint64_t> _pending; -}; - } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index aaae7621562..5cf72854b38 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -16,7 +16,6 @@ #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/vespalib/util/closuretask.h> -#include <vespa/eval/tensor/default_tensor_engine.h> using vespa::config::search::RankProfilesConfig; using proton::matching::MatchingStats; |