rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

[Bug] The last index file should not be deleted when the broker recovers abnormally

Open lizhimins opened this issue 1 year ago • 4 comments

Before Creating the Bug Report

  • [X] I found a bug, not just asking a question, which should be created in GitHub Discussions.
  • [X] I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
  • [X] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

5.10.112-005.ali5000.alios7.x86_64

RocketMQ version

develop version: 5.1.4

JDK Version

JDK11

Describe the Bug

The last index file should not be deleted when the broker recovers abnormally.

image

Steps to Reproduce

  • First, send more than 3GB of data to the broker, then terminate the broker process using "kill -9" and restart it.
  • The broker will enter an abnormal recovery process and delete the last index file.
  • We can't query message by message uniqueKey which earliest send, it would return failed.

What Did You Expect to See?

The last index file should not be deleted when the broker recovers abnormally

What Did You See Instead?

The last index file should not be deleted when the broker recovers abnormally

Additional Context

  • Avoid crashes and retain the last file.
  • The next value must be smaller than the current one in "index item" to prevent issues of Infinite loop caused by file corruption.

lizhimins avatar Apr 09 '24 11:04 lizhimins

I want to try to solve this problem, can you assign it to me

3424672656 avatar Apr 09 '24 11:04 3424672656

OK, could you first describe the improvement plan.

lizhimins avatar Apr 10 '24 02:04 lizhimins

It looks like we need to keep the first index file that needs to be deleted

3424672656 avatar Apr 10 '24 07:04 3424672656

Can we initiate an email or wechat discussion

3424672656 avatar Apr 10 '24 07:04 3424672656

This issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.

github-actions[bot] avatar Apr 20 '25 00:04 github-actions[bot]

This issue was closed because it has been inactive for 3 days since being marked as stale.

github-actions[bot] avatar Apr 24 '25 00:04 github-actions[bot]