yurinaryshkin commented on code in PR #10798:
URL: https://github.com/apache/ignite/pull/10798#discussion_r1252941894


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/ByteBufferWalIterator.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.wal;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Optional;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import 
org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer;
+import 
org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactory;
+import 
org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactoryImpl;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.jetbrains.annotations.NotNull;
+
+/** Byte Buffer WAL Iterator */
+public class ByteBufferWalIterator extends WalRecordsIteratorAdaptor {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private final transient ByteBuffer buf;
+
+    /** */
+    private final transient RecordSerializer serializer;
+
+    /** */
+    private final transient ByteBufferBackedDataInputImpl dataInput;
+
+    /** */
+    public ByteBufferWalIterator(
+        @NotNull IgniteLogger log,
+        GridCacheSharedContext<?, ?> cctx,
+        ByteBuffer byteBuf) throws IgniteCheckedException {
+        super(log);
+
+        buf = byteBuf;
+
+        RecordSerializerFactory rsf = new RecordSerializerFactoryImpl(cctx,
+            (t, p) -> t.purpose() == 
WALRecord.RecordPurpose.LOGICAL).skipPositionCheck(true);

Review Comment:
   Skip position is used for 2 checks:
    - file index
    - position in file
   It is possible to check position in file, I'll enhance the tests accordingly.
   As for file index check, the iterator doesn't know the file index. I can see 
several options here:
    - Accept file index in constructor.
    - Fully ignore file index.
    - Automatically detect file index from the first message in the buffer and 
perform the check against this file index.
   Please advise.



-- 
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