You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2016/02/29 03:40:03 UTC

[kudu-CR] KUDU-1354. Writes should not release locks before committing MVCC

Hello David Ribeiro Alves, Kudu Jenkins,

I'd like you to reexamine a change.  Please visit

    http://gerrit.cloudera.org:8080/2342

to look at the new patch set (#2).

Change subject: KUDU-1354. Writes should not release locks before committing MVCC
......................................................................

KUDU-1354. Writes should not release locks before committing MVCC

Previous to this commit, write operations released their row locks before
they marked their MVCC transaction as "committed". This could result in
the following interleaving when two writes operated on the same row:

T1:                     T2:
- acquire row lock
- acquire timestamp 1
- apply write
- release row lock
                        - acquire row lock
                        - acquire timestamp 2
                        - apply write
                        - release row lock
                        - commit MVCC txn 2
- commit MVCC txn 1

If a reader acquired an MVCC snapshot in after T2 committed, but
before T1, then its scanner could see invalid operations, such
as a delete or update for a row that was not yet inserted.

In the case of a flush taking its snapshot during this window of time,
it was possible for the "phase 1" of the flush to include T2, while
"phase 2" included T1. This would result in T2 being written to an
earlier-indexed REDO delta file compared to T1, which would cause a
CHECK failure when that rowset was later read or compacted.

This reduced alter_table-randomized-test from failing about 1% of the time
to less than 0.1% [1]. The remaining crashes are due to trying to open empty
LogBlockManager metadata files (KUDU-668).

[1] http://dist-test.cloudera.org//job?job_id=todd.1456690849.21084

Change-Id: Ie715e94f7b7e4848213d41c6837af574f5fa5d48
---
M src/kudu/tablet/transactions/transaction.h
M src/kudu/tablet/transactions/transaction_driver.cc
M src/kudu/tablet/transactions/write_transaction.cc
M src/kudu/tablet/transactions/write_transaction.h
4 files changed, 39 insertions(+), 56 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/42/2342/2
-- 
To view, visit http://gerrit.cloudera.org:8080/2342
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie715e94f7b7e4848213d41c6837af574f5fa5d48
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: David Ribeiro Alves <da...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>