summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2018-05-29 07:03:54 +0000
committerArne Juul <arnej@yahoo-inc.com>2018-05-29 07:53:40 +0000
commit0794f0c56f7c64bccdca894b71a5b2bcf5a0eae6 (patch)
tree5a1bc943820703406bb91c2ecb1c80940deec7c5 /searchcore
parentb441a221c9b710baa049777f7e95d30f48d87aec (diff)
match_loop must call next_range until empty
* even if the search is softDoomed we must still call next_range until we get an empty range to ensure threads can rendezvous correctly. * inner_match_loop may update the docid_range if adaptive scheduling is active, so we must pass it by reference to ensure we compare with the correct end id.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index c1c4387cf41..1efb74b96ba 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -141,7 +141,7 @@ MatchThread::try_share(DocidRange &docid_range, uint32_t next_docid) {
template <typename Strategy, bool do_rank, bool do_limit, bool do_share_work>
uint32_t
-MatchThread::inner_match_loop(Context &context, MatchTools &tools, DocidRange docid_range)
+MatchThread::inner_match_loop(Context &context, MatchTools &tools, DocidRange &docid_range)
{
SearchIterator *search = &tools.search();
search->initRange(docid_range.begin, docid_range.end);
@@ -175,12 +175,14 @@ MatchThread::match_loop(MatchTools &tools, HitCollector &hits)
uint32_t docsCovered = 0;
Context context(matchParams.rankDropLimit, tools, hits, num_threads);
for (DocidRange docid_range = scheduler.first_range(thread_id);
- !docid_range.empty() && ! softDoomed;
+ !docid_range.empty();
docid_range = scheduler.next_range(thread_id))
{
- uint32_t lastCovered = inner_match_loop<Strategy, do_rank, do_limit, do_share_work>(context, tools, docid_range);
- softDoomed = (lastCovered < docid_range.end);
- docsCovered += std::min(lastCovered, docid_range.end) - docid_range.begin;
+ if (!softDoomed) {
+ uint32_t lastCovered = inner_match_loop<Strategy, do_rank, do_limit, do_share_work>(context, tools, docid_range);
+ softDoomed = (lastCovered < docid_range.end);
+ docsCovered += std::min(lastCovered, docid_range.end) - docid_range.begin;
+ }
}
uint32_t matches = context.matches;
if (do_limit && context.isBelowLimit()) {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index b7ecf149001..5c78ee59b1d 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -75,7 +75,7 @@ private:
bool try_share(DocidRange &docid_range, uint32_t next_docid) __attribute__((noinline));
template <typename Strategy, bool do_rank, bool do_limit, bool do_share_work>
- uint32_t inner_match_loop(Context &context, MatchTools &tools, DocidRange docid_range) __attribute__((noinline));
+ uint32_t inner_match_loop(Context &context, MatchTools &tools, DocidRange &docid_range) __attribute__((noinline));
template <typename Strategy, bool do_rank, bool do_limit, bool do_share_work>
void match_loop(MatchTools &tools, HitCollector &hits) __attribute__((noinline));