Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-1292: followup tweak based on mailing list discussion: for indexes with lots of segments, estimating the size of all the field caches can take a lot of time (particularly with lots of String based caches) so for now we only estimate the size for items which are part of instanity instances

Chris M. Hostetterb1e21e704150
diff --git a/src/java/org/apache/solr/search/SolrFieldCacheMBean.java b/src/java/org/apache/solr/search/SolrFieldCacheMBean.java
index 4e71824c7bf..24e6d59817b 100644
--- a/src/java/org/apache/solr/search/SolrFieldCacheMBean.java
+++ b/src/java/org/apache/solr/search/SolrFieldCacheMBean.java
@@ -61,7 +61,6 @@ public class SolrFieldCacheMBean implements SolrInfoMBean {
stats.add("entries_count", entries.length);
for (int i = 0; i < entries.length; i++) {
CacheEntry e = entries[i];
- e.estimateSize();
stats.add("entry#" + i, e.toString());
}
@@ -69,6 +68,13 @@ public class SolrFieldCacheMBean implements SolrInfoMBean {
stats.add("insanity_count", insanity.length);
for (int i = 0; i < insanity.length; i++) {
+
+ // we only estimate the size of insane entries
+ for (CacheEntry e : insanity[i].getCacheEntries()) {
+ // don't re-estimate if we've already done it.
+ if (null == e.getEstimatedSize()) e.estimateSize();
+ }
+
stats.add("insanity#" + i, insanity[i].toString());
}
return stats;