Andrew Wong has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/16952


Change subject: wip KUDU-2612: background task to commit transaction
......................................................................

wip KUDU-2612: background task to commit transaction

This patch introduces background tasks that get run when
KuduTransaction::Commit() is called. The typical workflow is as follows:
1. Commit() is called, resulting in a BeginCommitTransaction() call on
   the TxnStatusManager.
2. An update is made to the transaction status table, marking the
   transaction's state as COMMIT_IN_PROGRESS.
3. The commit tasks are initiated -- BEGIN_COMMIT ops are sent
   asynchronously to every participant of the transaction.
4. Once all responses are received from the participants, a commit
   timestamp is determined, and FINALIZE_COMMIT ops are sent
   asynchronously to every participant.
5. Once all responses are received from the participants, an update is
   made to the transaction status table, marking the transaction's state
   as COMMITTED.

There are some nuances here around error handling. Namely, what do we do
if there are errors in sending the above requests? Well, it depends on
the error. Transient errors (i.e. timeouts) are simply retried. More
permanent errors need a bit more thought though:
- If the transaction is in the incorrect state, what do we do?
  TODO: make BEGIN_COMMIT requests return TXN_OP_ALREADY_APPLIED even if
  we've already called FINALIZE_COMMIT.
  TODO: make BEGIN_COMMIT requests return some TXN_ABORTED error if we've
  already called ABORT_TXN.
- If a participant has been deleted, what do we do? This patch makes a
  best effort attempt to abort the transaction if so.

wip because:
- Need to address the above TODOs (in separate patches)
- Open to feedback on the error handling otherwise.
- I'm considering rebasing on the leader locking patch.

Change-Id: Ie2258dded3ab3d527cb5d0abdc7d5e7deb4da15e
---
M src/kudu/client/client-test.cc
M src/kudu/integration-tests/CMakeLists.txt
A src/kudu/integration-tests/txn_commit-itest.cc
M src/kudu/master/txn_manager-test.cc
M src/kudu/tablet/txn_coordinator.h
M src/kudu/transactions/transactions.proto
M src/kudu/transactions/txn_status_entry.cc
M src/kudu/transactions/txn_status_manager-test.cc
M src/kudu/transactions/txn_status_manager.cc
M src/kudu/transactions/txn_status_manager.h
M src/kudu/transactions/txn_system_client.h
M src/kudu/tserver/tablet_server.cc
M src/kudu/tserver/tablet_server.h
M src/kudu/tserver/ts_tablet_manager.cc
M src/kudu/tserver/ts_tablet_manager.h
15 files changed, 1,052 insertions(+), 95 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/52/16952/1
--
To view, visit http://gerrit.cloudera.org:8080/16952
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2258dded3ab3d527cb5d0abdc7d5e7deb4da15e
Gerrit-Change-Number: 16952
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Wong <aw...@cloudera.com>

Reply via email to