diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-03-13 17:48:44 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-03-13 17:48:44 +0000 |
commit | cd7ada2b6fa7afec39b6090b9b0d4f59ccd1419d (patch) | |
tree | 66f002b0a0f199e21b930c8547568344c53044b3 /searchcore | |
parent | 64b3ff5093cedb87fc3672368a9c28ad4a787d57 (diff) |
Make it lazy and safe.
Diffstat (limited to 'searchcore')
3 files changed, 6 insertions, 6 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 d05abac203e..63eff02408c 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 @@ -332,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 f887b5069cb..1ca7847184f 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -140,12 +140,12 @@ 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); + if ((ret->request->trace().getLevel() > 0) && ret->request->trace().hasTrace()) { + 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 ed8900e0cac..ca159228f25 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 && matchThread.getTrace().getRoot()) { - vespalib::slime::inject(*matchThread.getTrace().getRoot(), *inserter); + if (inserter && matchThread.getTrace().hasTrace()) { + vespalib::slime::inject(matchThread.getTrace().getRoot(), *inserter); } } _stats.queryLatency(query_time_s); |