summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--metrics/src/vespa/metrics/metricset.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp31
2 files changed, 17 insertions, 16 deletions
diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp
index 5cb25cee560..2916b32eb56 100644
--- a/metrics/src/vespa/metrics/metricset.cpp
+++ b/metrics/src/vespa/metrics/metricset.cpp
@@ -40,7 +40,7 @@ MetricSet::MetricSet(const MetricSet& other,
}
}
-MetricSet::~MetricSet() { }
+MetricSet::~MetricSet() = default;
MetricSet*
MetricSet::clone(std::vector<Metric::UP> &ownerList, CopyType type,
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
index 05370920354..68506d3808a 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp
@@ -167,13 +167,13 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() = default;
-DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const vespalib::string &name, MetricSet *parent) :
- MetricSet("docid_partition", {{"docidPartition", name}}, "DocId Partition profile metrics", parent),
- docsMatched("docs_matched", {}, "Number of documents matched", this),
- docsRanked("docs_ranked", {}, "Number of documents ranked (first phase)", this),
- docsReRanked("docs_reranked", {}, "Number of documents re-ranked (second phase)", this),
- activeTime("active_time", {}, "Time (sec) spent doing actual work", this),
- waitTime("wait_time", {}, "Time (sec) spent waiting for other external threads and resources", this)
+DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const vespalib::string &name, MetricSet *parent)
+ : MetricSet("docid_partition", {{"docidPartition", name}}, "DocId Partition profile metrics", parent),
+ docsMatched("docs_matched", {}, "Number of documents matched", this),
+ docsRanked("docs_ranked", {}, "Number of documents ranked (first phase)", this),
+ docsReRanked("docs_reranked", {}, "Number of documents re-ranked (second phase)", this),
+ activeTime("active_time", {}, "Time (sec) spent doing actual work", this),
+ waitTime("wait_time", {}, "Time (sec) spent waiting for other external threads and resources", this)
{ }
DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() = default;
@@ -213,14 +213,15 @@ DocumentDBTaggedMetrics::MatchingMetrics::RankProfileMetrics::update(const Match
queryLatency.addValueBatch(stats.queryLatencyAvg(), stats.queryLatencyCount(),
stats.queryLatencyMin(), stats.queryLatencyMax());
if (stats.getNumPartitions() > 0) {
- if (stats.getNumPartitions() <= partitions.size()) {
- for (size_t i = 0; i < stats.getNumPartitions(); ++i) {
- partitions[i]->update(stats.getPartition(i));
- }
- } else {
- vespalib::string msg(vespalib::make_string("Num partitions used '%ld' is larger than number of partitions '%ld' configured.",
- stats.getNumPartitions(), partitions.size()));
- throw vespalib::IllegalStateException(msg, VESPA_STRLOC);
+ for (size_t i = partition.size(); i < stats.getNumPartitions(); ++i) {
+ // This loop is to handle live reconfigs that changes how many partitions(number of threads) might be used per query.
+ vespalib::string partitionId(vespalib::make_string("docid_part%02ld", i));
+ partitions.push_back(std::make_unique<DocIdPartition>(partitionId, this));
+ LOG(info, "Number of partitions has been increased to '%ld' from '%ld' previously configured. Adding part %ld",
+ stats.getNumPartitions(), partitions.size(), i);
+ }
+ for (size_t i = 0; i < stats.getNumPartitions(); ++i) {
+ partitions[i]->update(stats.getPartition(i));
}
}
}