diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-29 12:24:52 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2023-06-29 12:24:52 +0000 |
commit | 0351e1577a0d257363d2112660d85c7f0e55083f (patch) | |
tree | 1f1c3fa16f8418a0383c47395de8698f8ec6563e /searchcore | |
parent | d62dba05b4d113e5d36b4786125a2d45f2b26da5 (diff) |
- Better naming of time constant.
- Add braces.
- Suffice with MatchLimiter.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/matcher.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 355db669e78..9ad603afad7 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -46,7 +46,7 @@ namespace proton::matching { namespace { -constexpr vespalib::duration SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT = 60s; +constexpr vespalib::duration TIME_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT = 60s; // used to give out empty whitelist blueprints struct StupidMetaStore : search::IDocumentMetaStore { @@ -194,12 +194,12 @@ traceQuery(uint32_t traceLevel, Trace & trace, const Query & query) { } void -updateCoverage(Coverage & coverage, const MatchToolsFactory & mtf, const MatchingStats & my_stats, +updateCoverage(Coverage & coverage, const MaybeMatchPhaseLimiter & limiter, const MatchingStats & my_stats, const search::IDocumentMetaStore &metaStore, const bucketdb::BucketDBOwner & bucketdb) { size_t spaceEstimate = (my_stats.softDoomed()) ? my_stats.docidSpaceCovered() - : mtf.match_limiter().getDocIdSpaceEstimate(); + : limiter.getDocIdSpaceEstimate(); // note: this is actually totalSpace+1, since 0 is reserved uint32_t totalSpace = metaStore.getCommittedDocIdLimit(); if (spaceEstimate >= totalSpace) { @@ -212,7 +212,7 @@ updateCoverage(Coverage & coverage, const MatchToolsFactory & mtf, const Matchin coverage.setActive(metaStore.getNumActiveLids()); coverage.setTargetActive(bucketdb.getNumActiveDocs()); coverage.setCovered((spaceEstimate * coverage.getActive()) / totalSpace); - if (mtf.match_limiter().was_limited()) { + if (limiter.was_limited()) { coverage.degradeMatchPhase(); LOG(debug, "was limited, degraded from match phase"); } @@ -295,7 +295,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl my_stats = MatchMaster::getStats(std::move(master)); reply = std::move(result->_reply); Coverage & coverage = reply->coverage; - updateCoverage(coverage, *mtf, my_stats, metaStore, bucketdb); + updateCoverage(coverage, mtf->match_limiter(), my_stats, metaStore, bucketdb); LOG(debug, "numThreadsPerSearch = %zu. Configured = %d, estimated hits=%d, totalHits=%" PRIu64 ", rankprofile=%s", numThreadsPerSearch, _rankSetup->getNumThreadsPerSearch(), mtf->estimate().estHits, reply->totalHitCount, @@ -327,18 +327,23 @@ Matcher::updateStats(const MatchingStats & my_stats, const search::engine::Reque if (adjustedDuration < vespalib::duration::zero()) { adjustedDuration = vespalib::duration::zero(); } - bool allowedSoftTimeoutFactorAdjustment = ((my_clock::now() - _startTime) > SECONDS_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT) + bool allowedSoftTimeoutFactorAdjustment = ((my_clock::now() - _startTime) > TIME_BEFORE_ALLOWING_SOFT_TIMEOUT_FACTOR_ADJUSTMENT) && ! isDoomExplicit; if (allowedSoftTimeoutFactorAdjustment) { _stats.updatesoftDoomFactor(request.getTimeout(), overtimeLimit, adjustedDuration); } - if ((_stats.softDoomed() < 10) || (_stats.softDoomed()%100 == 0)) - LOG(info, "Triggered softtimeout %s count: %zu. Coverage = %lu of %lu documents. request=%1.3f, doomOvertime=%1.3f, overtime_limit=%1.3f and duration=%1.3f, rankprofile=%s" - ", factor %s adjusted from %1.3f to %1.3f", + if ((_stats.softDoomed() < 10) || (_stats.softDoomed()%100 == 0)) { + LOG(info, + "Triggered softtimeout %s count: %zu. Coverage = %lu of %lu documents. request=%1.3f," + " doomOvertime=%1.3f, overtime_limit=%1.3f and duration=%1.3f, rankprofile=%s" + ", factor %s adjusted from %1.3f to %1.3f", isDoomExplicit ? "with query override" : "factor adjustment", _stats.softDoomed(), coverage.getCovered(), coverage.getActive(), - vespalib::to_s(request.getTimeout()), vespalib::to_s(my_stats.doomOvertime()), vespalib::to_s(overtimeLimit), vespalib::to_s(duration), - request.ranking.c_str(), (allowedSoftTimeoutFactorAdjustment ? "" : "NOT "), old, _stats.softDoomFactor()); + vespalib::to_s(request.getTimeout()), vespalib::to_s(my_stats.doomOvertime()), + vespalib::to_s(overtimeLimit), vespalib::to_s(duration), + request.ranking.c_str(), (allowedSoftTimeoutFactorAdjustment ? "" : "NOT "), old, + _stats.softDoomFactor()); + } } } |