You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2016/07/19 23:21:55 UTC
incubator-kudu git commit: [java-client] fix soundness hole in
flushing async kudu session
Repository: incubator-kudu
Updated Branches:
refs/heads/master e831ab430 -> 53c3b2c66
[java-client] fix soundness hole in flushing async kudu session
This fixes an issue where AsyncKuduSession#apply in AUTO_FLUSH_BACKGROUND mode
could refresh the active buffer and add an initial operation to it, but fail to
set a flush timer on it. Writing a regression test proved to be very difficult
since it relies on a lot of timing variables around how fast batches can flush.
Change-Id: Ic838b65e2ccf5c48f0b51db235936b834aa24cae
Reviewed-on: http://gerrit.cloudera.org:8080/3676
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Reviewed-by: Jean-Daniel Cryans <jd...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kudu/commit/53c3b2c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kudu/tree/53c3b2c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kudu/diff/53c3b2c6
Branch: refs/heads/master
Commit: 53c3b2c66a4cf00efa63660df4f81c288aee7775
Parents: e831ab4
Author: Dan Burkert <da...@cloudera.com>
Authored: Tue Jul 19 13:10:47 2016 -0700
Committer: Dan Burkert <da...@cloudera.com>
Committed: Tue Jul 19 23:21:31 2016 +0000
----------------------------------------------------------------------
.../src/main/java/org/kududb/client/AsyncKuduSession.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kudu/blob/53c3b2c6/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java b/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java
index 024f66d..400e46e 100644
--- a/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java
+++ b/java/kudu-client/src/main/java/org/kududb/client/AsyncKuduSession.java
@@ -542,6 +542,7 @@ public class AsyncKuduSession implements SessionConfiguration {
// synchronized block.
fullBuffer = activeBuffer;
activeBuffer = null;
+ activeBufferSize = 0;
if (inactiveBufferAvailable()) {
refreshActiveBuffer();
} else {
@@ -571,8 +572,10 @@ public class AsyncKuduSession implements SessionConfiguration {
if (activeBufferSize + 1 >= mutationBufferSpace && inactiveBufferAvailable()) {
// If the operation filled the buffer, then flush it.
+ Preconditions.checkState(fullBuffer == null);
fullBuffer = activeBuffer;
activeBuffer = null;
+ activeBufferSize = 0;
} else if (activeBufferSize == 0) {
// If this is the first operation in the buffer, start a background flush timer.
client.newTimeout(activeBuffer.getFlusherTask(), interval);