Alexey Serbin has uploaded this change for review. (
http://gerrit.cloudera.org:8080/17431
Change subject: WIP KUDU-2612 automatically flush sessions on txn commit
......................................................................
WIP KUDU-2612 automatically flush sessions on txn commit
With this patch, all still-in-the-scope transactional sessions
are automatically flushed upon call of the KuduTransaction::Commit()
method for the corresponding transaction handle.
As for the KuduTransaction::StartCommit() method, it's now necessary
to flush all the transactional sessions created off the transaction
handle before calling the method, otherwise an Status::IllegalState()
would be returned.
As Andrew and I discussed offline, it might be an option to return
an error from KuduSession::Apply() for a transactional session whose
transaction has already started committing. However, after looking
at this closer, I realized that would be tricky and would add
more complexity into a hot path of pushing write operations into a
session. So, I opted not to perform that consistency check, relying
on KuduSession::Flush() and KuduSession::FlushAsync() reporting
on an error later on when accumulated write operations are being
submitted to the server side.
This patch also contains test for the newly introduced functionality.
WIP:
* Add in-line documentation about the related behavior of a
transactional KuduSession for KuduTransaction::Commit() and
KuduTransaction::StartCommit()
* Is it OK to keep just a weak pointer to a session in the
transaction? Similar functionality might be trickier in Java
client. Overall, do we expect any issues with keeping shared_ptr,
not weak_ptr for a session for a transaction?
* Is it OK to accept an write operation in a transactional session
(i.e. Apply() doesn't return an error), but return an error only
later on in an attemp to flush a session?
Change-Id: I2480129a99fb19d16868e14f9b9e33c83e3d8e7f
---
M src/kudu/client/client-test.cc
M src/kudu/client/transaction-internal.cc
M src/kudu/client/transaction-internal.h
3 files changed, 634 insertions(+), 15 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/31/17431/1
--
To view, visit http://gerrit.cloudera.org:8080/17431
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2480129a99fb19d16868e14f9b9e33c83e3d8e7f
Gerrit-Change-Number: 17431
Gerrit-PatchSet: 1
Gerrit-Owner: Alexey Serbin <[email protected]>