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

Two concurrent replaceWithVersions may both succeed

    Details

    • Type: Bug
    • Status: New (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.0.0.Final
    • Fix Version/s: None
    • Component/s: Remote Protocols
    • Labels:
      None

      Description

      Cache contains entry K = V. Two concurrent threads, that execute:

      long version = cache.getVersioned(K).getVersion();
      boolean succeeded = cache.replaceWithVersion(K, V, version);
      

      Both of these threads can get succeeded = true.

      Reason:
      When the server receives the operation ReplaceIfUnmodified=replaceWithVersion, it retrieves the entry (key + value + metadata) from the cache and checks that the version stored (in metadata) is the same as the version in the request. If so, it creates conditional ReplaceCommand which contains the value (retrieved atomically with version from the cache) and executes this one. Therefore, as the value is in both requests identical (and is not changed by the replace), two concurrent ReplaceCommands can both succeed, and this value is returned to the HotRod client.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  galder.zamarreno Galder ZamarreƱo
                  Reporter:
                  rvansa Radim Vansa
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated: