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] commitlogs in diffrent dir are the same name when set multiple dir(storePathCommitLog) #8859

Open
3 tasks done
domyway opened this issue Oct 23, 2024 · 2 comments · May be fixed by #8897
Open
3 tasks done

[Bug] commitlogs in diffrent dir are the same name when set multiple dir(storePathCommitLog) #8859

domyway opened this issue Oct 23, 2024 · 2 comments · May be fixed by #8897

Comments

@domyway
Copy link

domyway commented Oct 23, 2024

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

centos8
local ssd

RocketMQ version

5.1.4

JDK Version

1.8

Describe the Bug

The configured directories are:
/data, /data2, /data3, /data4.

After a long period of pressure testing, we found that in different directories, there are commitlog files with the same name. One of these commitlog files appears to be empty, but the filenames are identical. Is this a bug, and is there any risk associated with it?

If the process restarts, and duplicate commitlog files are loaded, could this also pose a risk?

As for code analysis, we're unsure if it's correct:

In MultiPathMappedFileQueue.java, this file is used for creating files across multiple paths. In the tryCreateMappedFile implementation, paths where the disk usage is high (85%) will be filtered out, and new commitlog files will not be created in those paths.

However, it is possible that during a previous create map file operation, the path was already added to nextNextFilePath for pre-creation. If the paths change in the next cycle, a new commitlog will be created in a different path as the actual commitlog, while the previously pre-created file will be unused and essentially a "fake" file.

Steps to Reproduce

set storePathCommitLog=/data,/data1,/data2,/data3
and just continue produce

What Did You Expect to See?

commitlog will not be the same name

What Did You See Instead?

none

Additional Context

No response

@domyway domyway changed the title [Bug] Bug title [Bug] commitlog in diffrent dir are the same name when set multiple dir(storePathCommitLog) Oct 23, 2024
@domyway domyway changed the title [Bug] commitlog in diffrent dir are the same name when set multiple dir(storePathCommitLog) [Bug] commitlogs in diffrent dir are the same name when set multiple dir(storePathCommitLog) Oct 23, 2024
@domyway
Copy link
Author

domyway commented Oct 28, 2024

image

@hexueyuan
Copy link

I did some testing locally and it turns out that this issue can cause written messages to not be consumed.

In my case, i create duplicate commit log file 00000000000000001024 in different path as follows :
image

When MappedFileQueue initializing, these four files (including duplicate files) will be loaded into mappedFiles, and a self-check error ERROR log will be printed in the checkSelf function.
c8fa8f77de6a43d703faa805dae309ff

What's more serious is that when using offset to find MappedFile, the first MappedFile will be returned. If this file is one of the empty files, it means that there is no message here, or it will cause a more serious system exception.
2e4f331f8de32edf10d5b38dc11f335d

I haven't done more testing, so I'm not sure if this bug only affects consumption, but I think this issue has a big impact on system stability.

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