Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2504

WriteSkew check fails for entries which are inserted first time


      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.

            pruivo@redhat.com Pedro Ruivo
            rvansa1@redhat.com Radim Vansa (Inactive)
            0 Vote for this issue
            4 Start watching this issue