Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug] Querying message in tiered storage may fail due to small time scope #9233

Copy link
Copy link
@bxfjb

Description

@bxfjb
Issue body actions

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

any

RocketMQ version

develop

JDK Version

jdk8

Describe the Bug

I found following code in org.apache.rocketmq.tieredstore.index.IndexStoreService:

@Override
    public CompletableFuture<List<IndexItem>> queryAsync(
        String topic, String key, int maxCount, long beginTime, long endTime) {

        CompletableFuture<List<IndexItem>> future = new CompletableFuture<>();
        try {
            readWriteLock.readLock().lock();
            ConcurrentNavigableMap<Long, IndexFile> pendingMap =
                this.timeStoreTable.subMap(beginTime, true, endTime, true);
            List<CompletableFuture<Void>> futureList = new ArrayList<>(pendingMap.size());
            ...

The pendingMap is the actual queried index file map, key is create timestamp of the file. But it seemed that ConcurrentSkipListMap.subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) is used wrongly here: the sub map may miss the first index file contains the correct message.

Steps to Reproduce

Enable index build, produce some message, stop production before creating the 2nd index file, query message with time range [a,b] (a > 0), the pendingMap should be empty.

What Did You Expect to See?

The query should return correct result.

What Did You See Instead?

Can not find message in tiere storage.

Additional Context

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.