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

xyuanlu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 729bc40fb Fix the CI test case: testBatchMessageThreadpoolSize() - by 
removing the ASSERT for non-invariant.(#2531)
729bc40fb is described below

commit 729bc40fbec946ff73515dd08a8245598c17ddd7
Author: Komal Desai <[email protected]>
AuthorDate: Tue Jun 13 11:32:32 2023 -0700

    Fix the CI test case: testBatchMessageThreadpoolSize() - by removing the 
ASSERT for non-invariant.(#2531)
    
    TaskExecutor is internally uses _batchMessageExecutorService when batch 
mode is enabled. This threadpool is of type newCachedThreadPool().
    
    newCachedThreadPool - Creates a thread pool that creates new threads as 
needed, but will reuse previously constructed threads when they are available.
    
    The test creates 10 database resources and the check is to see if it pool 
size is 10 or more. This is not invariant. It will depend.
    
    Removing the assert as it is not invariant.
    
    Co-authored-by: Komal Desai <[email protected]>
---
 .../helix/messaging/handling/TestResourceThreadpoolSize.java       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
index d5506793a..c9c47236e 100644
--- 
a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
+++ 
b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestResourceThreadpoolSize.java
@@ -203,7 +203,12 @@ public class TestResourceThreadpoolSize extends 
ZkStandAloneCMTestBase {
     HelixTaskExecutor helixExecutor = svc.getExecutor();
     ThreadPoolExecutor executor = (ThreadPoolExecutor) 
(helixExecutor._batchMessageExecutorService);
     Assert.assertNotNull(executor);
-    Assert.assertTrue(executor.getPoolSize() >= numberOfDbs);
+
+    // This ASSERT invariant is not true.
+    // _batchMessageExecutorService is created as newCachedThreadPool().
+    // which will re-use existing threads if they are available. 
+    // So there is no gurantee that new threads will be created for each new 
database
+    // Assert.assertTrue(executor.getPoolSize() >= numberOfDbs);
 
     BestPossibleExternalViewVerifier verifier =
         new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME)

Reply via email to