You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Will Berkeley (Code Review)" <ge...@cloudera.org> on 2019/05/15 19:19:13 UTC
[kudu-CR] [java] Clean up AsyncKuduSession
Will Berkeley has uploaded a new patch set (#2). ( http://gerrit.cloudera.org:8080/13336 )
Change subject: [java] Clean up AsyncKuduSession
......................................................................
[java] Clean up AsyncKuduSession
This makes several improvements to AsyncKuduSession code.
1. I replaced a lot of wordy callback definitions with Java 8 lambdas.
2. I renamed the member variable and method parameter names for ones
that were mutation-buffer-space-related. The new names reflect that
the buffers are measured in number of ops, not size in bytes. I
couldn't rename the methods because that would break API
compatibility.
3. I renamed 'interval' to 'intervalMillis', following naming best
practice, unless it would break compatibility.
4. I added some helper functions and simplified logic in a few places.
5. I removed all of the "low watermark rejections". Previously, the
AsyncKuduSession tracked a low watermark percentage (default 0.5)
and, once the buffer was more full than that percentage and there's
an ongoing flush, new operations were rejected out of apply with a
PleaseThrottleException with a probability scaling linearly from 0
to 1 as the buffer went from the watermark to full. I don't think
this makes sense, however, as it simply means doing more work to fill
the buffer. Applications ought to just fill the buffer as fast as
possible, and then wait to apply more. The PleaseThrottleException
provides a deferred that applications can wait on until there is
buffer space available. In fact, this was causing bad behavior in the
synchronous KuduSession, which, in its apply, would fill the buffer
until the first PleaseThrottleException (high chance of this being
before the buffer is full) and then it would wait until the
outstanding flush was finished before returning, holding up preparing
more ops for flush for basically no reason.
6. I removed the test for the watermark behavior.
Change-Id: I0c901af497b3a4195c78b62c61d31aa00866a993
---
M java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduSession.java
M java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java
M java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java
M java/kudu-client/src/test/java/org/apache/kudu/client/TestAsyncKuduSession.java
4 files changed, 113 insertions(+), 171 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/36/13336/2
--
To view, visit http://gerrit.cloudera.org:8080/13336
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0c901af497b3a4195c78b62c61d31aa00866a993
Gerrit-Change-Number: 13336
Gerrit-PatchSet: 2
Gerrit-Owner: Will Berkeley <wd...@gmail.com>