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

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


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

commit 775c4c135d93fb7e912d92a5b0e6d002bd44d8bb
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 198d00b6de7..7b45fd6e479 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
@@ -1380,8 +1380,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