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


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/filehandle/FileWriteHandleImpl.java:
##########
@@ -537,6 +531,34 @@ private static void fsync(MappedByteBuffer buf, int off, 
int len) throws IgniteC
             return false;
     }
 
+    /**
+     * Make fsync for part of the WAL segment file. And collect it to {@link 
CdcManager} if enabled.
+     *
+     * @param seg Part of the WAL segment file.
+     */
+    private void fsyncReadSegment(SegmentedRingByteBuffer.ReadSegment seg) 
throws IgniteCheckedException {
+        int off = seg.buffer().position();
+        int len = seg.buffer().limit() - off;
+
+        fsync((MappedByteBuffer)buf.buf, off, len);
+
+        if (cctx.cdc() != null && cctx.cdc().enabled()) {
+            try {
+                ByteBuffer cdcBuf = buf.buf.asReadOnlyBuffer();

Review Comment:
   `asReadOnlyBuffer` creates a new object on each invocation. It seems we must 
skip it and only set `position`, `limit` for existing object.
   
   Deeply internal components as `CdcManager` implementation can be implemented 
with care and not modify key byte structures inside.



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