Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Flaky Test RocksDBMessageStoreTest.testMaxOffset #7614

Closed
3 tasks done
lizhanhui opened this issue Dec 4, 2023 · 2 comments · Fixed by #7625
Closed
3 tasks done

[Bug] Flaky Test RocksDBMessageStoreTest.testMaxOffset #7614

lizhanhui opened this issue Dec 4, 2023 · 2 comments · Fixed by #7625

Comments

@lizhanhui
Copy link
Contributor

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

CI

RocketMQ version

CI

JDK Version

CI

Describe the Bug

RocksDBMessageStoreTest.testMaxOffset:625 expected:<[3]L> but was:<[1]L>

https://github.com/apache/rocketmq/actions/runs/7083756493/job/19276717683

Steps to Reproduce

See CI

What Did You Expect to See?

Test should pass

What Did You See Instead?

Test case failed

Additional Context

No response

@yp969803
Copy link
Contributor

yp969803 commented Dec 6, 2023

  public void testMaxOffset() throws InterruptedException {
        if (notExecuted()) {
            return;
        }
        int firstBatchMessages = 3;
        int queueId = 0;
        messageBody = storeMessage.getBytes();

        assertThat(messageStore.getMaxOffsetInQueue(messageTopic, queueId)).isEqualTo(0);

        for (int i = 0; i < firstBatchMessages; i++) {
            final MessageExtBrokerInner msg = buildMessage();
            msg.setQueueId(queueId);
            messageStore.putMessage(msg);
        }

        while (messageStore.dispatchBehindBytes() != 0) {
            TimeUnit.MILLISECONDS.sleep(1);
        }

        assertThat(messageStore.getMaxOffsetInQueue(messageTopic, queueId)).isEqualTo(firstBatchMessages);

Didn't find anything wrong in this code dont know why the test is failing

@lizhanhui
Copy link
Contributor Author

messageStore.dispatchBehindBytes() != 0 does not guarantee that the store has completed building the queue index. Awaitbility is preferred over sleep-loop.

lizhanhui added a commit to lizhanhui/rocketmq that referenced this issue Dec 8, 2023
Signed-off-by: lizhanhui <lizhanhui@gmail.com>
lizhanhui added a commit to lizhanhui/rocketmq that referenced this issue Dec 8, 2023
Signed-off-by: lizhanhui <lizhanhui@gmail.com>
lizhanhui added a commit to lizhanhui/rocketmq that referenced this issue Dec 8, 2023
Signed-off-by: lizhanhui <lizhanhui@gmail.com>
RongtongJin pushed a commit that referenced this issue Dec 11, 2023
* fix #7614 Flaky test RocksDBMessageStoreTest

Signed-off-by: lizhanhui <lizhanhui@gmail.com>

* fix: give TimerMessageStoreTest#testStateAndRecover more time for Awaitability to poll and check

Signed-off-by: lizhanhui <lizhanhui@gmail.com>

* clean up exclude test list of bazel

Signed-off-by: lizhanhui <lizhanhui@gmail.com>

---------

Signed-off-by: lizhanhui <lizhanhui@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants