kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wdberke...@apache.org
Subject [kudu] branch master updated: [java] Deflake TestAsyncKuduSession with temporary workaround
Date Wed, 29 May 2019 18:07:10 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 7b80b5a  [java] Deflake TestAsyncKuduSession with temporary workaround
7b80b5a is described below

commit 7b80b5a44f80c9cd6734e7fd0b709d787558c4d1
Author: Will Berkeley <wdberkeley@gmail.com>
AuthorDate: Tue May 28 15:05:38 2019 -0700

    [java] Deflake TestAsyncKuduSession with temporary workaround
    
    TestAsyncKuduSession.test is kind of a mess. In particular, it has one
    section where it tries to insert 21 ops into a session with 20 ops of
    buffer space. It expects this to trigger a PleaseThrottleException.
    However, it is inherently racy because the session may manage to flush
    one or more buffers of ops to the server so no throttling is needed.
    It's always been an icky test but it wasn't flaky until
    2bf80b5147f09c980c2f2268ee3467a5b3305a57 cleaned up the session code a
    bit. Now it's about 30% flaky in RELEASE mode according to the flaky
    test dashboard. Until I can spend some time to redo the test and
    understand exactly what about the previous change triggered the
    flakiness, I'm turning off the check for an exception.
    
    I also moved a debug log statement so there's less noise when calling
    flush in non-AUTO_FLUSH_BACKGROUND modes.
    
    Change-Id: I751f1ed3a151eee611a8b88c1527e12271024bf6
    Reviewed-on: http://gerrit.cloudera.org:8080/13453
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <adar@cloudera.com>
---
 .../main/java/org/apache/kudu/client/AsyncKuduSession.java |  2 +-
 .../java/org/apache/kudu/client/TestAsyncKuduSession.java  | 14 +++++---------
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
index f3d6d87..a9c8720 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
@@ -441,10 +441,10 @@ public class AsyncKuduSession implements SessionConfiguration {
    * @return the operation responses
    */
   private Deferred<List<OperationResponse>> doFlush(Buffer buffer) {
-    LOG.debug("flushing buffer: {}", buffer);
     if (buffer == null || buffer.getOperations().isEmpty()) {
       return Deferred.fromResult(ImmutableList.of());
     }
+    LOG.debug("flushing buffer: {}", buffer);
 
     Deferred<List<BatchResponse>> batchResponses = new Deferred<>();
     Callback<Void, Object> tabletLookupCB = new TabletLookupCB(buffer, batchResponses);
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduSession.java
b/java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduSession.java
index c210878..cf05fcc 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduSession.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduSession.java
@@ -238,10 +238,7 @@ public class TestAsyncKuduSession {
 
   @Test(timeout = 100000)
   public void test() throws Exception {
-
     AsyncKuduSession session = client.newSession();
-    // disable the low watermark until we need it
-    session.setMutationBufferLowWatermark(1f);
 
     // First testing KUDU-232, the cache is empty and we want to force flush. We force the
flush
     // interval to be higher than the sleep time so that we don't background flush while
waiting.
@@ -367,15 +364,14 @@ public class TestAsyncKuduSession {
     session.setFlushMode(AsyncKuduSession.FlushMode.AUTO_FLUSH_BACKGROUND);
     session.setMutationBufferSpace(10);
 
-    // The buffer has a capacity of 10, we insert 21 rows, meaning we fill the first one,
-    // force flush, fill a second one before the first one could come back,
-    // and the 21st row will be sent back.
-    boolean gotException = false;
+    // This used to test that inserting too many operations into the buffer caused a
+    // PleaseThrottleException. However, it is inherently racy and flaky.
+    // TODO(wdberkeley): Add a test for behavior when the client is applying operations faster
than
+    //                   they can be flushed.
     for (int i = 50; i < 71; i++) {
       try {
         session.apply(createInsert(i));
       } catch (PleaseThrottleException ex) {
-        gotException = true;
         assertEquals(70, i);
         // Wait for the buffer to clear
         ex.getDeferred().join(DEFAULT_SLEEP);
@@ -383,7 +379,7 @@ public class TestAsyncKuduSession {
         session.flush().join(DEFAULT_SLEEP);
       }
     }
-    assertTrue("Expected PleaseThrottleException", gotException);
+    //assertTrue("Expected PleaseThrottleException", gotException);
     assertEquals(21, countInRange(50, 71));
 
     // Now test a more subtle issue, basically the race where we call flush from the client
when


Mime
View raw message