apurtell commented on code in PR #2133:
URL: https://github.com/apache/phoenix/pull/2133#discussion_r2078309263


##########
phoenix-core-server/src/main/java/org/apache/phoenix/replication/log/LogFileFormatReader.java:
##########
@@ -0,0 +1,355 @@
+/*
+ * 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.phoenix.replication.log;
+
+import java.io.Closeable;
+import java.io.EOFException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.apache.hadoop.hbase.io.compress.Compression;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.compress.Decompressor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Handles the low-level reading of headers, blocks, and trailers for Log 
files. Manages reading
+ * from the underlying stream, checksum validation, decompression, and 
providing access to block
+ * data for the Codec.
+ */
[email protected](value = { "EI_EXPOSE_REP", 
"EI_EXPOSE_REP2" },
+    justification = "Intentional")
+public class LogFileFormatReader implements Closeable {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(LogFileFormatReader.class);
+
+    private LogFileReaderContext context;
+    private LogFile.Codec.Decoder decoder;
+    private SeekableDataInput input;
+    private LogFile.Header header;
+    private LogFile.Trailer trailer = null;
+    private long currentPosition = 0;
+    private ByteBuffer currentBlockBuffer = null;

Review Comment:
   @kadirozde Done in 7eb1b31 . The reader tracks the decoder's position in the 
block and knows when it should or should not advance the codec. If the codec 
fails to advance this is treated like a case of corruption because it probably 
is (although the codec implementation could also be buggy.) Avoids the 
unnecessary call to advance.



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