This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 9fde70b9e7f SOLR-17014: Ensure that injecting random recording flag 
only happens under randomized context SOLR-16960 (#1983)
9fde70b9e7f is described below

commit 9fde70b9e7fff2a1d24d55d23e38383daf642c10
Author: Kevin Risden <[email protected]>
AuthorDate: Thu Oct 5 12:17:07 2023 -0400

    SOLR-17014: Ensure that injecting random recording flag only happens under 
randomized context SOLR-16960 (#1983)
---
 .../src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java 
b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index 75113bc5b66..3b8d4e1c774 100644
--- 
a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ 
b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -1318,8 +1318,13 @@ public class MiniSolrCloudCluster {
    * mechanics.
    */
   private static void injectRandomRecordingFlag() {
-    boolean isRecording = LuceneTestCase.rarely();
-    TraceUtils.IS_RECORDING = (ignored) -> isRecording;
+    try {
+      boolean isRecording = LuceneTestCase.rarely();
+      TraceUtils.IS_RECORDING = (ignored) -> isRecording;
+    } catch (IllegalStateException e) {
+      // This can happen in benchmarks or other places that aren't in a 
randomized test
+      log.warn("Unable to inject random recording flag due to outside 
randomized context", e);
+    }
   }
 
   private static void resetRecordingFlag() {

Reply via email to