Will Berkeley created KUDU-2776:
-----------------------------------
Summary: Java AUTO_FLUSH_BACKGROUND behaves like
"AUTO_FLUSH_FOREGROUND" when tablet locations are cached
Key: KUDU-2776
URL: https://issues.apache.org/jira/browse/KUDU-2776
Project: Kudu
Issue Type: Bug
Affects Versions: 1.9.0
Reporter: Will Berkeley
Attachments: image-2019-04-16-14-37-07-908.png
!image-2019-04-16-14-37-07-908.png!
The above piece of a Java flamegraph shows the main application thread
{{apply}}ing operations to a {{KuduSession}} in {{AUTO_FLUSH_BACKGROUND}} mode.
The {{doFlush}} call is meant to set up a callbacks that actually send the rows
to Kudu and that are triggered by the fulfillment of a Deferred for the tablet
locations. However, when the tablet locations are cached, this Deferred can be
fulfilled basically instantly, so by the time that the {{apply}}ing thread
calls {{addCallbacks}}, the deferred is complete, and as an optimization the
async library executes the callbacks on the thread that is adding them to the
fulfilled Deferred. This means the {{apply}}ing thread executes the code that
sends rows to Kudu, which is the opposite of how {{AUTO_FLUSH_BACKGROUND}} is
meant to work.
We lose out on the ability to have multiple batches in flight at once, and we
serialize the application logic, {{apply}}, and actually sending rows to Kudu.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)