sergey-chugunov-1985 commented on code in PR #12178:
URL: https://github.com/apache/ignite/pull/12178#discussion_r2235962661


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java:
##########
@@ -504,6 +505,46 @@ public void storeEnabled(boolean storeEnabled) {
         return storeEnabled() && txState().storeWriteThrough(cctx);
     }
 
+    /**
+     * Clears tx entries if they could be re-read from a read-through {@link 
CacheStore}.
+     * <p>
+     * This method takes effect only if all Ignite caches involved into 
transaction configured with CacheStores in
+     * read-through mode.
+     */
+    protected void clearCacheStoreBackedEntries() {
+        if (txState().cacheIds() == null)
+            return;
+
+        GridIntIterator iter = txState().cacheIds().iterator();
+        while (iter.hasNext()) {
+            int cacheId = iter.next();
+
+            if (cctx.cacheContext(cacheId) == null)
+                return;
+
+            if (!cctx.cacheContext(cacheId).config().isReadThrough())
+                return;
+        }
+
+        for (IgniteTxEntry e : writeMap().values()) {
+            try {
+                GridCacheEntryEx entry = e.cached();
+
+                if (e.op() != NOOP) {

Review Comment:
   I agree that this implementation looks similar to `uncommit` but the reason 
I decided to implement it in a separate method was that I wanted to keep 
`uncommit` logic untouched so no possible exceptions thrown inside 
`clearCacheStoreBackedEntries` affect `uncommit`. Does it make sense to you?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to