apache / apache/rocketmq

[Bug] FlatAppendFile readAsync truncates reads spanning more than two segments

Open
#10,878 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I found a bug, not just a question.
- [x] I searched open GitHub Issues and pull requests and found no duplicate.
- [x] I confirmed that this bug belongs to Apache RocketMQ.

### Runtime platform environment

macOS (Darwin), reproduced with an isolated local unit test.

### RocketMQ version

Branch: develop
Git commit: fd0c95920e0deac96ce2ae27442747cc5e65e930

### JDK Version

Zulu OpenJDK 8 (8.94.0.17)

### Describe the Bug

FlatAppendFile.readAsync combines at most the segment containing the start offset and the immediately following segment. A request spanning three or more committed file segments silently returns only the first two portions.

### Steps to Reproduce

1. Create three contiguous committed consume-queue file segments of 100 bytes each.
2. Call readAsync with offset 50 and length 250.
3. Inspect the returned buffer length and contents.

### What Did You Expect to See?

The returned buffer should contain all 250 requested bytes in segment order.

### What Did You See Instead?

Only 150 bytes are returned because the third segment is never read.

### Additional Context

A focused FlatAppendFileTest reproduces expected length 250 versus actual length 150.

Contributor guide

Open the contributing guide

Research direction

Start with FlatAppendFile.readAsync and the focused FlatAppendFileTest described in the report. Reproduce the three-segment case with offset 50 and length 250, then verify that the returned buffer contains all 250 bytes in segment order rather than stopping after two segments.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.