aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-02-08 10:40:34 +0100
committerGitHub <noreply@github.com>2018-02-08 10:40:34 +0100
commit79d5e8385243796cec598368fb2fe410afff9518 (patch)
tree57c2c175c810afc12ffcc2d55711c5d18eefed27
parent6aadb56c082d1cb98f69152afb7c313ef214ce46 (diff)
parent425b893bc422eea13b2f222bb7cd9c855b1e0a57 (diff)
Merge pull request #4963 from vespa-engine/balder/followup-on-coverage
Balder/followup on coverage
-rw-r--r--searchcore/src/tests/proton/matching/matching_stats_test.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matching_stats.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matching_stats.h6
-rw-r--r--searchlib/src/vespa/searchlib/common/packets.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/engine/packetconverter.cpp1
6 files changed, 25 insertions, 25 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 f21293299c7..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,8 +297,8 @@ 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, "soft doomed, degraded from timeout covered = %lu", coverage.getCovered());
+ }
LOG(debug, "numThreadsPerSearch = %zu. Configured = %d, estimated hits=%d, totalHits=%ld",
numThreadsPerSearch, _rankSetup->getNumThreadsPerSearch(), estHits, reply->totalHitCount);
}
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; }
diff --git a/searchlib/src/vespa/searchlib/common/packets.cpp b/searchlib/src/vespa/searchlib/common/packets.cpp
index 04da47aa76b..4bb11acaabb 100644
--- a/searchlib/src/vespa/searchlib/common/packets.cpp
+++ b/searchlib/src/vespa/searchlib/common/packets.cpp
@@ -908,7 +908,7 @@ FS4Packet_QUERYRESULTX::FS4Packet_QUERYRESULTX()
_distributionKey(0),
_nodesQueried(0),
_nodesReplied(0),
- _features(0),
+ _features(QRF_COVERAGE | QRF_EXTENDED_COVERAGE),
_offset(0),
_numDocs(0),
_totNumDocs(0),
@@ -944,9 +944,9 @@ FS4Packet_QUERYRESULTX::GetLength()
_numDocs * (sizeof(document::GlobalId) + sizeof(search::HitRank));
plen += sizeof(uint32_t);
- plen += (_features & QRF_COVERAGE_NODES) ? 2 * sizeof(uint16_t) : 0;
- plen += (_features & QRF_MLD) ? _numDocs * 2 * sizeof(uint32_t) : 0;
- plen += (_features & QRF_GROUPDATA) ? sizeof(uint32_t) + _groupDataLen : 0;
+ plen += (_features & QRF_COVERAGE_NODES) ? (2 * sizeof(uint16_t)) : 0;
+ plen += (_features & QRF_MLD) ? (_numDocs * 2 * sizeof(uint32_t)) : 0;
+ plen += (_features & QRF_GROUPDATA) ? (sizeof(uint32_t) + _groupDataLen) : 0;
plen += 3 * sizeof(uint64_t) + sizeof(uint32_t);
if (((_features & QRF_SORTDATA) != 0) && (_numDocs > 0))
@@ -988,8 +988,7 @@ FS4Packet_QUERYRESULTX::Encode(FNET_DataBuffer *dst)
for (uint32_t i = 1; i <= _numDocs; i++) {
dst->WriteInt32Fast(_sortIndex[i] - idx0);
}
- dst->WriteBytesFast(_sortData + idx0,
- _sortIndex[_numDocs] - idx0);
+ dst->WriteBytesFast(_sortData + idx0, _sortIndex[_numDocs] - idx0);
}
if ((_features & QRF_GROUPDATA) != 0) {
diff --git a/searchlib/src/vespa/searchlib/engine/packetconverter.cpp b/searchlib/src/vespa/searchlib/engine/packetconverter.cpp
index 5b7b6ef8265..2ebbb9bf89c 100644
--- a/searchlib/src/vespa/searchlib/engine/packetconverter.cpp
+++ b/searchlib/src/vespa/searchlib/engine/packetconverter.cpp
@@ -117,7 +117,6 @@ PacketConverter::fromSearchReply(const SearchReply &reply, QUERYRESULTX &packet)
packet.AllocateGroupData(reply.groupResult.size());
memcpy(packet._groupData, &(reply.groupResult[0]), reply.groupResult.size());
}
- packet._features |= QRF_COVERAGE | QRF_EXTENDED_COVERAGE;
packet._coverageDocs = reply.coverage.getCovered();
packet._activeDocs = reply.coverage.getActive();
packet._soonActiveDocs = reply.coverage.getSoonActive();