aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-12-08 20:34:33 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-12-08 22:56:28 +0000
commitd2537bcc6f2474633b5d51bd51546c8a37f025b3 (patch)
tree6ca48580547a38e9116439f28f02110b76ffa59c
parent0f15b405cad738460a8126bf9ef689ec3edfd094 (diff)
Move sessionmanager from documentdb to proton and use a SchedulerForwardExecutor to drive pruning instead of a maintenance job.
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp5
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp67
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h15
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp31
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp21
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h24
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h1
29 files changed, 77 insertions, 221 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 dd402a6e637..ac2e9279227 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
@@ -15,6 +15,7 @@
#include <vespa/searchcore/proton/metrics/metricswireservice.h>
#include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h>
#include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h>
+#include <vespa/searchcore/proton/matching/sessionmanager.h>
#include <vespa/searchcore/proton/server/bootstrapconfig.h>
#include <vespa/searchcore/proton/server/document_subdb_explorer.h>
#include <vespa/searchcore/proton/server/document_subdb_initializer.h>
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 7aa18513f73..cdf874a6601 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -290,11 +290,6 @@ TEST_F("requireThatStateIsReported", Fixture)
slime.toString());
}
-TEST_F("require that session manager can be explored", Fixture)
-{
- EXPECT_TRUE(DocumentDBExplorer(f._db).get_child("session"));
-}
-
TEST_F("require that document db registers reference", Fixture)
{
auto &registry = f._myDBOwner._registry;
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index 23e96ae78d1..47555288a10 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -57,7 +57,6 @@ using document::DocumentId;
using document::test::makeBucketSpace;
using vespalib::system_clock;
using proton::bucketdb::BucketCreateNotifier;
-using proton::matching::ISessionCachePruner;
using search::AttributeGuard;
using search::DocumentIdT;
using search::DocumentMetaData;
@@ -203,18 +202,6 @@ struct MyBucketModifiedHandler : public IBucketModifiedHandler
void reset() { _modified.clear(); }
};
-
-struct MySessionCachePruner : public ISessionCachePruner
-{
- std::atomic<bool> isInvoked;
- MySessionCachePruner() : isInvoked(false) { }
- void pruneTimedOutSessions(vespalib::steady_time current) override {
- (void) current;
- isInvoked.store(true, std::memory_order_relaxed);
- }
-};
-
-
class MyFeedHandler : public IDocumentMoveHandler,
public IPruneRemovedDocumentsHandler,
public IHeartBeatHandler,
@@ -329,7 +316,6 @@ class MaintenanceControllerFixture
{
public:
MyExecutor _executor;
- MyExecutor _genericExecutor;
SyncableExecutorThreadService _threadService;
DummyBucketExecutor _bucketExecutor;
DocTypeName _docTypeName;
@@ -342,7 +328,6 @@ public:
MyDocumentSubDB _ready;
MyDocumentSubDB _removed;
MyDocumentSubDB _notReady;
- MySessionCachePruner _gsp;
MyFeedHandler _fh;
DocumentDBMaintenanceConfig::SP _mcCfg;
bool _injectDefaultJobs;
@@ -353,7 +338,7 @@ public:
test::DiskMemUsageNotifier _diskMemUsageNotifier;
BucketCreateNotifier _bucketCreateNotifier;
MonitoredRefCount _refCount;
- Transport _transport;
+ Transport _transport;
MaintenanceController _mc;
MaintenanceControllerFixture();
@@ -380,7 +365,6 @@ public:
auto newCfg = std::make_shared<DocumentDBMaintenanceConfig>(
pruneConfig,
_mcCfg->getHeartBeatConfig(),
- _mcCfg->getSessionCachePruneInterval(),
_mcCfg->getVisibilityDelay(),
_mcCfg->getLidSpaceCompactionConfig(),
_mcCfg->getAttributeUsageFilterConfig(),
@@ -398,25 +382,6 @@ public:
auto newCfg = std::make_shared<DocumentDBMaintenanceConfig>(
_mcCfg->getPruneRemovedDocumentsConfig(),
heartBeatConfig,
- _mcCfg->getSessionCachePruneInterval(),
- _mcCfg->getVisibilityDelay(),
- _mcCfg->getLidSpaceCompactionConfig(),
- _mcCfg->getAttributeUsageFilterConfig(),
- _mcCfg->getAttributeUsageSampleInterval(),
- _mcCfg->getBlockableJobConfig(),
- _mcCfg->getFlushConfig(),
- _mcCfg->getBucketMoveConfig());
- _mcCfg = newCfg;
- forwardMaintenanceConfig();
- }
-
- void
- setGroupingSessionPruneInterval(vespalib::duration groupingSessionPruneInterval)
- {
- auto newCfg = std::make_shared<DocumentDBMaintenanceConfig>(
- _mcCfg->getPruneRemovedDocumentsConfig(),
- _mcCfg->getHeartBeatConfig(),
- groupingSessionPruneInterval,
_mcCfg->getVisibilityDelay(),
_mcCfg->getLidSpaceCompactionConfig(),
_mcCfg->getAttributeUsageFilterConfig(),
@@ -432,7 +397,6 @@ public:
auto newCfg = std::make_shared<DocumentDBMaintenanceConfig>(
_mcCfg->getPruneRemovedDocumentsConfig(),
_mcCfg->getHeartBeatConfig(),
- _mcCfg->getSessionCachePruneInterval(),
_mcCfg->getVisibilityDelay(),
cfg,
_mcCfg->getAttributeUsageFilterConfig(),
@@ -754,7 +718,6 @@ MyExecutor::waitIdle(vespalib::duration timeout)
MaintenanceControllerFixture::MaintenanceControllerFixture()
: _executor(),
- _genericExecutor(),
_threadService(_executor),
_bucketExecutor(2),
_docTypeName("searchdocument"), // must match document builder
@@ -767,7 +730,6 @@ MaintenanceControllerFixture::MaintenanceControllerFixture()
_ready(0u, SubDbType::READY, _builder.getRepo(), _bucketDB, _docTypeName),
_removed(1u, SubDbType::REMOVED, _builder.getRepo(), _bucketDB, _docTypeName),
_notReady(2u, SubDbType::NOTREADY, _builder.getRepo(), _bucketDB, _docTypeName),
- _gsp(),
_fh(_executor._threadId),
_mcCfg(new DocumentDBMaintenanceConfig),
_injectDefaultJobs(true),
@@ -778,7 +740,7 @@ MaintenanceControllerFixture::MaintenanceControllerFixture()
_bucketCreateNotifier(),
_refCount(),
_transport(),
- _mc(_transport.transport(), _threadService, _genericExecutor, _refCount, _docTypeName)
+ _mc(_transport.transport(), _threadService, _refCount, _docTypeName)
{
std::vector<MyDocumentSubDB *> subDBs;
subDBs.push_back(&_ready);
@@ -830,7 +792,7 @@ void
MaintenanceControllerFixture::injectMaintenanceJobs()
{
if (_injectDefaultJobs) {
- MaintenanceJobsInjector::injectJobs(_mc, *_mcCfg, _bucketExecutor, _fh, _gsp, _fh,
+ MaintenanceJobsInjector::injectJobs(_mc, *_mcCfg, _bucketExecutor, _fh, _fh,
_bucketCreateNotifier, makeBucketSpace(), _fh, _fh,
_bmc, _clusterStateHandler, _bucketHandler, _calc, _diskMemUsageNotifier,
_jobTrackers, _readyAttributeManager, _notReadyAttributeManager,
@@ -951,22 +913,6 @@ TEST_F("require that heartbeats are scheduled", MaintenanceControllerFixture)
EXPECT_GREATER(f._fh.getHeartBeats(), 0u);
}
-TEST_F("require that periodic session prunings are scheduled",
- MaintenanceControllerFixture)
-{
- ASSERT_FALSE(f._gsp.isInvoked.load(std::memory_order_relaxed));
- f.notifyClusterStateChanged();
- f.startMaintenance();
- f.setGroupingSessionPruneInterval(200ms);
- for (uint32_t i = 0; i < 600; ++i) {
- std::this_thread::sleep_for(100ms);
- if (f._gsp.isInvoked.load(std::memory_order_relaxed)) {
- break;
- }
- }
- ASSERT_TRUE(f._gsp.isInvoked.load(std::memory_order_relaxed));
-}
-
TEST_F("require that a simple maintenance job is executed", MaintenanceControllerFixture)
{
auto job = std::make_unique<MySimpleJob>(200ms, 200ms, 3);
@@ -1061,13 +1007,13 @@ TEST_F("require that lid space compaction jobs can be disabled", MaintenanceCont
f.forwardMaintenanceConfig();
{
auto jobs = f._mc.getJobList();
- EXPECT_EQUAL(8u, jobs.size());
+ EXPECT_EQUAL(7u, jobs.size());
EXPECT_TRUE(containsJob(jobs, "lid_space_compaction.searchdocument.my_sub_db"));
}
f.setLidSpaceCompactionConfig(DocumentDBLidSpaceCompactionConfig::createDisabled());
{
auto jobs = f._mc.getJobList();
- EXPECT_EQUAL(5u, jobs.size());
+ EXPECT_EQUAL(4u, jobs.size());
EXPECT_FALSE(containsJob(jobs, "lid_space_compaction.searchdocument.my_sub_db"));
}
}
@@ -1076,9 +1022,8 @@ TEST_F("require that maintenance jobs are run by correct executor", MaintenanceC
{
f.injectMaintenanceJobs();
auto jobs = f._mc.getJobList();
- EXPECT_EQUAL(8u, jobs.size());
+ EXPECT_EQUAL(7u, jobs.size());
EXPECT_TRUE(containsJobAndExecutedBy(jobs, "heart_beat", f._threadService));
- EXPECT_TRUE(containsJobAndExecutedBy(jobs, "prune_session_cache", f._genericExecutor));
EXPECT_TRUE(containsJobAndExecutedBy(jobs, "prune_removed_documents.searchdocument", f._threadService));
EXPECT_TRUE(containsJobAndExecutedBy(jobs, "move_buckets.searchdocument", f._threadService));
EXPECT_TRUE(containsJobAndExecutedBy(jobs, "sample_attribute_usage.searchdocument", f._threadService));
diff --git a/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h b/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h
deleted file mode 100644
index b20363ee279..00000000000
--- a/searchcore/src/vespa/searchcore/proton/matching/isessioncachepruner.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/vespalib/util/time.h>
-
-namespace proton::matching {
-
-struct ISessionCachePruner {
- virtual ~ISessionCachePruner() {}
-
- virtual void pruneTimedOutSessions(vespalib::steady_time currentTime) = 0;
-};
-
-}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
index 4f319b7ad11..2a3b263ce98 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h
@@ -2,7 +2,6 @@
#pragma once
#include "search_session.h"
-#include "isessioncachepruner.h"
#include <vespa/searchcore/grouping/groupingsession.h>
#include <vespa/searchcore/grouping/sessionid.h>
#include <vespa/vespalib/stllike/lrucache_map.h>
@@ -14,7 +13,7 @@ using SessionId = vespalib::string;
struct GroupingSessionCache;
struct SearchSessionCache;
-class SessionManager : public ISessionCachePruner {
+class SessionManager {
public:
struct Stats {
Stats()
@@ -50,7 +49,7 @@ public:
typedef std::shared_ptr<SessionManager> SP;
SessionManager(uint32_t maxSizeGrouping);
- ~SessionManager() override;
+ ~SessionManager();
void insert(search::grouping::GroupingSession::UP session);
search::grouping::GroupingSession::UP pickGrouping(const SessionId &id);
@@ -62,7 +61,7 @@ public:
size_t getNumSearchSessions() const;
std::vector<SearchSessionInfo> getSortedSearchSessionInfo() const;
- void pruneTimedOutSessions(vespalib::steady_time currentTime) override;
+ void pruneTimedOutSessions(vespalib::steady_time currentTime);
void close();
};
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp
index d8c42795099..c2d09fa341b 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp
@@ -16,13 +16,23 @@ ContentProtonMetrics::ProtonExecutorMetrics::ProtonExecutorMetrics(metrics::Metr
{
}
+ContentProtonMetrics::SessionCacheMetrics::SessionCacheMetrics(metrics::MetricSet *parent)
+ : metrics::MetricSet("session_cache", {}, "Metrics for session caches (search / grouping requests)", parent),
+ search("search", this),
+ grouping("grouping", this)
+{
+}
+
+ContentProtonMetrics::SessionCacheMetrics::~SessionCacheMetrics() = default;
+
ContentProtonMetrics::ProtonExecutorMetrics::~ProtonExecutorMetrics() = default;
ContentProtonMetrics::ContentProtonMetrics()
: metrics::MetricSet("content.proton", {}, "Search engine metrics", nullptr),
transactionLog(this),
resourceUsage(this),
- executor(this)
+ executor(this),
+ sessionCache(this)
{
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h
index 70d3d16cb7c..127e32ada07 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h
@@ -5,6 +5,7 @@
#include "executor_metrics.h"
#include "resource_usage_metrics.h"
#include "trans_log_server_metrics.h"
+#include "sessionmanager_metrics.h"
namespace proton {
@@ -32,13 +33,21 @@ struct ContentProtonMetrics : metrics::MetricSet
~ProtonExecutorMetrics();
};
+ struct SessionCacheMetrics : metrics::MetricSet {
+ SessionManagerMetrics search;
+ SessionManagerMetrics grouping;
+
+ SessionCacheMetrics(metrics::MetricSet *parent);
+ ~SessionCacheMetrics() override;
+ };
+
TransLogServerMetrics transactionLog;
ResourceUsageMetrics resourceUsage;
ProtonExecutorMetrics executor;
+ SessionCacheMetrics sessionCache;
ContentProtonMetrics();
- ~ContentProtonMetrics();
-
+ ~ContentProtonMetrics() override;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
index f333af19ed3..d7a5de3a072 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
@@ -221,15 +221,6 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::update(const metri
}
}
-DocumentDBTaggedMetrics::SessionCacheMetrics::SessionCacheMetrics(metrics::MetricSet *parent)
- : metrics::MetricSet("session_cache", {}, "Metrics for session caches (search / grouping requests)", parent),
- search("search", this),
- grouping("grouping", this)
-{
-}
-
-DocumentDBTaggedMetrics::SessionCacheMetrics::~SessionCacheMetrics() = default;
-
DocumentDBTaggedMetrics::DocumentsMetrics::DocumentsMetrics(metrics::MetricSet *parent)
: metrics::MetricSet("documents", {}, "Metrics for various document counts in this document db", parent),
active("active", {}, "The number of active / searchable documents in this document db", this),
@@ -258,7 +249,6 @@ DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docType
removed("removed", this),
threadingService("threading_service", this),
matching(this),
- sessionCache(this),
documents(this),
bucketMove(this),
feeding(this),
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
index 7d3a50647b9..483bd38ab07 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h
@@ -4,7 +4,6 @@
#include "attribute_metrics.h"
#include "memory_usage_metrics.h"
#include "executor_threading_service_metrics.h"
-#include "sessionmanager_metrics.h"
#include "document_db_feeding_metrics.h"
#include <vespa/metrics/metricset.h>
#include <vespa/metrics/valuemetric.h>
@@ -165,14 +164,6 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
~MatchingMetrics() override;
};
- struct SessionCacheMetrics : metrics::MetricSet {
- SessionManagerMetrics search;
- SessionManagerMetrics grouping;
-
- SessionCacheMetrics(metrics::MetricSet *parent);
- ~SessionCacheMetrics() override;
- };
-
struct DocumentsMetrics : metrics::MetricSet {
metrics::LongValueMetric active;
metrics::LongValueMetric ready;
@@ -198,7 +189,6 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet
SubDBMetrics removed;
ExecutorThreadingServiceMetrics threadingService;
MatchingMetrics matching;
- SessionCacheMetrics sessionCache;
DocumentsMetrics documents;
BucketMoveMetrics bucketMove;
DocumentDBFeedingMetrics feeding;
diff --git a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
index 9e439161503..544e693b093 100644
--- a/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/server/CMakeLists.txt
@@ -82,7 +82,6 @@ vespa_add_library(searchcore_server STATIC
proton_configurer.cpp
proton_disk_layout.cpp
proton_thread_pools_explorer.cpp
- prune_session_cache_job.cpp
pruneremoveddocumentsjob.cpp
putdonecontext.cpp
reconfig_params.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp
index cabda2301b8..81765db24d4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/document_db_explorer.cpp
@@ -8,7 +8,6 @@
#include "documentdb.h"
#include <vespa/searchcore/proton/bucketdb/bucket_db_explorer.h>
#include <vespa/searchcore/proton/common/state_reporter_utils.h>
-#include <vespa/searchcore/proton/matching/session_manager_explorer.h>
#include <vespa/vespalib/data/slime/slime.h>
using vespalib::StateExplorer;
@@ -46,12 +45,11 @@ const vespalib::string SUB_DB = "subdb";
const vespalib::string THREADING_SERVICE = "threadingservice";
const vespalib::string BUCKET_DB = "bucketdb";
const vespalib::string MAINTENANCE_CONTROLLER = "maintenancecontroller";
-const vespalib::string SESSION = "session";
std::vector<vespalib::string>
DocumentDBExplorer::get_children_names() const
{
- return {SUB_DB, THREADING_SERVICE, BUCKET_DB, MAINTENANCE_CONTROLLER, SESSION};
+ return {SUB_DB, THREADING_SERVICE, BUCKET_DB, MAINTENANCE_CONTROLLER};
}
std::unique_ptr<StateExplorer>
@@ -67,10 +65,8 @@ DocumentDBExplorer::get_child(vespalib::stringref name) const
(const_cast<DocumentSubDBCollection &>(_docDb->getDocumentSubDBs())).getBucketDB().takeGuard());
} else if (name == MAINTENANCE_CONTROLLER) {
return std::make_unique<MaintenanceControllerExplorer>(_docDb->getMaintenanceController().getJobList());
- } else if (name == SESSION) {
- return std::make_unique<matching::SessionManagerExplorer>(_docDb->session_manager());
}
- return std::unique_ptr<StateExplorer>(nullptr);
+ return std::unique_ptr<StateExplorer>();
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.cpp b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.cpp
index b385becd58f..7e8a1a894bb 100644
--- a/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/document_db_maintenance_config.cpp
@@ -123,7 +123,6 @@ BucketMoveConfig::operator==(const BucketMoveConfig &rhs) const noexcept
DocumentDBMaintenanceConfig::DocumentDBMaintenanceConfig() noexcept
: _pruneRemovedDocuments(),
_heartBeat(),
- _sessionCachePruneInterval(900s),
_visibilityDelay(vespalib::duration::zero()),
_lidSpaceCompaction(),
_attributeUsageFilterConfig(),
@@ -138,7 +137,6 @@ DocumentDBMaintenanceConfig::~DocumentDBMaintenanceConfig() = default;
DocumentDBMaintenanceConfig::
DocumentDBMaintenanceConfig(const DocumentDBPruneConfig &pruneRemovedDocuments,
const DocumentDBHeartBeatConfig &heartBeat,
- vespalib::duration groupingSessionPruneInterval,
vespalib::duration visibilityDelay,
const DocumentDBLidSpaceCompactionConfig &lidSpaceCompaction,
const AttributeUsageFilterConfig &attributeUsageFilterConfig,
@@ -148,7 +146,6 @@ DocumentDBMaintenanceConfig(const DocumentDBPruneConfig &pruneRemovedDocuments,
const BucketMoveConfig & bucketMoveconfig) noexcept
: _pruneRemovedDocuments(pruneRemovedDocuments),
_heartBeat(heartBeat),
- _sessionCachePruneInterval(groupingSessionPruneInterval),
_visibilityDelay(visibilityDelay),
_lidSpaceCompaction(lidSpaceCompaction),
_attributeUsageFilterConfig(attributeUsageFilterConfig),
@@ -165,7 +162,6 @@ operator==(const DocumentDBMaintenanceConfig &rhs) const noexcept
return
_pruneRemovedDocuments == rhs._pruneRemovedDocuments &&
_heartBeat == rhs._heartBeat &&
- _sessionCachePruneInterval == rhs._sessionCachePruneInterval &&
_visibilityDelay == rhs._visibilityDelay &&
_lidSpaceCompaction == rhs._lidSpaceCompaction &&
_attributeUsageFilterConfig == rhs._attributeUsageFilterConfig &&
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 a2584be962c..2891f769a96 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
@@ -104,7 +104,6 @@ public:
private:
DocumentDBPruneConfig _pruneRemovedDocuments;
DocumentDBHeartBeatConfig _heartBeat;
- vespalib::duration _sessionCachePruneInterval;
vespalib::duration _visibilityDelay;
DocumentDBLidSpaceCompactionConfig _lidSpaceCompaction;
AttributeUsageFilterConfig _attributeUsageFilterConfig;
@@ -117,7 +116,6 @@ public:
DocumentDBMaintenanceConfig() noexcept;
DocumentDBMaintenanceConfig(const DocumentDBPruneConfig &pruneRemovedDocuments,
const DocumentDBHeartBeatConfig &heartBeat,
- vespalib::duration sessionCachePruneInterval,
vespalib::duration visibilityDelay,
const DocumentDBLidSpaceCompactionConfig &lidSpaceCompaction,
const AttributeUsageFilterConfig &attributeUsageFilterConfig,
@@ -140,9 +138,6 @@ public:
const DocumentDBHeartBeatConfig &getHeartBeatConfig() const noexcept {
return _heartBeat;
}
- vespalib::duration getSessionCachePruneInterval() const noexcept {
- return _sessionCachePruneInterval;
- }
vespalib::duration getVisibilityDelay() const noexcept { return _visibilityDelay; }
const DocumentDBLidSpaceCompactionConfig &getLidSpaceCompactionConfig() const noexcept {
return _lidSpaceCompaction;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 427f40d6116..6b62852aaae 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -30,6 +30,7 @@
#include <vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h>
#include <vespa/searchcore/proton/reference/document_db_reference_resolver.h>
#include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h>
+#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h>
#include <vespa/searchlib/attribute/configconverter.h>
#include <vespa/searchlib/engine/docsumreply.h>
@@ -206,7 +207,6 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
_indexCfg(makeIndexConfig(protonCfg.index)),
_replay_throttling_policy(std::make_unique<ReplayThrottlingPolicy>(make_replay_throttling_policy(protonCfg.replayThrottlingPolicy))),
_config_store(std::move(config_store)),
- _sessionManager(std::make_shared<matching::SessionManager>(protonCfg.grouping.sessionmanager.maxentries)),
_metricsWireService(metricsWireService),
_metrics(_docTypeName.getName(), protonCfg.numthreadspersearch),
_metricsHook(std::make_unique<MetricsUpdateHook>(*this)),
@@ -223,10 +223,10 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir,
_writeService, shared_service.warmup(), fileHeaderContext, std::move(attribute_interlock),
metricsWireService, getMetrics(), queryLimiter, shared_service.clock(),
_configMutex, _baseDir, hwInfo),
- _maintenanceController(shared_service.transport(), _writeService.master(), shared_service.shared(), _refCount, _docTypeName),
+ _maintenanceController(shared_service.transport(), _writeService.master(), _refCount, _docTypeName),
_jobTrackers(),
_calc(),
- _metricsUpdater(_subDBs, _writeService, _jobTrackers, *_sessionManager, _writeFilter, *_feedHandler)
+ _metricsUpdater(_subDBs, _writeService, _jobTrackers, _writeFilter, *_feedHandler)
{
assert(configSnapshot);
@@ -593,7 +593,6 @@ DocumentDB::close()
// matching, summary fetch, flushing and reconfig.
_feedView.clear();
_subDBs.clearViews();
- _sessionManager->close();
_state.enterDeadState();
}
@@ -945,7 +944,6 @@ DocumentDB::injectMaintenanceJobs(const DocumentDBMaintenanceConfig &config)
config,
_bucketExecutor,
*_feedHandler, // IHeartBeatHandler
- *_sessionManager, // ISessionCachePruner
*_feedHandler, // IOperationStorer
_subDBs.getBucketCreateNotifier(),
_bucketSpace,
@@ -1122,7 +1120,7 @@ DocumentDB::set_attribute_usage_listener(std::unique_ptr<IAttributeUsageListener
matching::SessionManager &
DocumentDB::session_manager() {
- return *_sessionManager;
+ return _owner.session_manager();
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index 2932d21b47e..09e54f518f7 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -36,6 +36,12 @@ namespace search {
class TransLogClient;
class WriterFactory;
}
+ namespace engine {
+ class SearchReply;
+ class SearchRequest;
+ class DocsumReply;
+ class DocsumRequest;
+ }
}
namespace vespa::config::search::core::internal { class InternalProtonType; }
@@ -119,7 +125,6 @@ private:
index::IndexConfig _indexCfg;
std::unique_ptr<ReplayThrottlingPolicy> _replay_throttling_policy;
ConfigStore::UP _config_store;
- std::shared_ptr<matching::SessionManager> _sessionManager; // TODO: This should not have to be a shared pointer.
MetricsWireService &_metricsWireService;
DocumentDBTaggedMetrics _metrics;
std::unique_ptr<metrics::UpdateHook> _metricsHook;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp
index 6b97d41e459..8844c2b5fda 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.cpp
@@ -32,13 +32,11 @@ using matching::MatchingStats;
DocumentDBMetricsUpdater::DocumentDBMetricsUpdater(const DocumentSubDBCollection &subDBs,
ExecutorThreadingService &writeService,
DocumentDBJobTrackers &jobTrackers,
- matching::SessionManager &sessionManager,
const AttributeUsageFilter &writeFilter,
FeedHandler& feed_handler)
: _subDBs(subDBs),
_writeService(writeService),
_jobTrackers(jobTrackers),
- _sessionManager(sessionManager),
_writeFilter(writeFilter),
_feed_handler(feed_handler),
_lastDocStoreCacheStats(),
@@ -185,16 +183,6 @@ updateMatchingMetrics(const metrics::MetricLockGuard & guard, DocumentDBTaggedMe
}
void
-updateSessionCacheMetrics(DocumentDBTaggedMetrics &metrics, proton::matching::SessionManager &sessionManager)
-{
- auto searchStats = sessionManager.getSearchStats();
- metrics.sessionCache.search.update(searchStats);
-
- auto groupingStats = sessionManager.getGroupingStats();
- metrics.sessionCache.grouping.update(groupingStats);
-}
-
-void
updateDocumentsMetrics(DocumentDBTaggedMetrics &metrics, const DocumentSubDBCollection &subDbs)
{
DocumentMetaStoreReadGuards dms(subDbs);
@@ -314,7 +302,6 @@ DocumentDBMetricsUpdater::updateMetrics(const metrics::MetricLockGuard & guard,
updateIndexMetrics(metrics, _subDBs.getReadySubDB()->getSearchableStats(), totalStats);
updateAttributeMetrics(metrics, _subDBs, totalStats);
updateMatchingMetrics(guard, metrics, *_subDBs.getReadySubDB());
- updateSessionCacheMetrics(metrics, _sessionManager);
updateDocumentsMetrics(metrics, _subDBs);
updateDocumentStoreMetrics(metrics, _subDBs, _lastDocStoreCacheStats, totalStats);
updateMiscMetrics(metrics, threadingServiceStats);
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h
index 3c9c2eca103..069bd47f0e3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb_metrics_updater.h
@@ -8,8 +8,6 @@
namespace proton {
-namespace matching { class SessionManager; }
-
class AttributeUsageFilter;
class DDBState;
class DocumentDBJobTrackers;
@@ -35,7 +33,6 @@ private:
const DocumentSubDBCollection &_subDBs;
ExecutorThreadingService &_writeService;
DocumentDBJobTrackers &_jobTrackers;
- matching::SessionManager &_sessionManager;
const AttributeUsageFilter &_writeFilter;
FeedHandler &_feed_handler;
// Last updated document store cache statistics. Necessary due to metrics implementation is upside down.
@@ -49,7 +46,6 @@ public:
DocumentDBMetricsUpdater(const DocumentSubDBCollection &subDBs,
ExecutorThreadingService &writeService,
DocumentDBJobTrackers &jobTrackers,
- matching::SessionManager &sessionManager,
const AttributeUsageFilter &writeFilter,
FeedHandler& feed_handler);
~DocumentDBMetricsUpdater();
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
index e2ab04e4f2e..18237b67a35 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp
@@ -126,7 +126,6 @@ buildMaintenanceConfig(const BootstrapConfig::SP &bootstrapConfig,
DocumentDBPruneConfig(pruneRemovedDocumentsInterval,
pruneRemovedDocumentsAge),
DocumentDBHeartBeatConfig(),
- vespalib::from_s(proton.grouping.sessionmanager.pruning.interval),
visibilityDelay,
DocumentDBLidSpaceCompactionConfig(
vespalib::from_s(proton.lidspacecompaction.interval),
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 6c684ce4c99..48ce0f37c28 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
@@ -12,7 +12,6 @@
#include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h>
#include <vespa/searchcore/proton/attribute/filter_attribute_manager.h>
#include <vespa/searchcore/proton/common/alloc_config.h>
-#include <vespa/searchcore/proton/matching/sessionmanager.h>
#include <vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h>
#include <vespa/searchcore/proton/reprocessing/reprocess_documents_task.h>
#include <vespa/vespalib/util/destructor_callbacks.h>
@@ -20,7 +19,6 @@
#include <vespa/log/log.h>
LOG_SETUP(".proton.server.fast_access_doc_subdb");
-using proton::matching::SessionManager;
using search::AttributeGuard;
using search::AttributeVector;
using search::SerialNum;
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 9521356ceee..c188bcc432d 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.cpp
@@ -6,7 +6,6 @@
#include "job_tracked_maintenance_job.h"
#include "lid_space_compaction_job.h"
#include "lid_space_compaction_handler.h"
-#include "prune_session_cache_job.h"
#include "pruneremoveddocumentsjob.h"
#include "sample_attribute_usage_job.h"
@@ -72,7 +71,6 @@ MaintenanceJobsInjector::injectJobs(MaintenanceController &controller,
const DocumentDBMaintenanceConfig &config,
storage::spi::BucketExecutor & bucketExecutor,
IHeartBeatHandler &hbHandler,
- matching::ISessionCachePruner &scPruner,
IOperationStorer &opStorer,
bucketdb::IBucketCreateNotifier &bucketCreateNotifier,
document::BucketSpace bucketSpace,
@@ -89,8 +87,6 @@ MaintenanceJobsInjector::injectJobs(MaintenanceController &controller,
AttributeUsageFilter &attributeUsageFilter)
{
controller.registerJobInMasterThread(std::make_unique<HeartBeatJob>(hbHandler, config.getHeartBeatConfig()));
- controller.registerJobInSharedExecutor(
- std::make_unique<PruneSessionCacheJob>(scPruner, config.getSessionCachePruneInterval()));
const auto & docTypeName = controller.getDocTypeName().getName();
const MaintenanceDocumentSubDB &mRemSubDB(controller.getRemSubDB());
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 1dcfafaa645..980c0cea19a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_jobs_injector.h
@@ -6,7 +6,6 @@
#include "i_lid_space_compaction_handler.h"
#include "i_operation_storer.h"
#include "iheartbeathandler.h"
-#include <vespa/searchcore/proton/matching/isessioncachepruner.h>
#include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h>
namespace storage::spi {struct BucketExecutor; }
@@ -34,7 +33,6 @@ struct MaintenanceJobsInjector
const DocumentDBMaintenanceConfig &config,
storage::spi::BucketExecutor & bucketExecutor,
IHeartBeatHandler &hbHandler,
- matching::ISessionCachePruner &scPruner,
IOperationStorer &opStorer,
bucketdb::IBucketCreateNotifier &bucketCreateNotifier,
document::BucketSpace bucketSpace,
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp
index 2688db36659..c95efbca944 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp
@@ -41,11 +41,9 @@ isRunnable(const MaintenanceJobRunner & job, const Executor * master) {
MaintenanceController::MaintenanceController(FNET_Transport & transport,
ISyncableThreadService& masterThread,
- vespalib::Executor& shared_executor,
MonitoredRefCount& refCount,
const DocTypeName& docTypeName)
: _masterThread(masterThread),
- _shared_executor(shared_executor),
_refCount(refCount),
_readySubDB(),
_remSubDB(),
@@ -70,13 +68,6 @@ MaintenanceController::registerJobInMasterThread(IMaintenanceJob::UP job)
}
void
-MaintenanceController::registerJobInSharedExecutor(IMaintenanceJob::UP job)
-{
- // Called by master write thread
- registerJob(_shared_executor, std::move(job));
-}
-
-void
MaintenanceController::registerJob(Executor & executor, IMaintenanceJob::UP job)
{
// Called by master write thread
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.h b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.h
index b4182c254f5..a2e5105f426 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.h
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.h
@@ -41,12 +41,11 @@ public:
using UP = std::unique_ptr<MaintenanceController>;
enum class State {INITIALIZING, STARTED, PAUSED, STOPPING};
- MaintenanceController(FNET_Transport & transport, ISyncableThreadService& masterThread, vespalib::Executor& shared_executor,
+ MaintenanceController(FNET_Transport & transport, ISyncableThreadService& masterThread,
vespalib::MonitoredRefCount& refCount, const DocTypeName& docTypeName);
~MaintenanceController();
void registerJobInMasterThread(IMaintenanceJob::UP job);
- void registerJobInSharedExecutor(IMaintenanceJob::UP job);
void killJobs();
@@ -82,7 +81,6 @@ private:
using Guard = std::lock_guard<Mutex>;
ISyncableThreadService &_masterThread;
- vespalib::Executor &_shared_executor;
vespalib::MonitoredRefCount &_refCount;
MaintenanceDocumentSubDB _readySubDB;
MaintenanceDocumentSubDB _remSubDB;
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 3b1a88774b7..5c82b6e74ae 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -32,6 +32,8 @@
#include <vespa/searchcore/proton/persistenceengine/persistenceengine.h>
#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
#include <vespa/searchcore/proton/summaryengine/summaryengine.h>
+#include <vespa/searchcore/proton/matching/session_manager_explorer.h>
+#include <vespa/searchcore/proton/common/scheduled_forward_executor.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/common/packets.h>
#include <vespa/searchlib/transactionlog/trans_log_server_explorer.h>
@@ -254,6 +256,8 @@ Proton::Proton(FastOS_ThreadPool & threadPool, FNET_Transport & transport, const
_protonConfigurer(_executor, *this, _protonDiskLayout),
_protonConfigFetcher(_transport, configUri, _protonConfigurer, subscribeTimeout),
_shared_service(),
+ _sessionManager(),
+ _scheduler(),
_compile_cache_executor_binding(),
_queryLimiter(),
_distributionKey(-1),
@@ -307,6 +311,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot)
_distributionKey = protonConfig.distributionkey;
_summaryEngine = std::make_unique<SummaryEngine>(protonConfig.numsummarythreads, protonConfig.docsum.async);
_summaryEngine->set_issue_forwarding(protonConfig.forwardIssues);
+ _sessionManager = std::make_unique<matching::SessionManager>(protonConfig.grouping.sessionmanager.maxentries);
IFlushStrategy::SP strategy;
const ProtonConfig::Flush & flush(protonConfig.flush);
@@ -342,6 +347,7 @@ Proton::init(const BootstrapConfig::SP & configSnapshot)
protonConfig.visit.ignoremaxbytes);
_shared_service = std::make_unique<SharedThreadingService>(
SharedThreadingServiceConfig::make(protonConfig, hwInfo.cpu()), _transport, *_persistenceEngine);
+ _scheduler = std::make_unique<ScheduledForwardExecutor>(_transport, _shared_service->shared());
vespalib::string fileConfigId;
_compile_cache_executor_binding = vespalib::eval::CompileCache::bind(_shared_service->shared_raw());
@@ -373,6 +379,8 @@ Proton::init(const BootstrapConfig::SP & configSnapshot)
_rpcHooks->set_online();
_flushEngine->start();
+ vespalib::duration pruneSessionsInterval = vespalib::from_s(protonConfig.grouping.sessionmanager.pruning.interval);
+ _scheduler->scheduleAtFixedRate(makeLambdaTask([&]() { _sessionManager->pruneTimedOutSessions(vespalib::steady_clock::now()); }), pruneSessionsInterval, pruneSessionsInterval);
_isInitializing = false;
_protonConfigurer.setAllowReconfig(true);
_initComplete = true;
@@ -461,6 +469,7 @@ Proton::~Proton()
if (_memoryFlushConfigUpdater) {
_diskMemUsageSampler->notifier().removeDiskMemUsageListener(_memoryFlushConfigUpdater.get());
}
+ _scheduler->reset();
_executor.shutdown();
_executor.sync();
_rpcHooks.reset();
@@ -485,6 +494,7 @@ Proton::~Proton()
CpuUsage::wrap(proton_close_executor, CpuCategory::SETUP));
closeDocumentDBs(closePool);
}
+ _sessionManager->close();
_documentDBMap.clear();
_persistenceEngine.reset();
_tls.reset();
@@ -764,6 +774,16 @@ updateExecutorMetrics(ExecutorMetrics &metrics, const vespalib::ExecutorStats &s
metrics.update(stats);
}
+void
+updateSessionCacheMetrics(ContentProtonMetrics &metrics, proton::matching::SessionManager &sessionManager)
+{
+ auto searchStats = sessionManager.getSearchStats();
+ metrics.sessionCache.search.update(searchStats);
+
+ auto groupingStats = sessionManager.getGroupingStats();
+ metrics.sessionCache.grouping.update(groupingStats);
+}
+
}
void
@@ -810,6 +830,7 @@ Proton::updateMetrics(const metrics::MetricLockGuard &)
metrics.resourceUsage.cpu_util.write.set(cpu_util[CpuCategory::WRITE]);
metrics.resourceUsage.cpu_util.compact.set(cpu_util[CpuCategory::COMPACT]);
metrics.resourceUsage.cpu_util.other.set(cpu_util[CpuCategory::OTHER]);
+ updateSessionCacheMetrics(metrics, session_manager());
}
{
ContentProtonMetrics::ProtonExecutorMetrics &metrics = _metricsEngine->root().executor;
@@ -829,6 +850,7 @@ Proton::updateMetrics(const metrics::MetricLockGuard &)
metrics.field_writer.update(_shared_service->field_writer().getStats());
}
}
+
}
void
@@ -915,6 +937,8 @@ const vespalib::string TLS_NAME = "tls";
const vespalib::string RESOURCE_USAGE = "resourceusage";
const vespalib::string THREAD_POOLS = "threadpools";
const vespalib::string HW_INFO = "hwinfo";
+const vespalib::string SESSION = "session";
+
struct StateExplorerProxy : vespalib::StateExplorer {
const StateExplorer &explorer;
@@ -959,7 +983,7 @@ Proton::get_state(const vespalib::slime::Inserter &, bool) const
std::vector<vespalib::string>
Proton::get_children_names() const
{
- return {DOCUMENT_DB, THREAD_POOLS, MATCH_ENGINE, FLUSH_ENGINE, TLS_NAME, HW_INFO, RESOURCE_USAGE};
+ return {DOCUMENT_DB, THREAD_POOLS, MATCH_ENGINE, FLUSH_ENGINE, TLS_NAME, HW_INFO, RESOURCE_USAGE, SESSION};
}
std::unique_ptr<vespalib::StateExplorer>
@@ -987,6 +1011,8 @@ Proton::get_child(vespalib::stringref name) const
} else if (name == HW_INFO) {
return std::make_unique<HwInfoExplorer>(_hw_info);
+ } else if (name == SESSION) {
+ return std::make_unique<matching::SessionManagerExplorer>(*_sessionManager);
}
return {};
}
@@ -999,8 +1025,7 @@ Proton::getDocumentDBReferenceRegistry() const
matching::SessionManager &
Proton::session_manager() {
- // Temporary and will not be called used yet
- abort();
+ return *_sessionManager;
}
storage::spi::PersistenceProvider &
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h
index 235bd120821..8e1d1dedc59 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.h
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.h
@@ -50,6 +50,7 @@ class MetricsEngine;
class PersistenceEngine;
class PrepareRestartHandler;
class SummaryEngine;
+class ScheduledForwardExecutor;
class Proton : public IProtonConfigurerOwner,
public search::engine::MonitorServer,
@@ -112,7 +113,9 @@ private:
std::unique_ptr<IProtonDiskLayout> _protonDiskLayout;
ProtonConfigurer _protonConfigurer;
ProtonConfigFetcher _protonConfigFetcher;
- std::unique_ptr<SharedThreadingService> _shared_service;
+ std::unique_ptr<SharedThreadingService> _shared_service;
+ std::unique_ptr<matching::SessionManager> _sessionManager;
+ std::unique_ptr<ScheduledForwardExecutor> _scheduler;
vespalib::eval::CompileCache::ExecutorBinding::UP _compile_cache_executor_binding;
matching::QueryLimiter _queryLimiter;
uint32_t _distributionKey;
diff --git a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp
deleted file mode 100644
index 080d0b4e16e..00000000000
--- a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "prune_session_cache_job.h"
-
-namespace proton {
-
-using matching::ISessionCachePruner;
-
-PruneSessionCacheJob::PruneSessionCacheJob(ISessionCachePruner &pruner, vespalib::duration jobInterval)
- : IMaintenanceJob("prune_session_cache", jobInterval, jobInterval),
- _pruner(pruner)
-{
-}
-
-bool
-PruneSessionCacheJob::run()
-{
- _pruner.pruneTimedOutSessions(vespalib::steady_clock::now());
- return true;
-}
-
-} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h
deleted file mode 100644
index 23ee40e48f6..00000000000
--- a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright Yahoo. 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/searchcore/proton/matching/isessioncachepruner.h>
-
-namespace proton {
-
-/**
- * Job that regularly prunes a session cache.
- */
-class PruneSessionCacheJob : public IMaintenanceJob
-{
-private:
- matching::ISessionCachePruner &_pruner;
-
-public:
- PruneSessionCacheJob(matching::ISessionCachePruner &pruner, vespalib::duration jobInterval);
- bool run() override;
- void onStop() override { }
-};
-
-} // namespace proton
-
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index e95c98e2740..6647148657a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -18,7 +18,6 @@
#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchcore/proton/flushengine/threadedflushtarget.h>
#include <vespa/searchcore/proton/index/index_writer.h>
-#include <vespa/searchcore/proton/matching/sessionmanager.h>
#include <vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h>
#include <vespa/searchlib/attribute/configconverter.h>
#include <vespa/searchlib/common/flush_token.h>
@@ -39,7 +38,6 @@ using search::SerialNum;
using vespalib::IllegalStateException;
using vespalib::ThreadStackExecutorBase;
using proton::matching::MatchingStats;
-using proton::matching::SessionManager;
using vespalib::GenericHeader;
using search::common::FileHeaderContext;
using proton::initializer::InitializerTask;
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
index c29af41cdd3..24504c92cb2 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
@@ -10,7 +10,6 @@
#include <vespa/searchcore/proton/server/isummaryadapter.h>
#include <vespa/searchcore/proton/index/i_index_writer.h>
#include <vespa/searchcore/proton/server/ifeedview.h>
-#include <vespa/searchcore/proton/matching/sessionmanager.h>
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h>
#include <vespa/searchcore/proton/server/reconfig_params.h>