nizhikov commented on code in PR #11112:
URL: https://github.com/apache/ignite/pull/11112#discussion_r1432664224


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java:
##########
@@ -561,45 +586,60 @@ public boolean writeForIterator(
             CacheObject val,
             GridCacheVersion ver
         ) {
-            boolean written = true;
+            String reason = null;
 
             if (isAfterStart(ver))
-                written = false;
-            else if (changed.get(cache).contains(key))
-                written = false;
-            else
-                write(cache, expireTime, key, val, ver);
+                reason = "greater version";
+            else {
+                try {
+                    CacheObjectContext coCtx = cctx.cacheObjectContext(cache);
+
+                    synchronized (serializer) { // Prevent concurrent access 
to the dump file.
+                        iterLastKeyCache = cache;
+                        iterLastKey = key;
+
+                        if (changed.get(cache).contains(key))
+                            reason = "written by listener";
+                        else
+                            write(cache, expireTime, key, val, ver, coCtx);
+                    }
+                }
+                catch (IOException | IgniteCheckedException e) {
+                    throw new IgniteException(e);
+                }
+            }
 
             if (log.isTraceEnabled()) {
                 log.trace("Iterator [" +
                     "grp=" + grp +
                     ", cache=" + cache +
                     ", part=" + part +
                     ", key=" + key +
-                    ", written=" + written +
-                    ", ver=" + ver + ']');
+                    ", written=" + (reason == null ? "true" : reason) +
+                    ", ver=" + ver +
+                    ", startVer=" + (startVer != null) + ']');
             }
 
-            return written;
+            return reason == null;
         }
 
         /** */
-        private void write(int cache, long expireTime, KeyCacheObject key, 
CacheObject val, GridCacheVersion ver) {
-            synchronized (serializer) { // Prevent concurrent access to the 
dump file.
-                try {
-                    ByteBuffer buf = serializer.writeToBuffer(cache, 
expireTime, key, val, ver, cctx.cacheObjectContext(cache));
+        private void write(
+            int cache,
+            long expireTime,
+            KeyCacheObject key,
+            CacheObject val,
+            GridCacheVersion ver,
+            CacheObjectContext coCtx
+        ) throws IgniteCheckedException, IOException {

Review Comment:
   Because of `CacheObjectContext coCtx = cctx.cacheObjectContext(cache);` 
which throws `IgniteCheckedException`. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to