MVV and step visibility and pruning errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Akiban Persistit |
Fix Released
|
Critical
|
Peter Beaman |
Bug Description
Persistit r369
When utilizing the step capability of transactions there appears to be inconsistencies in how it is treated between reading, writing, removing, and pruning. Particularly when steps of a single transaction appear out of order in a single MVV.
Observe the following test code that loads keys 1, 2, and 3. Then, in a single transaction, keys 1 and 3 are removed at step 1 and written at step 2 where key 2 is updated at step 2 and removed at step 1. The expected behavior is all 3 keys are visible at the end with their new values.
public void update(Exchange ex, int k, int v) throws Exception {
_persistit.
ex.
ex.
ex.store();
}
public void remove(Exchange ex, int k) throws Exception {
_persistit.
ex.
ex.remove();
}
@Test
public void mvvStepCheck() throws Exception {
Transaction txn = _persistit.
Exchange ex = _persistit.
txn.begin();
for(int i = 1; i <= 3; ++i) {
ex.store();
}
txn.commit();
txn.end();
treeCheck(ex, "Initial");
txn.begin();
for(int i = 1; i <= 3; ++i) {
if(i == 2) {
} else {
}
}
treeCheck(ex, "Post update, pre commit");
txn.commit();
txn.end();
treeCheck(ex, "Updated, committed");
}
The method as written gives the following output.
Initial
{1} => 10
{2} => 20
{3} => 30
Post update, pre commit
{1} => 100
{2} => 200
{3} => 300
Looks good so far. However, 2 inconsistent cases have been observed by inserting some code at the end.
Case 1: Read after prune yields missing key/value
Code:
while(
}
treeCheck(ex, "Updated, committed, pruned");
Output:
Updated, committed, pruned
{1} => 100
{3} => 300
Case 2: Read after TransactionIndex cleanup yields non-removable but visible key
Code:
_persistit.
txn.begin();
treeCheck(ex, "Updated, committed, TI cleaned");
ex.
System.
txn.commit();
txn.end();
treeCheck(ex, "Updated, committed, TI cleaned, removed");
Output:
Updated, committed, TI cleaned
{1} => 100
{2} => 200
{3} => 300
Removed: false
Updated, committed, TI cleaned, removed
{1} => 100
{2} => 200
{3} => 300
Related branches
- Akiban Build User: Needs Fixing
- Nathan Williams: Approve
-
Diff: 231 lines (+148/-18)3 files modifiedsrc/main/java/com/persistit/MVV.java (+17/-5)
src/test/java/com/persistit/Bug1056489Test.java (+125/-0)
src/test/java/com/persistit/MVVTest.java (+6/-13)
Changed in akiban-persistit: | |
assignee: | nobody → Peter Beaman (pbeaman) |
Changed in akiban-persistit: | |
milestone: | none → 3.1.8 |
status: | New → Fix Committed |
Changed in akiban-persistit: | |
status: | Fix Committed → Fix Released |
Marking as critical since this can result in data loss.