diff options
author | HÃ¥vard Pettersen <3535158+havardpe@users.noreply.github.com> | 2021-10-08 12:26:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 12:26:25 +0200 |
commit | daaf9321988ba1ba0fd81ee3853fdd51dc692f26 (patch) | |
tree | c2ae08ee40f2c78239a1a1b54fa39979b99b8cbb /searchcore | |
parent | 34e3b9cc16fb9f18d651d5ee6e7d4ae56864637c (diff) | |
parent | a45f09c5edf40fdf01d18bfb92807c59f73defa3 (diff) |
Merge pull request #19464 from vespa-engine/havardpe/wire-issues-into-errors
wire reported issues into search/docsum replies
Diffstat (limited to 'searchcore')
6 files changed, 30 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/grouping/groupingmanager.cpp b/searchcore/src/vespa/searchcore/grouping/groupingmanager.cpp index 02940f4cec9..863511da5ee 100644 --- a/searchcore/src/vespa/searchcore/grouping/groupingmanager.cpp +++ b/searchcore/src/vespa/searchcore/grouping/groupingmanager.cpp @@ -5,6 +5,8 @@ #include "groupingcontext.h" #include <vespa/searchlib/aggregation/fs4hit.h> #include <vespa/searchlib/expression/attributenode.h> +#include <vespa/vespalib/util/issue.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> LOG_SETUP(".groupingmanager"); @@ -13,6 +15,8 @@ namespace search::grouping { using aggregation::Grouping; using attribute::IAttributeContext; +using vespalib::Issue; +using vespalib::make_string_short::fmt; //----------------------------------------------------------------------------- @@ -56,7 +60,14 @@ GroupingManager::init(const IAttributeContext &attrCtx) grouping.configureStaticStuff(stuff); list.push_back(groupingList[i]); } catch (const std::exception & e) { - LOG(error, "Could not locate attribute for grouping number %ld : %s. Ignoring grouping '%s'", i, e.what(), grouping.asString().c_str()); + auto msg = fmt("Could not locate attribute for grouping number %ld : %s. Ignoring grouping '%s'", i, e.what(), grouping.asString().c_str()); + // + // NOTE: if this issue is reported as an error in the + // search reply, the grouping searcher will discard all + // grouping results, which may or may not be what we want. + // + // Issue::report(msg); + LOG(error, "%s", msg.c_str()); } } std::swap(list, groupingList); diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index 04b6ed81106..3aedd952d1e 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -115,6 +115,9 @@ MatchEngine::search(search::engine::SearchRequest::Source request, std::unique_ptr<search::engine::SearchReply> MatchEngine::performSearch(search::engine::SearchRequest::Source req) { + auto my_issues = std::make_unique<search::UniqueIssues>(); + auto capture_issues = vespalib::Issue::listen(*my_issues); + auto ret = std::make_unique<search::engine::SearchReply>(); const search::engine::SearchRequest * searchRequest = req.get(); @@ -143,6 +146,7 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req) _threadBundlePool.release(std::move(threadBundle)); } ret->request = req.release(); + ret->my_issues = std::move(my_issues); ret->setDistributionKey(_distributionKey); if ((ret->request->trace().getLevel() > 0) && ret->request->trace().hasTrace()) { ret->request->trace().getRoot().setLong("distribution-key", _distributionKey); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp index 75041dfd9ce..26ed94f1d73 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp @@ -7,6 +7,7 @@ #include "match_tools.h" #include <vespa/searchlib/engine/trace.h> #include <vespa/vespalib/util/thread_bundle.h> +#include <vespa/vespalib/util/issue.h> #include <vespa/vespalib/data/slime/inserter.h> #include <vespa/vespalib/data/slime/inject.h> #include <vespa/vespalib/data/slime/cursor.h> @@ -20,6 +21,7 @@ namespace proton::matching { using namespace search::fef; using search::queryeval::SearchIterator; using search::FeatureSet; +using vespalib::Issue; namespace { @@ -100,6 +102,7 @@ MatchMaster::match(search::engine::Trace & trace, if (inserter && matchThread.getTrace().hasTrace()) { vespalib::slime::inject(matchThread.getTrace().getRoot(), *inserter); } + matchThread.get_issues().for_each_message([](const auto &msg){ Issue::report(Issue(msg)); }); } _stats.queryLatency(query_time_s); _stats.matchTime(match_time_s - rerank_time_s); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 6c79a4b9414..8f3b1554e0e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -413,7 +413,8 @@ MatchThread::MatchThread(size_t thread_id_in, match_time_s(0.0), wait_time_s(0.0), match_with_ranking(mtf.has_first_phase_rank() && mp.save_rank_scores()), - trace(std::make_unique<Trace>(relativeTime, traceLevel)) + trace(std::make_unique<Trace>(relativeTime, traceLevel)), + my_issues() { } @@ -422,6 +423,7 @@ MatchThread::run() { vespalib::Timer total_time; vespalib::Timer match_time(total_time); + auto capture_issues = vespalib::Issue::listen(my_issues); trace->addEvent(4, "Start MatchThread::run"); MatchTools::UP matchTools = matchToolsFactory.createMatchTools(); search::ResultSet::UP result = findMatches(*matchTools); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h index 029688b88c8..2ef51f71b73 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h @@ -12,6 +12,7 @@ #include <vespa/vespalib/util/dual_merge_director.h> #include <vespa/searchlib/common/resultset.h> #include <vespa/searchlib/common/sortresults.h> +#include <vespa/searchlib/common/unique_issues.h> #include <vespa/searchlib/queryeval/hitcollector.h> #include <vespa/searchlib/fef/featureexecutor.h> @@ -44,6 +45,7 @@ public: using Doom = vespalib::Doom; using Trace = search::engine::Trace; using RelativeTime = search::engine::RelativeTime; + using UniqueIssues = search::UniqueIssues; private: size_t thread_id; @@ -63,6 +65,7 @@ private: double wait_time_s; bool match_with_ranking; std::unique_ptr<Trace> trace; + UniqueIssues my_issues; class Context { public: @@ -129,6 +132,7 @@ public: double get_match_time() const { return match_time_s; } PartialResult::UP extract_result() { return std::move(resultContext->result); } const Trace & getTrace() const { return *trace; } + const UniqueIssues &get_issues() const { return my_issues; } }; } diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp index 10b35be3a2f..55fa539cf0b 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp @@ -128,6 +128,9 @@ SummaryEngine::getDocsums(DocsumRequest::Source request, DocsumClient & client) DocsumReply::UP SummaryEngine::getDocsums(DocsumRequest::UP req) { + auto my_issues = std::make_unique<search::UniqueIssues>(); + auto capture_issues = vespalib::Issue::listen(*my_issues); + DocsumReply::UP reply = std::make_unique<DocsumReply>(); if (req) { @@ -147,6 +150,7 @@ SummaryEngine::getDocsums(DocsumRequest::UP req) updateDocsumMetrics(vespalib::to_s(req->getTimeUsed()), getNumDocs(*reply)); } reply->request = std::move(req); + reply->my_issues = std::move(my_issues); return reply; } |