SOLR-9374: Speed up Jmx MBean retrieval for FieldCache

(cherry picked from commit b1b933e)
This commit is contained in:
Shalin Shekhar Mangar 2016-08-28 01:04:36 +05:30
parent d4954dad23
commit 5a16f15260
3 changed files with 10 additions and 2 deletions

View File

@ -54,6 +54,8 @@ Bug Fixes
Optimizations
----------------------
* SOLR-9374: Speed up Jmx MBean retrieval for FieldCache. (Tim Owen via shalin)
Other Changes
----------------------

View File

@ -61,12 +61,14 @@ public class SolrFieldCacheMBean implements JmxAugmentedSolrInfoMBean {
private NamedList getStats(boolean listEntries) {
NamedList stats = new SimpleOrderedMap();
String[] entries = UninvertingReader.getUninvertedStats();
stats.add("entries_count", entries.length);
if (listEntries) {
String[] entries = UninvertingReader.getUninvertedStats();
stats.add("entries_count", entries.length);
for (int i = 0; i < entries.length; i++) {
stats.add("entry#" + i, entries[i]);
}
} else {
stats.add("entries_count", UninvertingReader.getUninvertedStatsSize());
}
return stats;
}

View File

@ -388,4 +388,8 @@ public class UninvertingReader extends FilterLeafReader {
}
return info;
}
public static int getUninvertedStatsSize() {
return FieldCache.DEFAULT.getCacheEntries().length;
}
}