summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp25
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp5
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h16
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp31
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/fef/indexproperties.h1
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h9
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/irequestcontext.h4
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h1
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h1
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/doom.h18
21 files changed, 111 insertions, 84 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index b519e6a8dc7..839228b79b8 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -24,6 +24,7 @@
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/document/update/documentupdate.h>
#include <vespa/searchlib/index/docbuilder.h>
+#include <vespa/vespalib/util/time.h>
#include <vespa/log/log.h>
LOG_SETUP("feedview_test");
@@ -524,7 +525,7 @@ struct FixtureBase
CommitTimeTracker _commitTimeTracker;
SerialNum serial;
std::shared_ptr<MyGidToLidChangeHandler> _gidToLidChangeHandler;
- FixtureBase(TimeStamp visibilityDelay);
+ FixtureBase(vespalib::duration visibilityDelay);
virtual ~FixtureBase();
@@ -689,7 +690,7 @@ struct FixtureBase
};
-FixtureBase::FixtureBase(TimeStamp visibilityDelay)
+FixtureBase::FixtureBase(vespalib::duration visibilityDelay)
: _tracer(),
sc(),
iw(new MyIndexWriter(_tracer)),
@@ -706,12 +707,12 @@ FixtureBase::FixtureBase(TimeStamp visibilityDelay)
_writeServiceReal(_sharedExecutor),
_writeService(_writeServiceReal),
_lidReuseDelayer(_writeService, _dmsc->get()),
- _commitTimeTracker(visibilityDelay),
+ _commitTimeTracker(vespalib::count_ns(visibilityDelay)),
serial(0),
_gidToLidChangeHandler(std::make_shared<MyGidToLidChangeHandler>())
{
_dmsc->constructFreeList();
- _lidReuseDelayer.setImmediateCommit(visibilityDelay == 0);
+ _lidReuseDelayer.setImmediateCommit(visibilityDelay == vespalib::duration::zero());
}
FixtureBase::~FixtureBase() {
@@ -728,7 +729,7 @@ FixtureBase::populateBeforeCompactLidSpace()
struct SearchableFeedViewFixture : public FixtureBase
{
SearchableFeedView fv;
- SearchableFeedViewFixture(TimeStamp visibilityDelay = 0) :
+ SearchableFeedViewFixture(vespalib::duration visibilityDelay = 0ms) :
FixtureBase(visibilityDelay),
fv(StoreOnlyFeedView::Context(sa,
sc._schema,
@@ -750,7 +751,7 @@ struct SearchableFeedViewFixture : public FixtureBase
struct FastAccessFeedViewFixture : public FixtureBase
{
FastAccessFeedView fv;
- FastAccessFeedViewFixture(TimeStamp visibilityDelay = 0) :
+ FastAccessFeedViewFixture(vespalib::duration visibilityDelay = vespalib::duration::zero()) :
FixtureBase(visibilityDelay),
fv(StoreOnlyFeedView::Context(sa,
sc._schema,
@@ -1206,8 +1207,8 @@ TEST_F("require that commit is called if visibility delay is 0",
"ack(Result(0, ))");
}
-const TimeStamp LONG_DELAY(TimeStamp::Seconds(60.0));
-const TimeStamp SHORT_DELAY(TimeStamp::Seconds(0.5));
+const vespalib::duration LONG_DELAY = 60s;
+const vespalib::duration SHORT_DELAY = 500ms;
TEST_F("require that commit is not called when inside a commit interval",
SearchableFeedViewFixture(LONG_DELAY))
@@ -1232,13 +1233,13 @@ TEST_F("require that commit is not called when inside a commit interval",
TEST_F("require that commit is called when crossing a commit interval",
SearchableFeedViewFixture(SHORT_DELAY))
{
- FastOS_Thread::Sleep(SHORT_DELAY.ms() + 100);
+ std::this_thread::sleep_for(SHORT_DELAY + 100ms);
DocumentContext dc = f.doc1();
f.putAndWait(dc);
EXPECT_EQUAL(1u, f.miw._commitCount);
EXPECT_EQUAL(1u, f.maw._commitCount);
EXPECT_EQUAL(2u, f._docIdLimit.get());
- FastOS_Thread::Sleep(SHORT_DELAY.ms() + 100);
+ std::this_thread::sleep_for(SHORT_DELAY + 100ms);
f.removeAndWait(dc);
EXPECT_EQUAL(2u, f.miw._commitCount);
EXPECT_EQUAL(2u, f.maw._commitCount);
@@ -1257,13 +1258,13 @@ TEST_F("require that commit is not implicitly called after handover to maintenan
SearchableFeedViewFixture(SHORT_DELAY))
{
f._commitTimeTracker.setReplayDone();
- FastOS_Thread::Sleep(SHORT_DELAY.ms() + 100);
+ std::this_thread::sleep_for(SHORT_DELAY + 100ms);
DocumentContext dc = f.doc1();
f.putAndWait(dc);
EXPECT_EQUAL(0u, f.miw._commitCount);
EXPECT_EQUAL(0u, f.maw._commitCount);
EXPECT_EQUAL(0u, f._docIdLimit.get());
- FastOS_Thread::Sleep(SHORT_DELAY.ms() + 100);
+ std::this_thread::sleep_for(SHORT_DELAY + 100ms);
f.removeAndWait(dc);
EXPECT_EQUAL(0u, f.miw._commitCount);
EXPECT_EQUAL(0u, f.maw._commitCount);
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index c732da58dd7..fdd53d629ad 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -34,6 +34,7 @@
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/vespalib/util/gate.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
+#include <vespa/fastos/thread.h>
#include <unistd.h>
#include <vespa/log/log.h>
@@ -785,9 +786,7 @@ MyExecutor::MyExecutor()
}
-MyExecutor::~MyExecutor()
-{
-}
+MyExecutor::~MyExecutor() = default;
bool
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index be70bacb4b1..e28e25560d4 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -26,12 +26,12 @@ public:
class RequestContextTest : public ::testing::Test {
private:
- vespalib::Clock _clock;
- vespalib::Doom _doom;
- MyAttributeContext _attr_ctx;
- Properties _props;
- RequestContext _request_ctx;
- Value::UP _query_tensor;
+ vespalib::Clock _clock;
+ vespalib::CombinedDoom _doom;
+ MyAttributeContext _attr_ctx;
+ Properties _props;
+ RequestContext _request_ctx;
+ Value::UP _query_tensor;
void insert_tensor_in_properties(const vespalib::string& tensor_name, const Value& tensor_value) {
vespalib::nbostream stream;
@@ -42,7 +42,7 @@ private:
public:
RequestContextTest()
: _clock(),
- _doom(_clock, fastos::SteadyTimeStamp()),
+ _doom(_clock, fastos::SteadyTimeStamp::ZERO, fastos::SteadyTimeStamp::ZERO, false),
_attr_ctx(),
_props(),
_request_ctx(_doom, _attr_ctx, _props),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.h b/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.h
index fe9c20112f4..5a4ccc892b3 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/fakesearchcontext.h
@@ -6,6 +6,7 @@
#include <vespa/searchcorespi/index/fakeindexsearchable.h>
#include <vespa/searchcorespi/index/indexcollection.h>
#include <vespa/searchlib/attribute/fixedsourceselector.h>
+#include <vespa/vespalib/util/doom.h>
#include <algorithm>
#include <map>
#include <vector>
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index afdae5eec2e..f9ba34d7830 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -79,7 +79,7 @@ MatchThread::Context::Context(double rankDropLimit, MatchTools &tools, HitCollec
_ranking(tools.rank_program()),
_rankDropLimit(rankDropLimit),
_hits(hits),
- _softDoom(tools.getSoftDoom())
+ _softDoom(tools.getDoom().soft())
{
}
@@ -307,7 +307,7 @@ MatchThread::findMatches(MatchTools &tools)
auto kept_hits = communicator.selectBest(sorted_hit_seq);
select_best_timer.done();
DocumentScorer scorer(tools.rank_program(), tools.search());
- if (tools.getHardDoom().doom()) {
+ if (tools.getDoom().hard().doom()) {
kept_hits.clear();
}
uint32_t reRanked = hits.reRank(scorer, std::move(kept_hits));
@@ -432,19 +432,19 @@ MatchThread::run()
MatchTools::UP matchTools = matchToolsFactory.createMatchTools();
search::ResultSet::UP result = findMatches(*matchTools);
match_time_s = match_time.elapsed().sec();
- resultContext = resultProcessor.createThreadContext(matchTools->getHardDoom(), thread_id, _distributionKey);
+ resultContext = resultProcessor.createThreadContext(matchTools->getDoom().hard(), thread_id, _distributionKey);
{
trace->addEvent(5, "Wait for result processing token");
WaitTimer get_token_timer(wait_time_s);
QueryLimiter::Token::UP processToken(
- matchTools->getQueryLimiter().getToken(matchTools->getHardDoom(),
+ matchTools->getQueryLimiter().getToken(matchTools->getDoom().hard(),
scheduler.total_size(thread_id),
result->getNumHits(),
resultContext->sort->hasSortData(),
resultContext->grouping.get() != 0));
get_token_timer.done();
trace->addEvent(5, "Start result processing");
- processResult(matchTools->getHardDoom(), std::move(result), *resultContext);
+ processResult(matchTools->getDoom().hard(), std::move(result), *resultContext);
}
total_time_s = total_time.elapsed().sec();
thread_stats.active_time(total_time_s - wait_time_s).wait_time(wait_time_s);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index dca77f35019..95c9b200bb6 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -75,14 +75,14 @@ private:
bool isAtLimit() const { return matches == _matches_limit; }
bool atSoftDoom() const { return _softDoom.doom(); }
fastos::TimeStamp timeLeft() const { return _softDoom.left(); }
- uint32_t matches;
+ uint32_t matches;
private:
- uint32_t _matches_limit;
- LazyValue _score_feature;
- RankProgram &_ranking;
- double _rankDropLimit;
- HitCollector &_hits;
- const Doom &_softDoom;
+ uint32_t _matches_limit;
+ LazyValue _score_feature;
+ RankProgram &_ranking;
+ double _rankDropLimit;
+ HitCollector &_hits;
+ const Doom &_softDoom;
};
double estimate_match_frequency(uint32_t matches, uint32_t searchedSoFar) __attribute__((noinline));
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index 67c1fb25b64..d4c910f7b96 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -89,8 +89,7 @@ MatchTools::setup(search::fef::RankProgram::UP rank_program, double termwise_lim
}
MatchTools::MatchTools(QueryLimiter & queryLimiter,
- const vespalib::Doom & softDoom,
- const vespalib::Doom & hardDoom,
+ const vespalib::CombinedDoom & doom,
const Query &query,
MaybeMatchPhaseLimiter & match_limiter_in,
const QueryEnvironment & queryEnv,
@@ -98,8 +97,7 @@ MatchTools::MatchTools(QueryLimiter & queryLimiter,
const RankSetup & rankSetup,
const Properties & featureOverrides)
: _queryLimiter(queryLimiter),
- _softDoom(softDoom),
- _hardDoom(hardDoom),
+ _doom(doom),
_query(query),
_match_limiter(match_limiter_in),
_queryEnv(queryEnv),
@@ -149,8 +147,7 @@ MatchTools::setup_dump()
MatchToolsFactory::
MatchToolsFactory(QueryLimiter & queryLimiter,
- const vespalib::Doom & softDoom,
- const vespalib::Doom & hardDoom,
+ const vespalib::CombinedDoom & doom,
ISearchContext & searchContext,
IAttributeContext & attributeContext,
vespalib::stringref queryStack,
@@ -162,8 +159,7 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
const Properties & rankProperties,
const Properties & featureOverrides)
: _queryLimiter(queryLimiter),
- _requestContext(softDoom, attributeContext, rankProperties),
- _hardDoom(hardDoom),
+ _requestContext(doom, attributeContext, rankProperties),
_query(),
_match_limiter(),
_queryEnv(indexEnv, attributeContext, rankProperties, searchContext.getIndexes()),
@@ -204,7 +200,7 @@ MatchTools::UP
MatchToolsFactory::createMatchTools() const
{
assert(_valid);
- return std::make_unique<MatchTools>(_queryLimiter, _requestContext.getSoftDoom(), _hardDoom, _query,
+ return std::make_unique<MatchTools>(_queryLimiter, _requestContext.getDoom(), _query,
*_match_limiter, _queryEnv, _mdl, _rankSetup, _featureOverrides);
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index 777652c6b89..0dd612d404a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -28,8 +28,7 @@ class MatchTools
private:
using IRequestContext = search::queryeval::IRequestContext;
QueryLimiter &_queryLimiter;
- const vespalib::Doom &_softDoom;
- const vespalib::Doom &_hardDoom;
+ const vespalib::CombinedDoom &_doom;
const Query &_query;
MaybeMatchPhaseLimiter &_match_limiter;
const QueryEnvironment &_queryEnv;
@@ -46,8 +45,7 @@ public:
MatchTools(const MatchTools &) = delete;
MatchTools & operator = (const MatchTools &) = delete;
MatchTools(QueryLimiter & queryLimiter,
- const vespalib::Doom & softDoom,
- const vespalib::Doom & hardDoom,
+ const vespalib::CombinedDoom & doom,
const Query &query,
MaybeMatchPhaseLimiter &match_limiter_in,
const QueryEnvironment &queryEnv,
@@ -55,8 +53,7 @@ public:
const search::fef::RankSetup &rankSetup,
const search::fef::Properties &featureOverrides);
~MatchTools();
- const vespalib::Doom &getSoftDoom() const { return _softDoom; }
- const vespalib::Doom &getHardDoom() const { return _hardDoom; }
+ const vespalib::CombinedDoom &getDoom() const { return _doom; }
QueryLimiter & getQueryLimiter() { return _queryLimiter; }
MaybeMatchPhaseLimiter &match_limiter() { return _match_limiter; }
bool has_second_phase_rank() const;
@@ -87,13 +84,12 @@ private:
vespalib::string _operation;
};
-class MatchToolsFactory : public vespalib::noncopyable
+class MatchToolsFactory
{
private:
using IAttributeFunctor = search::attribute::IAttributeFunctor;
QueryLimiter & _queryLimiter;
RequestContext _requestContext;
- const vespalib::Doom _hardDoom;
Query _query;
MaybeMatchPhaseLimiter::UP _match_limiter;
QueryEnvironment _queryEnv;
@@ -110,8 +106,7 @@ public:
using BasicType = search::attribute::BasicType;
MatchToolsFactory(QueryLimiter & queryLimiter,
- const vespalib::Doom & softDoom,
- const vespalib::Doom & hardDoom,
+ const vespalib::CombinedDoom & softDoom,
ISearchContext &searchContext,
search::attribute::IAttributeContext &attributeContext,
vespalib::stringref queryStack,
@@ -135,6 +130,7 @@ public:
std::unique_ptr<AttributeOperationTask> createOnSummaryTask() const;
const Query & query() const { return _query; }
+ const RequestContext & getRequestContext() const { return _requestContext; }
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 2764bfb96df..85169e70697 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -128,19 +128,22 @@ Matcher::create_match_tools_factory(const search::engine::Request &request, ISea
{
const Properties & rankProperties = request.propertiesMap.rankProperties();
bool softTimeoutEnabled = Enabled::lookup(rankProperties, _rankSetup->getSoftTimeoutEnabled());
+ bool hasFactorOverride = Factor::isPresent(rankProperties);
double factor = softTimeoutEnabled
- ? Factor::lookup(rankProperties, _stats.softDoomFactor())
+ ? ( hasFactorOverride
+ ? Factor::lookup(rankProperties, _stats.softDoomFactor())
+ : _stats.softDoomFactor())
: 0.95;
int64_t safeLeft = request.getTimeLeft() * factor;
fastos::SteadyTimeStamp safeDoom(_clock.getTimeNSAssumeRunning() + safeLeft);
if (softTimeoutEnabled) {
- LOG(debug, "Soft-timeout computed factor=%1.3f, used factor=%1.3f, softTimeout=%" PRId64,
- _stats.softDoomFactor(), factor, safeLeft);
+ LOG(debug, "Soft-timeout computed factor=%1.3f, used factor=%1.3f, userSupplied=%d, softTimeout=%" PRId64,
+ _stats.softDoomFactor(), factor, hasFactorOverride, safeLeft);
}
- return std::make_unique<MatchToolsFactory>(_queryLimiter, vespalib::Doom(_clock, safeDoom),
- vespalib::Doom(_clock, request.getTimeOfDoom()), searchContext,
- attrContext, request.getStackRef(), request.location, _viewResolver,
- metaStore, _indexEnv, *_rankSetup, rankProperties, feature_overrides);
+ vespalib::CombinedDoom doom(_clock, safeDoom, request.getTimeOfDoom(), hasFactorOverride);
+ return std::make_unique<MatchToolsFactory>(_queryLimiter, doom, searchContext, attrContext, request.getStackRef(),
+ request.location, _viewResolver, metaStore, _indexEnv, *_rankSetup,
+ rankProperties, feature_overrides);
}
SearchReply::UP
@@ -187,6 +190,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
SearchReply::UP reply = std::make_unique<SearchReply>();
size_t covered = 0;
uint32_t numActiveLids = 0;
+ bool isDoomExplicit = false;
{ // we want to measure full set-up and tear-down time as part of
// collateral time
GroupingContext groupingContext(_clock, request.getTimeOfDoom(),
@@ -212,6 +216,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
}
MatchToolsFactory::UP mtf = create_match_tools_factory(request, searchContext, attrContext,
metaStore, *feature_overrides);
+ isDoomExplicit = mtf->getRequestContext().getDoom().isExplicitSoftDoom();
traceQuery(6, request.trace(), mtf->query());
if (!mtf->valid()) {
return reply;
@@ -288,19 +293,21 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
_stats.add(my_stats);
if (my_stats.softDoomed()) {
double old = _stats.softDoomFactor();
- fastos::TimeStamp softLimit = (1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout();
+ fastos::TimeStamp overtimeLimit = (1.0 - _rankSetup->getSoftTimeoutTailCost()) * request.getTimeout();
fastos::TimeStamp adjustedDuration = duration - my_stats.doomOvertime();
if (adjustedDuration < 0) {
adjustedDuration = 0;
}
- bool allowedSoftTimeoutFactorAdjustment = (std::chrono::duration_cast<std::chrono::seconds>(my_clock::now() - _startTime).count() > SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT);
+ bool allowedSoftTimeoutFactorAdjustment = (std::chrono::duration_cast<std::chrono::seconds>(my_clock::now() - _startTime).count() > SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT)
+ && ! isDoomExplicit;
if (allowedSoftTimeoutFactorAdjustment) {
- _stats.updatesoftDoomFactor(request.getTimeout(), softLimit, adjustedDuration);
+ _stats.updatesoftDoomFactor(request.getTimeout(), overtimeLimit, adjustedDuration);
}
- LOG(info, "Triggered softtimeout factor adjustment. Coverage = %lu of %u documents. request=%1.3f, doomOvertime=%1.3f, limit=%1.3f and duration=%1.3f, rankprofile=%s"
+ LOG(info, "Triggered softtimeout %s. Coverage = %lu of %u documents. request=%1.3f, doomOvertime=%1.3f, overtime_limit=%1.3f and duration=%1.3f, rankprofile=%s"
", factor %sadjusted from %1.3f to %1.3f",
+ isDoomExplicit ? "with query override" : "factor adjustment",
covered, numActiveLids,
- request.getTimeout().sec(), my_stats.doomOvertime().sec(), softLimit.sec(), duration.sec(),
+ request.getTimeout().sec(), my_stats.doomOvertime().sec(), overtimeLimit.sec(), duration.sec(),
request.ranking.c_str(), (allowedSoftTimeoutFactorAdjustment ? "" : "NOT "), old, _stats.softDoomFactor());
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
index 918e4a14649..28a1d680e85 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
@@ -14,9 +14,9 @@ namespace proton {
using search::attribute::IAttributeVector;
-RequestContext::RequestContext(const Doom & softDoom, IAttributeContext & attributeContext,
+RequestContext::RequestContext(const CombinedDoom & doom, IAttributeContext & attributeContext,
const search::fef::Properties& rank_properties)
- : _softDoom(softDoom),
+ : _doom(doom),
_attributeContext(attributeContext),
_rank_properties(rank_properties)
{
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
index 0352e28eea2..cfec168405e 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
@@ -5,6 +5,7 @@
#include <vespa/eval/tensor/tensor.h>
#include <vespa/searchlib/queryeval/irequestcontext.h>
#include <vespa/searchcommon/attribute/iattributecontext.h>
+#include <vespa/vespalib/util/doom.h>
namespace search::fef { class Properties; }
@@ -16,11 +17,11 @@ class RequestContext : public search::queryeval::IRequestContext,
public:
using IAttributeContext = search::attribute::IAttributeContext;
using IAttributeFunctor = search::attribute::IAttributeFunctor;
- using Doom = vespalib::Doom;
- RequestContext(const Doom & softDoom, IAttributeContext & attributeContext,
+ using CombinedDoom = vespalib::CombinedDoom;
+ RequestContext(const CombinedDoom & softDoom, IAttributeContext & attributeContext,
const search::fef::Properties& rank_properties);
- const Doom & getSoftDoom() const override { return _softDoom; }
+ const CombinedDoom & getDoom() const override { return _doom; }
const search::attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override;
void asyncForAttribute(const vespalib::string &name, std::unique_ptr<IAttributeFunctor> func) const override;
@@ -31,9 +32,9 @@ public:
private:
- const Doom _softDoom;
- IAttributeContext & _attributeContext;
- const search::fef::Properties& _rank_properties;
+ const CombinedDoom _doom;
+ IAttributeContext & _attributeContext;
+ const search::fef::Properties & _rank_properties;
};
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp
index 445aab310d9..41052978997 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/result_processor.cpp
@@ -85,7 +85,7 @@ ResultProcessor::prepareThreadContextCreation(size_t num_threads)
if (num_threads > 1) {
_wasMerged = true;
}
- if (_groupingSession.get() != 0) {
+ if (_groupingSession) {
_groupingSession->prepareThreadContextCreation(num_threads);
}
}
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
index ce1bd69cc4c..5e7523f53c5 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.cpp
@@ -40,7 +40,7 @@ lookupDouble(const Properties &props, const vespalib::string &name, double defau
{
Property p = props.lookup(name);
if (p.found()) {
- return vespalib::locale::c::strtod(p.get().c_str(), NULL);
+ return vespalib::locale::c::strtod(p.get().c_str(), nullptr);
}
return defaultValue;
}
@@ -306,6 +306,10 @@ double Factor::lookup(const Properties &props, double defaultValue) {
return lookupDouble(props, NAME, defaultValue);
}
+bool Factor::isPresent(const Properties &props) {
+ return props.lookup(NAME).found();
+}
+
}
namespace matchphase {
diff --git a/searchlib/src/vespa/searchlib/fef/indexproperties.h b/searchlib/src/vespa/searchlib/fef/indexproperties.h
index 57aa24222a3..9fa28bfaff2 100644
--- a/searchlib/src/vespa/searchlib/fef/indexproperties.h
+++ b/searchlib/src/vespa/searchlib/fef/indexproperties.h
@@ -237,6 +237,7 @@ namespace softtimeout {
static const double DEFAULT_VALUE;
static double lookup(const Properties &props);
static double lookup(const Properties &props, double defaultValue);
+ static bool isPresent(const Properties &props);
};
}
diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
index 7220235dc48..9af6d7024a2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.cpp
@@ -4,9 +4,9 @@
namespace search::queryeval {
-FakeRequestContext::FakeRequestContext(attribute::IAttributeContext * context, fastos::SteadyTimeStamp doom_in)
+FakeRequestContext::FakeRequestContext(attribute::IAttributeContext * context, fastos::SteadyTimeStamp softDoom, fastos::SteadyTimeStamp hardDoom)
: _clock(),
- _doom(_clock, doom_in),
+ _doom(_clock, softDoom, hardDoom, false),
_attributeContext(context),
_query_tensor_name(),
_query_tensor()
diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
index 50f61a3eb22..36ab6614cae 100644
--- a/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
+++ b/searchlib/src/vespa/searchlib/queryeval/fake_requestcontext.h
@@ -8,6 +8,7 @@
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/queryeval/irequestcontext.h>
+#include <vespa/vespalib/util/doom.h>
#include <limits>
namespace search::queryeval {
@@ -15,9 +16,11 @@ namespace search::queryeval {
class FakeRequestContext : public IRequestContext
{
public:
- FakeRequestContext(attribute::IAttributeContext * context = nullptr, fastos::SteadyTimeStamp doom=fastos::SteadyTimeStamp(fastos::TimeStamp::FUTURE));
+ FakeRequestContext(attribute::IAttributeContext * context = nullptr,
+ fastos::SteadyTimeStamp soft=fastos::SteadyTimeStamp::FUTURE,
+ fastos::SteadyTimeStamp hard=fastos::SteadyTimeStamp::FUTURE);
~FakeRequestContext();
- const vespalib::Doom & getSoftDoom() const override { return _doom; }
+ const vespalib::CombinedDoom & getDoom() const override { return _doom; }
const attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override {
return _attributeContext
? _attributeContext->getAttribute(name)
@@ -41,7 +44,7 @@ public:
private:
vespalib::Clock _clock;
- const vespalib::Doom _doom;
+ const vespalib::CombinedDoom _doom;
attribute::IAttributeContext *_attributeContext;
vespalib::string _query_tensor_name;
std::unique_ptr<vespalib::eval::TensorSpec> _query_tensor;
diff --git a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
index 1c197021998..f8908a67cf2 100644
--- a/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
+++ b/searchlib/src/vespa/searchlib/queryeval/irequestcontext.h
@@ -2,11 +2,11 @@
#pragma once
-#include <vespa/vespalib/util/doom.h>
#include <vespa/vespalib/stllike/string.h>
namespace search::attribute { class IAttributeVector; }
namespace vespalib::eval { class Value; }
+namespace vespalib { class CombinedDoom; }
namespace search::queryeval {
@@ -22,7 +22,7 @@ public:
* Provides the time of soft doom for the query. Now it is time to start cleaning up and return what you have.
* @return time of soft doom.
*/
- virtual const vespalib::Doom & getSoftDoom() const = 0;
+ virtual const vespalib::CombinedDoom & getDoom() const = 0;
/**
* Provide access to attributevectors
diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp
index 7429553d889..44f5d3ce619 100644
--- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.cpp
@@ -11,7 +11,7 @@ namespace search::queryeval {
SimplePhraseBlueprint::SimplePhraseBlueprint(const FieldSpec &field, const IRequestContext & requestContext, bool expensive)
: ComplexLeafBlueprint(field),
- _doom(requestContext.getSoftDoom()),
+ _doom(requestContext.getDoom().soft()),
_field(field),
_estimate(),
_layout(),
diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
index c313c0b38ad..a09bc3f6c06 100644
--- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
+++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_blueprint.h
@@ -5,6 +5,7 @@
#include "searchable.h"
#include "irequestcontext.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
+#include <vespa/vespalib/util/doom.h>
namespace search::fef { class TermFieldMatchData; }
diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h
index c9327d678e5..2d9d47fb680 100644
--- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h
+++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h
@@ -7,6 +7,7 @@
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
+#include <vespa/vespalib/util/doom.h>
#include <memory>
#include <vector>
diff --git a/staging_vespalib/src/vespa/vespalib/util/doom.h b/staging_vespalib/src/vespa/vespalib/util/doom.h
index ee0c1af3177..89421f69686 100644
--- a/staging_vespalib/src/vespa/vespalib/util/doom.h
+++ b/staging_vespalib/src/vespa/vespalib/util/doom.h
@@ -20,5 +20,21 @@ public:
fastos::TimeStamp left() const { return _timeOfDoom - _clock.getTimeNS(); }
};
-} // namespace vespalib
+class CombinedDoom {
+public:
+ CombinedDoom(const vespalib::Clock &clock, fastos::SteadyTimeStamp softDoom,
+ fastos::SteadyTimeStamp hardDoom, bool explicitSoftDoom)
+ : _soft(clock, softDoom),
+ _hard(clock, hardDoom),
+ _isExplicitSoftDoom(explicitSoftDoom)
+ { }
+ const Doom & soft() const { return _soft; }
+ const Doom & hard() const { return _hard; }
+ bool isExplicitSoftDoom() const { return _isExplicitSoftDoom; }
+private:
+ Doom _soft;
+ Doom _hard;
+ bool _isExplicitSoftDoom;
+};
+}