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


Change subject: KUDU-2612: loosen restrictions for BEGIN_COMMIT ops
......................................................................

KUDU-2612: loosen restrictions for BEGIN_COMMIT ops

This patch updates the state validations for the BEGIN_COMMIT. Rather
than only requiring an in-flight transaction to be kOpen (the common
case) or kCommitInProgress (if re-attempting a BEGIN_COMMIT call), it's
more robust to allow the call to be made even after the transaction has
already been finalized. This will allow a to-be-merged implementation of
a commit task to be retried with much less fuss.

Here's some pseudo-code for such a commit task:
  commit task:
    1. persist COMMIT_IN_PROGRESS record on TxnStatusManager
    2. foreach participant as p: BEGIN_COMMIT(p)
    3. commit_ts = max timestamp used across BEGIN_COMMIT ops
    4. foreach participant as p: FINALIZE_COMMIT(p, commit_ts)
    5. persist COMMITTED record on TxnStatusManager

If the commit task is interrupted (e.g. by some crash)  between steps 3
and 5, we may be left with some participants with fully finalized
commits. In such cases, all other participants _must_ also finalize, and
they must finalize with the same timestamp. To ensure this, it must be
possible to re-run a commit task. However, re-running it without this
patch may lead to issues because the BEGIN_COMMIT ops would yield
errors, complaining about an illegal state on participants that were
finalized.

This patch allows for a BEGIN_COMMIT op to succeed and return
immediately if a FINALIZE_COMMIT op has already completed. If so, the
finalized commit timestamp is sent back, allowing for the above commit
task to be repeatable.

Change-Id: Ifa4c5314190c84648c1b1edea7aab776b4882f97
---
M src/kudu/integration-tests/txn_participant-itest.cc
M src/kudu/tablet/tablet_metadata.cc
M src/kudu/tablet/tablet_metadata.h
M src/kudu/tablet/txn_participant-test.cc
M src/kudu/tablet/txn_participant.h
5 files changed, 119 insertions(+), 19 deletions(-)



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

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa4c5314190c84648c1b1edea7aab776b4882f97
Gerrit-Change-Number: 16992
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Wong <[email protected]>

Reply via email to