markrmiller commented on code in PR #4514:
URL: https://github.com/apache/solr/pull/4514#discussion_r3470111120


##########
solr/core/src/java/org/apache/solr/util/circuitbreaker/MemoryCircuitBreaker.java:
##########
@@ -96,19 +166,51 @@ public MemoryCircuitBreaker setThreshold(double 
thresholdValueInPercentage) {
 
   @Override
   public boolean isTripped() {
-
-    long localAllowedMemory = getCurrentMemoryThreshold();
+    long localAllowedMemory = heapMemoryThreshold;
     long localSeenMemory = getAvgMemoryUsage();
 
     allowedMemory.set(localAllowedMemory);
-
     seenMemory.set(localSeenMemory);
 
-    return (localSeenMemory >= localAllowedMemory);
+    return localSeenMemory >= localAllowedMemory;
   }
 
+  /**
+   * Returns post-GC live bytes for use by {@link #isTripped()}, cached for 
{@link
+   * CircuitBreakerRegistry#SYSPROP_SAMPLE_TTL_MS} ms so high-QPS callers 
don't repeatedly walk the
+   * heap pool list.
+   *
+   * <p>The historical name is preserved for source-compatibility. Tests that 
need to inject a
+   * synthetic value typically override this method directly (which bypasses 
the cache); tests that
+   * want to feed a synthetic sample <em>through</em> the cache should 
override {@link
+   * #samplePostGcLiveBytes()} instead. The implementation no longer averages 
anything.
+   */

Review Comment:
   The reason was the access level: it is `protected` on a `public` non-final 
class, so it is part of the subclassing surface for external breakers. Renaming 
is a source-compat break for a cosmetic gain. I don't care about changing it, 
but I was attempting to be as gentle as I could given this was made a plugin 
point (a choice I don't like at all, but once it's made, I like to err in the 
users favor when I couldn't care less myself.)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to