Guangcun Li created RATIS-2711:
----------------------------------
Summary: Double position counting in LimitedInputStream
Key: RATIS-2711
URL: https://issues.apache.org/jira/browse/RATIS-2711
Project: Ratis
Issue Type: Bug
Components: RaftLog
Reporter: Guangcun Li
h3. 1. Double counting in LimitedInputStream.read(byte[])
{{super.read(byte[])}} delegates to {{read(byte[], int, int)}}, which already
updates {{curPos}}. The outer method increments it again.
Remove the redundant {{read(byte[])}} override. The current
{{SegmentedRaftLogReader}} avoids this bug because its {{DataInputStream}}
wrapper calls the three-argument overload directly.
h3. 2. Redundant assignment in BufferedWriteChannel.flushBuffer()
Since RATIS-589, {{flushBuffer()}} calls {{writeToChannel()}}, which already
sets {{forced = false}}. The subsequent assignment can be removed.
h3. Verification
* A reproducing test confirms the double counting.
* {{TestBufferedWriteChannel}} passes with the redundant assignment replaced by
an assertion that {{forced}} is already {{false}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)