You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/10/05 13:06:36 UTC
[GitHub] [solr] asalamon74 commented on a change in pull request #326: SOLR-15301 Eliminate repetitive index size calculation for Solr metrics
asalamon74 commented on a change in pull request #326:
URL: https://github.com/apache/solr/pull/326#discussion_r722220992
##########
File path: solr/core/src/java/org/apache/solr/core/SolrCore.java
##########
@@ -491,22 +490,27 @@ public long getIndexSize() {
}
public long getCachedIndexSize() {
- if (indexSize.get() == null) {
- if (log.isDebugEnabled()) {
- log.debug("Recalculating index size for {}", getName());
+ SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
+ if (requestInfo != null) {
+ Map<Object,Object> contextMap = requestInfo.getReq().getContext();
+ Long cachedIndexSize = (Long)contextMap.get(cachedIndexSizeKeyName(getName()));
Review comment:
I'll change it.
##########
File path: solr/core/src/java/org/apache/solr/core/SolrCore.java
##########
@@ -491,22 +490,27 @@ public long getIndexSize() {
}
public long getCachedIndexSize() {
- if (indexSize.get() == null) {
- if (log.isDebugEnabled()) {
- log.debug("Recalculating index size for {}", getName());
+ SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
+ if (requestInfo != null) {
+ Map<Object,Object> contextMap = requestInfo.getReq().getContext();
+ Long cachedIndexSize = (Long)contextMap.get(cachedIndexSizeKeyName(getName()));
Review comment:
Those logs were very useful for me, when I did the testing but true, in the final version the simplified code is more important, so I'll change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org