Merge lp:~pbeaman/akiban-persistit/add-lock2 into lp:akiban-persistit

Proposed by Peter Beaman
Status: Merged
Approved by: Nathan Williams
Approved revision: 428
Merged at revision: 418
Proposed branch: lp:~pbeaman/akiban-persistit/add-lock2
Merge into: lp:akiban-persistit
Diff against target: 26 lines (+8/-7)
1 file modified
src/main/java/com/persistit/Transaction.java (+8/-7)
To merge this branch: bzr merge lp:~pbeaman/akiban-persistit/add-lock2
Reviewer Review Type Date Requested Status
Nathan Williams Approve
Review via email: mp+145976@code.launchpad.net

Description of the change

Make the status fields (e.g., _commitCompleted) volatile. Use of a Transaction instance is almost entirely thread-private, but the CLEANUP_MANAGER thread looks at the transaction state of Transaction instances that formerly belonged to now-ended threads. I believe a failure we are seeing in WriteSkewIT is caused by an intermittent failure to read that state coherently. Specifically, it is trying to run rollback on a Transaction that actually has already been rolled back (by its own thread), and that attempt is throwing an IllegalMonitorStateException for that reason.

To post a comment you must log in.
Revision history for this message
Nathan Williams (nwilliams) wrote :

Sounds plausible.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main/java/com/persistit/Transaction.java'
2--- src/main/java/com/persistit/Transaction.java 2012-11-30 20:33:30 +0000
3+++ src/main/java/com/persistit/Transaction.java 2013-01-31 20:56:24 +0000
4@@ -412,14 +412,15 @@
5 private final Persistit _persistit;
6 private final SessionId _sessionId;
7 private final long _id;
8- private int _nestedDepth;
9- private boolean _rollbackPending;
10- private boolean _rollbackCompleted;
11- private boolean _commitCompleted;
12+
13+ private volatile int _nestedDepth;
14+ private volatile boolean _rollbackPending;
15+ private volatile boolean _rollbackCompleted;
16+ private volatile boolean _commitCompleted;
17
18- private long _rollbackCount = 0;
19- private long _commitCount = 0;
20- private int _rollbacksSinceLastCommit = 0;
21+ private volatile long _rollbackCount = 0;
22+ private volatile long _commitCount = 0;
23+ private volatile int _rollbacksSinceLastCommit = 0;
24
25 private volatile TransactionStatus _transactionStatus;
26 private volatile long _startTimestamp;

Subscribers

People subscribed via source and target branches