aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2024-02-06 11:55:44 +0100
committerGitHub <noreply@github.com>2024-02-06 11:55:44 +0100
commitfcca2419ded121767da85b563efb7a634533bae1 (patch)
tree6197c9b73b894355a898946b07e4c452ba307254 /searchcore/src
parentd3fcc36ca517a265d97deff359353c61bffe14f7 (diff)
parente86cf515390baf466781456b5da0bd20c9e9e8bb (diff)
Merge pull request #30186 from vespa-engine/toregge/track-oldest-config-generation-used-for-streaming-search
Track oldest config generation used for streaming search.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/apps/proton/proton.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp
index 4c20c40b406..e967c012bbe 100644
--- a/searchcore/src/apps/proton/proton.cpp
+++ b/searchcore/src/apps/proton/proton.cpp
@@ -105,6 +105,7 @@ class ProtonServiceLayerProcess : public storage::ServiceLayerProcess {
FNET_Transport& _transport;
vespalib::string _file_distributor_connection_spec;
metrics::MetricManager* _metricManager;
+ std::weak_ptr<streaming::SearchVisitorFactory> _search_visitor_factory;
public:
ProtonServiceLayerProcess(const config::ConfigUri & configUri,
@@ -137,7 +138,8 @@ ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri & c
_proton(proton),
_transport(transport),
_file_distributor_connection_spec(file_distributor_connection_spec),
- _metricManager(nullptr)
+ _metricManager(nullptr),
+ _search_visitor_factory()
{
setMetricManager(_proton.getMetricManager());
}
@@ -167,13 +169,23 @@ ProtonServiceLayerProcess::getGeneration() const
{
int64_t slGen = storage::ServiceLayerProcess::getGeneration();
int64_t protonGen = _proton.getConfigGeneration();
- return std::min(slGen, protonGen);
+ int64_t gen = std::min(slGen, protonGen);
+ auto factory = _search_visitor_factory.lock();
+ if (factory) {
+ auto factory_gen = factory->get_oldest_config_generation();
+ if (factory_gen.has_value()) {
+ gen = std::min(gen, factory_gen.value());
+ }
+ }
+ return gen;
}
void
ProtonServiceLayerProcess::add_external_visitors()
{
- _externalVisitors["searchvisitor"] = std::make_shared<streaming::SearchVisitorFactory>(_configUri, &_transport, _file_distributor_connection_spec);
+ auto factory = std::make_shared<streaming::SearchVisitorFactory>(_configUri, &_transport, _file_distributor_connection_spec);
+ _search_visitor_factory = factory;
+ _externalVisitors["searchvisitor"] = factory;
}
namespace {