-
1. Re: Write Skew issue (versioning)
manik Jan 27, 2012 11:09 AM (in response to pruivo)Hi Pedro.
I don't understand how this could have worked in 5.0.x since write skew checks in a cluster was not supported until 5.1.
Are you testing local mode?
Cheers
Manik
-
2. Re: Write Skew issue (versioning)
mircea.markus Jan 27, 2012 11:42 AM (in response to manik)One way or the other there shouldn't get duplicate counter values, right?
-
3. Re: Write Skew issue (versioning)
pruivo Jan 27, 2012 11:54 AM (in response to manik)Hi,
I'm testing in replicated mode (full replication).
In 5.0.x it works because of the locking scheme. In more detail, two cases can happen (list of events);
1) write skew is detected:
localTx reads "counter" and gets the value x
remote prepare (remoteTx) is received
remoteTx acquires lock on "counter"
localTx tries to acquire lock on "counter"
remoteTx updates "counter" to x+1
remoteTx releases the lock
localTx acquires the lock
localTx detects that "counter"'s value is x+1 and aborts (see [1])
2) deadlock/timeout acquiring the locks
localTx reads "counter" and gets the value x
localTx acquires the lock on "counter"
remote prepare (remoteTx) is received
remoteTx tries to acquire lock on "counter"
deadlock is detected (or a timeout is triggered)
For 5.1.x, I was expecting behavior like this:
localTx reads "counter" and gets the value x (version y)
remote prepare (remoteTx) is received and updates the "counter" to x+1 (version y+1)
localTx sends the prepare command and the coordinator performs the write skew check
The coordinator detects that the read version (y) is different from the actual version (y+1) and aborts the transaction
This is my "definition" of write skew.
Cheers,
Pedro
[1] in RepetableReadEntry
if (actualValue != null && actualValue != value) {
log.unableToCopyEntryForUpdate(getKey());
throw new CacheException("Detected write skew");
}
-
4. Re: Write Skew issue (versioning)
manik Jan 27, 2012 12:48 PM (in response to mircea.markus)No, in 5.0.x you may still get dupes.
-
5. Re: Write Skew issue (versioning)
manik Jan 27, 2012 12:49 PM (in response to pruivo)BTW is this unit test in a form that can be added to the Infinispan codebase? If you could fork the project and create a pull request with a commit containing the test that would be great.
-
6. Re: Write Skew issue (versioning)
pruivo Jan 27, 2012 1:07 PM (in response to manik)No. The code was implemented in a modified version of radargun... However, I can try to implement it as a unit test this weekend if you are interested
How hard is to implement a unit test?
-
7. Re: Write Skew issue (versioning)
pruivo Jan 28, 2012 9:27 AM (in response to manik)I have made a pull request with the test case. It's my first time that I create a test case and a pull request. If anything is wrong, please let me know.
Cheers,
Pedro
-