diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-05-29 13:25:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-29 13:25:10 +0200 |
commit | e3c650c97483883389f4a91152d2db39827ee754 (patch) | |
tree | dd862b258dae66a77ca2da4a994b45e203734691 | |
parent | 6cd4e8945facda874bf1ada7ea8694c2c633f9da (diff) | |
parent | 0794f0c56f7c64bccdca894b71a5b2bcf5a0eae6 (diff) |
Merge pull request #5979 from vespa-engine/arnej/fix-adaptive-scheduling-problem
match_loop must call next_range until empty
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp | 12 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/match_thread.h | 2 |
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)); |