Details
-
Bug
-
Resolution: Done
-
Major
-
5.2.5.Final
-
None
Description
If optimistic locking and write skew check are configured and there are two concurrent transactions performing
read(key) -> null
write(key, value)
one of them should fail (if both read null). However, both transaction succeed in this case. The reason is that that the VersionedPrepareCommand has null version for the key (because it was null) but in WriteSkewHelper.performWriteSkewCheckAndReturnNewVersions there is
EntryVersion versionSeen = prepareCommand.getVersionsSeen().get(k); if (versionSeen != null) entry.setVersion(versionSeen);
As the entry contains the version injected into context from dataContainer in EntryFactoryImpl.wrapInternalCacheEntryForPut lately during the VersionedPrepareCommand execution, and the version is not overwritten from the getVersionsSeen() value (as this is null), the performWriteSkewCheck does not report this entry as changed.