2 Replies Latest reply: Jul 16, 2013 9:12 AM by jcpsantos RSS

    WriteBehind storeAll vs WriteThrough erase

    user9541741

      Hi,

       

      In my company we have been using Oracle Coherence for a while and today we identified a behavior that we were still unable to find out if it is expected or if is some problem in Coherence.

      Basically, we have a write-behind cache configured and are doing some heavy updates in entries stored in this cache while at the same time removing some of these entries. All of the operations are using entry processors (entry.setValue("X"), entry.remove(false)).

       

      I was already aware that when using write-behind, store/storeAll are asynchronous and erase/eraseAll are synchronous with cache operations. The problem we came across is that stores are being executed shortly after the erase is executed, so:

      - we update the entry, it is added to the write behind queue;

      - we remove the entry, coherence calls cachestore erase;

      - write delay passes, coherence calls cachestore storeall, with the entry we previously removed;

       

      I've added some logging (millis timestamp) when entering/leaving the storeAll/erase methods and what we are seeing is the following:

      [1373388770003]ms erasing

      [1373388770041]ms erased

      [1373388770238]ms storing

      [1373388770836]ms stored

       

      Is this expected behavior? Shouldnt Coherence invalidate entries on the write behind queue when one of the entries is removed?

      If it does invalidate entries in the write behind queue, what happens if the entry is removed and the erase gets called AFTER the entry is in the write behind queue but ALREADY delivered to the cachestore store/storeall methods? Does the erase/eraseall method waits for the store/storeall to finish?

       

      Thanks

        • 1. Re: WriteBehind storeAll vs WriteThrough erase
          robvarga

          Hi,

           

          what is the key class for that entry?

           

          If it is not some class handled by POF as a known type, could you please post the source of your key class (and of its PofSerializer if you use a separate PofSerializer)?

           

          Also what exact Coherence version do you use?

           

          Thanks and best regards,

           

          Rob

          • 2. Re: WriteBehind storeAll vs WriteThrough erase
            jcpsantos

            Hi Robert,

             

            The problem was showing up even with a simple "String" or "Integer" key.

            I updated Coherence from 3.7.1.3 to 3.7.1.9 and this behavior is corrected. The erase now waits for any pending store/storeAll operation that is being executed on the CacheStore. On 3.7.1.3 you can replicate this just by:

            - execute a cache put at 0s;

            - execute a cache erase of the same entry at 10s;

            - set write behind delay to 5s;

            - cachestore store/storeall operations with sleep for 10s before storing the entries;

             

            When finding a workaround for this problem in 3.7.1.3 we identified another possible issue, which still remains in 3.7.1.9:

            - if you execute a flush operation on the RWBackingMap, it does wait for the cachestore to store all the entries in the write behind queue, BUT, if there is a ongoing store/storeAll operation when you call the flush, it does not wait for that specific operation (seems that the backingmap looses track of the ongoing operation).

             

            We're trying to confirm this with Oracle support, waiting for feedback on the issue.