diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-09 13:03:08 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-09 13:03:08 +0000 |
commit | e0dcdda7286506373b2f60e657afb931ca5edf8b (patch) | |
tree | f11d28e54b1b8b8eded744dd411ea8808e4ceecf /searchcore | |
parent | cbba6fbd513bdbc9d1696f3b3c17f28abd2b4367 (diff) |
Propagate target-active-docs in monitor reply.
Diffstat (limited to 'searchcore')
7 files changed, 36 insertions, 22 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h index 2ad13576601..fbdde710277 100644 --- a/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h +++ b/searchcore/src/vespa/searchcore/proton/bucketdb/bucket_db_owner.h @@ -34,6 +34,7 @@ public: Guard takeGuard() { return Guard(&_bucketDB, _mutex); } + size_t getActiveDocs() const { return _bucketDB.getNumActiveDocs(); } private: BucketDB _bucketDB; std::mutex _mutex; diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 6dc1b2b354e..26ab2d10671 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -277,7 +277,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl SearchReply::Coverage & coverage = reply->coverage; coverage.setActive(numActiveLids); //TODO this should be calculated with ClusterState calculator. - coverage.setSoonActive(numActiveLids); + coverage.setTargetActive(numActiveLids); coverage.setCovered(covered); if (wasLimited) { coverage.degradeMatchPhase(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 51c02c818b2..81edf9bd659 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -619,13 +619,13 @@ DocumentDB::getNumDocs() const } } -size_t +std::pair<size_t, size_t> DocumentDB::getNumActiveDocs() const { if (_state.get_load_done()) { - return _subDBs.getReadySubDB()->getNumActiveDocs(); + return { _subDBs.getReadySubDB()->getNumActiveDocs(), _subDBs.getBucketDB().getActiveDocs() }; } else { - return 0u; + return {0u, 0u}; } } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 96944ba25e7..d05fef00f4b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -297,11 +297,12 @@ public: size_t getNumDocs() const; /** - * Returns the number of documents that are active for search in this database. + * Returns the number of documents that are active for search in this database, + * and the number of documents that will be active once ideal state is reached. * - * @return The active-document count. + * @return The active and target-active document count. */ - size_t getNumActiveDocs() const; + std::pair<size_t, size_t> getNumActiveDocs() const; /** * Returns the base directory that this document database uses when diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index f5654fb661d..8c1e670454c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -118,6 +118,7 @@ public: const_iterator end() const { return _subDBs.end(); } bucketdb::BucketDBOwner &getBucketDB() { return *_bucketDB; } + const bucketdb::BucketDBOwner &getBucketDB() const { return *_bucketDB; } bucketdb::IBucketDBHandler &getBucketDBHandler() { return *_bucketDBHandler; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index c4b30d50dbd..51e131d5548 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -115,11 +115,10 @@ setFS4Compression(const ProtonConfig & proton) DiskMemUsageSampler::Config diskMemUsageSamplerConfig(const ProtonConfig &proton, const HwInfo &hwInfo) { - return DiskMemUsageSampler::Config( - proton.writefilter.memorylimit, - proton.writefilter.disklimit, - vespalib::from_s(proton.writefilter.sampleinterval), - hwInfo); + return { proton.writefilter.memorylimit, + proton.writefilter.disklimit, + vespalib::from_s(proton.writefilter.sampleinterval), + hwInfo }; } uint32_t @@ -135,7 +134,7 @@ computeRpcTransportThreads(const ProtonConfig & cfg, const HwInfo::Cpu &cpuInfo) struct MetricsUpdateHook : metrics::UpdateHook { Proton &self; - MetricsUpdateHook(Proton &s) + explicit MetricsUpdateHook(Proton &s) : metrics::UpdateHook("proton-hook"), self(s) {} @@ -427,14 +426,14 @@ Proton::addDocumentDB(const DocTypeName &docTypeName, "Did not find document type '%s' in the document manager. " "Skipping creating document database for this type", docTypeName.toString().c_str()); - return std::shared_ptr<DocumentDBConfigOwner>(); + return {}; } } catch (const document::DocumentTypeNotFoundException & e) { LOG(warning, "Did not find document type '%s' in the document manager. " "Skipping creating document database for this type", docTypeName.toString().c_str()); - return std::shared_ptr<DocumentDBConfigOwner>(); + return {}; } } @@ -537,14 +536,17 @@ size_t Proton::getNumDocs() const return numDocs; } -size_t Proton::getNumActiveDocs() const +std::pair<size_t, size_t> +Proton::getNumActiveDocs() const { - size_t numDocs(0); + size_t activeDocs(0), targetActiveDocs(0); std::shared_lock<std::shared_mutex> guard(_mutex); for (const auto &kv : _documentDBMap) { - numDocs += kv.second->getNumActiveDocs(); + const auto & docs = kv.second->getNumActiveDocs(); + activeDocs += docs.first; + targetActiveDocs += docs.second; } - return numDocs; + return {activeDocs, targetActiveDocs}; } search::engine::SearchServer & @@ -725,8 +727,16 @@ Proton::ping(std::unique_ptr<MonitorRequest>, MonitorClient &) BootstrapConfig::SP configSnapshot = getActiveConfigSnapshot(); const ProtonConfig &protonConfig = configSnapshot->getProtonConfig(); ret.distribution_key = protonConfig.distributionkey; - ret.timestamp = (_matchEngine->isOnline()) ? 42 : 0; - ret.activeDocs = (_matchEngine->isOnline()) ? getNumActiveDocs() : 0; + if (_matchEngine->isOnline()) { + ret.timestamp = 42; + auto [active, targetActive] = getNumActiveDocs(); + ret.activeDocs = active; + ret.targetActiveDocs = targetActive; + } else { + ret.timestamp = 0; + ret.activeDocs = 0; + ret.targetActiveDocs = 0; // TODO vekterli hmm... or target anyway ... + } ret.is_blocking_writes = !_diskMemUsageSampler->writeFilter().acceptWriteOperation(); return reply; } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index 6e154159ecc..08a1b17705f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -198,7 +198,8 @@ public: int64_t getConfigGeneration(); size_t getNumDocs() const; - size_t getNumActiveDocs() const; + // Active (searchable), and targetActive that will be searchable when idealstate is reached + std::pair<size_t, size_t> getNumActiveDocs() const; search::engine::SearchServer &get_search_server(); search::engine::DocsumServer &get_docsum_server(); |