summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-03-12 20:25:33 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2019-03-13 09:39:29 +0000
commit64b3ff5093cedb87fc3672368a9c28ad4a787d57 (patch)
tree1f43c515c41250e5ed424b9c18a11aedc45b0045 /searchcore
parente572223ee498e58b5b6b69cd0dd00480029d3e82 (diff)
Make the Trace object itself lazy
Make start optional and explicit.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_master.cpp4
3 files changed, 6 insertions, 5 deletions
diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
index be4bc159b1b..d05abac203e 100644
--- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
@@ -291,6 +291,7 @@ TEST("require that the match phase limiter is able to pre-limit the query") {
EXPECT_EQUAL(12u, limiter.sample_hits_per_thread(10));
RelativeTime clock(std::make_unique<CountingClock>(fastos::TimeStamp::fromSec(1500000000), 1700000L));
Trace trace(clock, 7);
+ trace.start(4);
SearchIterator::UP search = limiter.maybe_limit(prepare(new MockSearch("search")), 0.1, 100000, trace.maybeCreateCursor(7, "limit"));
limiter.updateDocIdSpaceEstimate(1000, 9000);
EXPECT_EQUAL(1680u, limiter.getDocIdSpaceEstimate());
@@ -331,7 +332,7 @@ TEST("require that the match phase limiter is able to pre-limit the query") {
" }"
" ],"
" duration_ms: 3.4"
- "}", trace.getSlime());
+ "}", *trace.getSlime());
}
TEST("require that the match phase limiter is able to post-limit the query") {
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
index c7016d711cb..f887b5069cb 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
@@ -141,11 +141,11 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req,
ret->request = req.release();
ret->setDistributionKey(_distributionKey);
if (ret->request->trace().getLevel() > 0) {
- ret->request->trace().getRoot().setLong("distribution-key", _distributionKey);
+ ret->request->trace().getRoot()->setLong("distribution-key", _distributionKey);
ret->request->trace().done();
search::fef::Properties & trace = ret->propertiesMap.lookupCreate("trace");
vespalib::SmartBuffer output(4096);
- vespalib::slime::BinaryFormat::encode(ret->request->trace().getSlime(), output);
+ vespalib::slime::BinaryFormat::encode(*ret->request->trace().getSlime(), output);
trace.add("slime", output.obtain().make_stringref());
}
client.searchDone(std::move(ret));
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
index 7dd06038707..ed8900e0cac 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp
@@ -99,8 +99,8 @@ MatchMaster::match(search::engine::Trace & trace,
const MatchThread & matchThread = *threadState[i];
match_time_s = std::max(match_time_s, matchThread.get_match_time());
_stats.merge_partition(matchThread.get_thread_stats(), i);
- if (inserter) {
- vespalib::slime::inject(matchThread.getTrace().getRoot(), *inserter);
+ if (inserter && matchThread.getTrace().getRoot()) {
+ vespalib::slime::inject(*matchThread.getTrace().getRoot(), *inserter);
}
}
_stats.queryLatency(query_time_s);