diff options
author | Henning Baldersheim <balder@oath.com> | 2018-02-07 22:12:24 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-02-07 22:12:24 +0100 |
commit | 425b893bc422eea13b2f222bb7cd9c855b1e0a57 (patch) | |
tree | 4712fcd874bd88bc4eb6b6f547c492462a4805c7 | |
parent | 1d576eec7da8295f6bd9f25844f9ed1d9160d458 (diff) |
Consider the whole space and let naming reflect it is an estimate.
4 files changed, 18 insertions, 17 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_stats_test.cpp b/searchcore/src/tests/proton/matching/matching_stats_test.cpp index b94026e689c..cc256e0c729 100644 --- a/searchcore/src/tests/proton/matching/matching_stats_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_stats_test.cpp @@ -10,7 +10,7 @@ using namespace proton::matching; TEST("requireThatDocCountsAddUp") { MatchingStats stats; - EXPECT_EQUAL(0u, stats.docsCovered()); + EXPECT_EQUAL(0u, stats.docidSpaceCovered()); EXPECT_EQUAL(0u, stats.docsMatched()); EXPECT_EQUAL(0u, stats.docsRanked()); EXPECT_EQUAL(0u, stats.docsReRanked()); @@ -18,7 +18,7 @@ TEST("requireThatDocCountsAddUp") { EXPECT_EQUAL(0u, stats.limited_queries()); { MatchingStats rhs; - EXPECT_EQUAL(&rhs.docsCovered(10000), &rhs); + EXPECT_EQUAL(&rhs.docidSpaceCovered(10000), &rhs); EXPECT_EQUAL(&rhs.docsMatched(1000), &rhs); EXPECT_EQUAL(&rhs.docsRanked(100), &rhs); EXPECT_EQUAL(&rhs.docsReRanked(10), &rhs); @@ -26,15 +26,15 @@ TEST("requireThatDocCountsAddUp") { EXPECT_EQUAL(&rhs.limited_queries(1), &rhs); EXPECT_EQUAL(&stats.add(rhs), &stats); } - EXPECT_EQUAL(10000u, stats.docsCovered()); + EXPECT_EQUAL(10000u, stats.docidSpaceCovered()); EXPECT_EQUAL(1000u, stats.docsMatched()); EXPECT_EQUAL(100u, stats.docsRanked()); EXPECT_EQUAL(10u, stats.docsReRanked()); EXPECT_EQUAL(2u, stats.queries()); EXPECT_EQUAL(1u, stats.limited_queries()); - EXPECT_EQUAL(&stats.add(MatchingStats().docsCovered(10000).docsMatched(1000).docsRanked(100) + EXPECT_EQUAL(&stats.add(MatchingStats().docidSpaceCovered(10000).docsMatched(1000).docsRanked(100) .docsReRanked(10).queries(2).limited_queries(1)), &stats); - EXPECT_EQUAL(20000u, stats.docsCovered()); + EXPECT_EQUAL(20000u, stats.docidSpaceCovered()); EXPECT_EQUAL(2000u, stats.docsMatched()); EXPECT_EQUAL(200u, stats.docsRanked()); EXPECT_EQUAL(20u, stats.docsReRanked()); @@ -90,7 +90,7 @@ TEST("requireThatAverageTimesAreRecorded") { TEST("requireThatPartitionsAreAddedCorrectly") { MatchingStats all1; - EXPECT_EQUAL(0u, all1.docsCovered()); + EXPECT_EQUAL(0u, all1.docidSpaceCovered()); EXPECT_EQUAL(0u, all1.docsMatched()); EXPECT_EQUAL(0u, all1.getNumPartitions()); @@ -107,7 +107,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") { EXPECT_EQUAL(1u, subPart.wait_time_count()); all1.merge_partition(subPart, 0); - EXPECT_EQUAL(7u, all1.docsCovered()); + EXPECT_EQUAL(7u, all1.docidSpaceCovered()); EXPECT_EQUAL(3u, all1.docsMatched()); EXPECT_EQUAL(2u, all1.docsRanked()); EXPECT_EQUAL(1u, all1.docsReRanked()); @@ -122,7 +122,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") { EXPECT_EQUAL(1u, all1.getPartition(0).wait_time_count()); all1.merge_partition(subPart, 1); - EXPECT_EQUAL(14u, all1.docsCovered()); + EXPECT_EQUAL(14u, all1.docidSpaceCovered()); EXPECT_EQUAL(6u, all1.docsMatched()); EXPECT_EQUAL(4u, all1.docsRanked()); EXPECT_EQUAL(2u, all1.docsReRanked()); @@ -136,7 +136,7 @@ TEST("requireThatPartitionsAreAddedCorrectly") { EXPECT_EQUAL(1u, all1.getPartition(1).wait_time_count()); all1.add(all1); - EXPECT_EQUAL(28u, all1.docsCovered()); + EXPECT_EQUAL(28u, all1.docidSpaceCovered()); EXPECT_EQUAL(12u, all1.docsMatched()); EXPECT_EQUAL(8u, all1.docsRanked()); EXPECT_EQUAL(4u, all1.docsReRanked()); diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index c0416fbf3fb..8cab32912a3 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -258,7 +258,9 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl my_stats = MatchMaster::getStats(std::move(master)); bool wasLimited = mtf->match_limiter().was_limited(); - size_t spaceEstimate = mtf->match_limiter().getDocIdSpaceEstimate(); + size_t spaceEstimate = (my_stats.softDoomed()) + ? my_stats.docidSpaceCovered() + : mtf->match_limiter().getDocIdSpaceEstimate(); uint32_t estHits = mtf->estimate().estHits; if (shouldCacheSearchSession && ((result->_numFs4Hits != 0) || shouldCacheGroupingSession)) { SearchSession::SP session = std::make_shared<SearchSession>(sessionId, request.getTimeOfDoom(), @@ -295,7 +297,6 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl } if (my_stats.softDoomed()) { coverage.degradeTimeout(); - coverage.setCovered(my_stats.docsCovered()); LOG(debug, "soft doomed, degraded from timeout covered = %lu", coverage.getCovered()); } LOG(debug, "numThreadsPerSearch = %zu. Configured = %d, estimated hits=%d, totalHits=%ld", diff --git a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp index 7ea417bb7d2..0bc1807d714 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp @@ -18,7 +18,7 @@ MatchingStats::Partition &get_writable_partition(std::vector<MatchingStats::Part MatchingStats::MatchingStats() : _queries(0), _limited_queries(0), - _docsCovered(0), + _docidSpaceCovered(0), _docsMatched(0), _docsRanked(0), _docsReRanked(0), @@ -39,7 +39,7 @@ MatchingStats::merge_partition(const Partition &partition, size_t id) { get_writable_partition(_partitions, id) = partition; - _docsCovered += partition.docsCovered(); + _docidSpaceCovered += partition.docsCovered(); _docsMatched += partition.docsMatched(); _docsRanked += partition.docsRanked(); _docsReRanked += partition.docsReRanked(); @@ -56,7 +56,7 @@ MatchingStats::add(const MatchingStats &rhs) _queries += rhs._queries; _limited_queries += rhs._limited_queries; - _docsCovered += rhs._docsCovered; + _docidSpaceCovered += rhs._docidSpaceCovered; _docsMatched += rhs._docsMatched; _docsRanked += rhs._docsRanked; _docsReRanked += rhs._docsReRanked; diff --git a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h index e4578547e60..6df01afaa4d 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h +++ b/searchcore/src/vespa/searchcore/proton/matching/matching_stats.h @@ -88,7 +88,7 @@ public: private: size_t _queries; size_t _limited_queries; - size_t _docsCovered; + size_t _docidSpaceCovered; size_t _docsMatched; size_t _docsRanked; size_t _docsReRanked; @@ -115,8 +115,8 @@ public: MatchingStats &limited_queries(size_t value) { _limited_queries = value; return *this; } size_t limited_queries() const { return _limited_queries; } - MatchingStats &docsCovered(size_t value) { _docsCovered = value; return *this; } - size_t docsCovered() const { return _docsCovered; } + MatchingStats &docidSpaceCovered(size_t value) { _docidSpaceCovered = value; return *this; } + size_t docidSpaceCovered() const { return _docidSpaceCovered; } MatchingStats &docsMatched(size_t value) { _docsMatched = value; return *this; } size_t docsMatched() const { return _docsMatched; } |