[ 
https://issues.apache.org/jira/browse/IGNITE-18091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17634256#comment-17634256
 ] 

Denis Chudov edited comment on IGNITE-18091 at 11/15/22 9:29 AM:
-----------------------------------------------------------------

*Correct* means that the behavior matches the expectations.
||N||Scenario||Ignite 3||MVP||Expected||
|1|*testWaitDie0* 
var tx1 = beginTx(); 
var tx2 = beginTx(); 
 
var key1 = key("test"); 
 
xlock(tx2, key1).join(); 
 
CompletableFuture<?> xlockFutTx1 = xlock(tx1, key1); 
assertFalse(xlockFutTx1.isDone()); 
commitTx(tx2); 
xlockFutTx1.join();|Tx2 waits on attempt to acquire x-lock.
*Note:* works correctly with reverse transaction order.|correct|X-lock for tx2 
fails, as tx2 younger than tx1 and is not allowed to wait for tx1, it should 
DIE instead.|
|2|*testWaitDie1*
 
var tx1 = beginTx();var tx2 = beginTx();
 
var key1 = key("test");
 
xlock(tx2, key1).join();
CompletableFuture<?> xlockFutTx1 = xlock(tx1, key1);
{_}assertFalse{_}(xlockFutTx1.isDone());
 
commitTx(tx2);
xlockFutTx1.join();|Tx1 fails on attempt of acquiring the x-lock
 
*Note:* works correctly with reverse transaction order.|correct|tx2 
successfully acquires x-lock.
tx1 waits on attempt of acquiring x-lock.
After tx2 is committed, the future for tx1 is completed without exception.|
|3|*testWaitDieSlocks0*
 
*var tx1 = beginTx();var tx2 = beginTx();
*
*var key1 = key("test");
*
*slock(tx1, key1).join();slock(tx2, key1).join();*
*CompletableFuture<?> xlockTx1 = xlock(tx1, key1);

{_}assertFalse{_}(xlockTx1.isDone());*
*commitTx(tx2);xlockTx1.join();*|X-lock for tx1 returns future that is 
completed exceptionally with LockException

*Note:* works correctly with reverse transaction order.|correct|Tx1 waits for 
tx2 to commit, then x-lock for tx1 is acquired.|

 


was (Author: denis chudov):
*Correct* means that the behavior matches the expectations.
||N||Scenario||Ignite 3||MVP||Expected||
|1|*testWaitDie0* 
var tx1 = beginTx(); 
var tx2 = beginTx(); 
 
var key1 = key("test"); 
 
xlock(tx2, key1).join(); 
 
CompletableFuture<?> xlockFutTx1 = xlock(tx1, key1); 
assertFalse(xlockFutTx1.isDone()); 
commitTx(tx2); 
xlockFutTx1.join();|Tx2 waits on attempt to acquire x-lock.
*Note:* works correctly with reverse transaction order.|correct|X-lock for tx2 
fails, as tx2 younger than tx1 and is not allowed to wait for tx1, it should 
DIE instead.|
|2|*testWaitDie1*
 
var tx1 = beginTx();var tx2 = beginTx();
 
var key1 = key("test");
 
xlock(tx2, key1).join();
CompletableFuture<?> xlockFutTx1 = xlock(tx1, key1);
{_}assertFalse{_}(xlockFutTx1.isDone());
 
commitTx(tx2);
xlockFutTx1.join();|Tx1 fails on attempt of acquiring the x-lock
 
*Note:* works correctly with reverse transaction order.|correct|tx2 
successfully acquires x-lock.
tx1 waits on attempt of acquiring x-lock.
After tx2 is committed, the future for tx1 is completed without exception.|

 

> Compare deadlock prevention implementations and work out decisions about 
> correct behavior in corner cases
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-18091
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18091
>             Project: Ignite
>          Issue Type: Task
>            Reporter: Denis Chudov
>            Assignee: Denis Chudov
>            Priority: Major
>              Labels: ignite-3
>
> *Motivation*
> Today we have several possible implementations of deadlock prevention: AI 3 
> [1], transactions POC [2], and possible implementation based on concurrency 
> control paper [3]. Moreover, we have a multiple granularity lock model [4] 
> where some lock modes are compatible, others are not, which allows 
> reenterability in some cases, and sharing of locks between transactions. We 
> should understand the differences of behavior of each implementation in 
> different scenarios, and how it matches with our expectations.
> *Definition of done*
> Table with a set of scenarios and description of behavior, including the 
> expected one.
> [1] org.apache.ignite.internal.tx.impl.HeapLockManager
> [2] https://github.com/ascherbakoff/ai3-txn-mvp
> [3] https://dl.acm.org/doi/pdf/10.1145/320251.320260
> [4] https://web.stanford.edu/class/cs245/readings/granularity-of-locks.pdf



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to