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

WriteSkew check fails for entries which are inserted first time

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.3.0.Final
    • 5.2.5.Final
    • Transactions
    • None

      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)
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: