Skip to content

Commit

Permalink
[java] Deflake TestKuduSession.testInsertAutoFlushBackgroundNonCovere…
Browse files Browse the repository at this point in the history
…dRange

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 <[email protected]>
Reviewed-by: Grant Henke <[email protected]>
  • Loading branch information
wdberkeley committed Jun 3, 2019
1 parent 072260b commit 1a0452a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public void testInsertAutoFlushSyncNonCoveredRange() throws Exception {
}

@Test(timeout = 10000)
public void testInsertAutoFlushBackgrounNonCoveredRange() throws Exception {
public void testInsertAutoFlushBackgroundNonCoveredRange() throws Exception {
CreateTableOptions createOptions = getBasicTableOptionsWithNonCoveredRange();
createOptions.setNumReplicas(1);
client.createTable(tableName, basicSchema, createOptions);
Expand All @@ -421,7 +421,7 @@ public void testInsertAutoFlushBackgrounNonCoveredRange() throws Exception {
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);
Expand Down

0 comments on commit 1a0452a

Please sign in to comment.