You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2024/02/01 11:44:57 UTC

(lucene) branch main updated: Fix broken loop in TestDocumentsWriterStallControl.assertState() (#13062)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 3d47a0d5c22 Fix broken loop in TestDocumentsWriterStallControl.assertState() (#13062)
3d47a0d5c22 is described below

commit 3d47a0d5c22b150dc918c5af52fd9b0192509334
Author: Simon Willnauer <si...@apache.org>
AuthorDate: Thu Feb 1 12:44:50 2024 +0100

    Fix broken loop in TestDocumentsWriterStallControl.assertState() (#13062)
    
    The loop in assertState prematurely exists due to a broken break steament.
    
    Closes #13061
---
 .../index/TestDocumentsWriterStallControl.java     | 23 +++++++++-------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java b/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java
index 395fdde7b88..33334fd78e5 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java
@@ -174,22 +174,17 @@ public class TestDocumentsWriterStallControl extends LuceneTestCase {
       DocumentsWriterStallControl ctrl)
       throws InterruptedException {
     int millisToSleep = 100;
-    while (true) {
-      if (ctrl.hasBlocked() && ctrl.isHealthy()) {
-        for (int n = numReleasers + numStallers; n < numReleasers + numStallers + numWaiters; n++) {
-          if (ctrl.isThreadQueued(threads[n])) {
-            if (millisToSleep < 60000) {
-              Thread.sleep(millisToSleep);
-              millisToSleep *= 2;
-              break;
-            } else {
-              fail("control claims no stalled threads but waiter seems to be blocked ");
-            }
+    while (ctrl.hasBlocked() && ctrl.isHealthy()) {
+      for (int n = numReleasers + numStallers; n < numReleasers + numStallers + numWaiters; n++) {
+        if (ctrl.isThreadQueued(threads[n])) {
+          if (millisToSleep < 60000) {
+            Thread.sleep(millisToSleep);
+            millisToSleep *= 2;
+            break;
+          } else {
+            fail("control claims no stalled threads but waiter seems to be blocked ");
           }
         }
-        break;
-      } else {
-        break;
       }
     }
   }