Skip to content

[Bug] Incorrect min offset returned from TieredMessageStore when local store returns -1 #10193

@Kris20030907

Description

@Kris20030907

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

MacOS

RocketMQ version

develop

JDK Version

jdk8

Describe the Bug

Minimum read offset boundary issue.

TieredMessageStore#getMinOffsetInQueue may return an incorrect result when the local store does not have a valid min offset but tiered storage still has readable data.

At present, the method merges the min offset from the next store and tiered store like this:

  • return local min offset if tiered min offset is invalid
  • otherwise return Math.min(localMinOffset, tieredMinOffset)

The problem is that the local store may return -1 as a sentinel value when no valid local min offset is available. In that case, -1 is not a real queue offset and should not participate in the final comparison.

Steps to Reproduce

null

What Did You Expect to See?

need to return when the tiered store offset is valid and local store don't have valid offset

What Did You See Instead?

The effective offset of a tiered store will be ignored, and the method returns -1

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions