2 Replies Latest reply on Feb 9, 2010 10:28 AM by Bryan Grunow

    Cache transactions and querying

    Bryan Grunow Newbie

      We are currently seeing an issue adding items to a cache and then querying Infinispan for those items.


      The scenario is we’re adding item 1 to cache A and item 2 to cache B in a transaction.  We then pull from cache A and use the returned value to query cache B.  When the caches are empty item 1 is pulled from cache A and is used to query cache B.  The expectation is that we’ll get item 2.

      The result is we don’t get anything for 20-30ms and then we get item 2.  Out theory is that the index is taking some time to be built after the transaction is completed.


      If this is true is there a way to make the indexing of the cache part of the transaction so it’s adding to the cache and adding to the index is an atomic action?


      We are currently using CR3


      Thanks,
      Bryan

        • 1. Re: Cache transactions and querying
          Manik Surtani Master

          Updating indexes is usually added to a transaction's batch such that as a transaction commits, cache indexes are updated accordingly.  I presume you are suggesting that indexes are updated within the transaction such that subsequent queries within the same tx sees updated indexes?  If that is the case, that would be non-trivial to implement since we'd need to be able to roll back any index updates in the event of a transaction failure.

          • 2. Re: Cache transactions and querying
            Bryan Grunow Newbie

            Thanks Manik,

             

            So it sounds like we're somewhat correct in our evaluation that updating the index is not part of the transaction.

             

            We can work around this issue for a while since it is only a problem under light load.  During normal load there are enough transactions that we always have a bit of a backlog and we can find work immediately.

             

            Thanks,

             

            Bryan