You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by gr...@apache.org on 2019/06/03 17:53:45 UTC

[kudu] 02/06: [java] Deflake TestKuduSession.testInsertAutoFlushBackgroundNonCoveredRange

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

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

commit 1a0452a3192debe39e6b4c5150c2994b7027a127
Author: Will Berkeley <wd...@gmail.com>
AuthorDate: Mon Jun 3 01:08:37 2019 -0700

    [java] Deflake TestKuduSession.testInsertAutoFlushBackgroundNonCoveredRange
    
    The test uses an AsyncKuduSession in AUTO_FLUSH_BACKGROUND mode to send
    20 inserts. 10 of them should fail because they are in a non-covered
    range. However, the test did not join on the deferred when it called
    AsyncKuduSession#flush. Therefore, there was no guarantee the operations
    had been completed. So, every now and then, the ops were still in flight
    when the errors were checked, causing the test to fail because it saw no
    error where it expected to see errors.
    
    Before this fix, the test failed because of this problem about 1/1000
    times. I ran 1000 with the fix and saw no failures, but the rate was so
    low maybe I was lucky. Regardless, I'm confident the test is more
    correct with this fix.
    
    Change-Id: I40360e9c7979c2edf01b4a70b64f71af4d1a1e11
    Reviewed-on: http://gerrit.cloudera.org:8080/13497
    Tested-by: Will Berkeley <wd...@gmail.com>
    Reviewed-by: Grant Henke <gr...@apache.org>
---
 .../src/test/java/org/apache/kudu/client/TestKuduSession.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
index 628a05f..b293a52 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestKuduSession.java
@@ -395,7 +395,7 @@ public class TestKuduSession {
   }
 
   @Test(timeout = 10000)
-  public void testInsertAutoFlushBackgrounNonCoveredRange() throws Exception {
+  public void testInsertAutoFlushBackgroundNonCoveredRange() throws Exception {
     CreateTableOptions createOptions = getBasicTableOptionsWithNonCoveredRange();
     createOptions.setNumReplicas(1);
     client.createTable(tableName, basicSchema, createOptions);
@@ -421,7 +421,7 @@ public class TestKuduSession {
     for (int key = 90; key < 110; key++) {
       session.apply(createBasicSchemaInsert(table, key));
     }
-    session.flush();
+    session.flush().join(5000);
 
     errors = session.getPendingErrors();
     assertEquals(10, errors.getRowErrors().length);