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

RIP-7 Multiple Directories Storage Support #3357

Merged
merged 9 commits into from
Sep 25, 2021

Conversation

Jason918
Copy link
Contributor

@Jason918 Jason918 commented Sep 15, 2021

Make sure set the target branch to develop

What is the purpose of the change

Follow up PR of #3348
Update according to comments, see change log

Brief changelog

  1. remove isMultiCommitlogPathEnable
  2. In org.apache.rocketmq.store.DefaultMessageStore.CleanCommitLogService#isSpaceToDelete, use minPhysicRatio to determin when the broker's disk is full. And mark all store path when it's full.
  3. In org.apache.rocketmq.store.MultiPathMappedFileQueue#tryCreateMappedFile, we ignore readonly paths and paths marked full in step 2.

Verifying this change

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Jiang Haiting added 2 commits September 16, 2021 10:55
…cessor.SendMessageProcessor#diskUtil

2. use minPhysicsUsedRatio instead of max in org.apache.rocketmq.store.DefaultMessageStore#getRuntimeInfo
Copy link
Member

@francisoliverlee francisoliverlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked and muti commit log dir work well. but some errors in DiskCheckScheduledThread and AdminBrokerThread measuring Disk usage.it seems AdminBrokerThread error when no any topics

image

2021-09-17 02:24:50 ERROR DiskCheckScheduledThread1 - Error when measuring disk space usage, file doesn't exist on this path: /opt/rocketmq/master-data1/commitlog:/opt/rocketmq/master-data2/commitlog
2021-09-17 02:25:00 ERROR AdminBrokerThread_7 - Error when measuring disk space usage, file doesn't exist on this path: /opt/rocketmq/master-data1/consumequeue
2021-09-17 02:25:00 ERROR DiskCheckScheduledThread1 - Error when measuring disk space usage, file doesn't exist on this path: /opt/rocketmq/master-data1/commitlog:/opt/rocketmq/master-data2/commitlog
2021-09-17 02:25:03 ERROR AdminBrokerThread_8 - Error when measuring disk space usage, file doesn't exist on this path: /opt/rocketmq/master-data1/consumequeue
2021-09-17 02:25:10 ERROR DiskCheckScheduledThread1 - Error when measuring disk space usage, file doesn't exist on this path: /opt/rocketmq/master-data1/commitlog:/opt/rocketmq/master-data2/commitlog

@Jason918
Copy link
Contributor Author

Jason918 commented Sep 17, 2021

DiskCheckScheduledThread1

@francisoliverlee Thank you for the notice.
Error in DiskCheckScheduledThread1 is due to storePathCommitLog usage in "DefaultMessageStore.CleanCommitLogService#isSpaceFull". I fixed it and added test in last commit.
Sorry for missing that. I have checked all the usage of storePathCommitLog.

@Jason918
Copy link
Contributor Author

Jason918 commented Sep 17, 2021

AdminBrokerThread error when no any topics

@francisoliverlee
The log shows that the error in AdminBrokerThread is due to the directory for storing CQs is not created.
It's a little bit strange, this PR should have nothing to do with CQs.
I would try to reproduce it.

@francisoliverlee francisoliverlee changed the title RIP-7 Multiple Directories Storage Suppor RIP-7 Multiple Directories Storage Support Sep 18, 2021
@Jason918
Copy link
Contributor Author

@francisoliverlee Added path empty check to avoid error log. Checked with bin/mqadmin brokerStatus -n 127.1:9876 -b 127.1:10911, no error logs appears in broker.log.
Please take a look.

Copy link
Contributor

@RongtongJin RongtongJin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM~, but only one disk is written at the same time, which does not take advantage of the increased write bandwidth after multi-disk deployment.

@duhenglucky
Copy link
Contributor

duhenglucky commented Sep 20, 2021

DiskCheckScheduledThread1

@francisoliverlee Thank you for the notice.
Error in DiskCheckScheduledThread1 is due to storePathCommitLog usage in "DefaultMessageStore.CleanCommitLogService#isSpaceFull". I fixed it and added test in last commit.
Sorry for missing that. I have checked all the usage of storePathCommitLog.

It seems this error still exists ,and maybe you discarded this method org.apache.rocketmq.common.UtilAll#getDiskPartitionSpaceUsedPercent, or should we check the existence of a directory at the start of the broker?

@Jason918
Copy link
Contributor Author

Jason918 commented Sep 21, 2021

It seems this error still exists ,and maybe you discarded this method org.apache.rocketmq.common.UtilAll#getDiskPartitionSpaceUsedPercent, or should we check the existence of a directory at the start of the broker?

Yes, for now, user have to put existing file paths in storePathCommitLog.

Added isPathExists check in 'DiskCheckScheduledThread'.

PTAL

…Config#MULTI_PATH_SPLITTER to ',' and can be changed by System.getProperty("rocketmq.broker.multiPathSplitter")
@Jason918
Copy link
Contributor Author

LGTM~, but only one disk is written at the same time, which does not take advantage of the increased write bandwidth after multi-disk deployment.

After this multi-disk deployment, read bandwidth will be fully utilized.
In current one big commit log writing pattern, writing concurrently requires much more work. Maybe soft raid is more suitable for now, if write bandwidth is the physical bottleneck.

Copy link
Contributor

@ni-ze ni-ze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like muti-commit log dir make sence.

@ni-ze
Copy link
Contributor

ni-ze commented Sep 21, 2021

LGTM~, but only one disk is written at the same time, which does not take advantage of the increased write bandwidth after multi-disk deployment.

yes, it is. Appending messages write last MappedFile only, other files can not be written at all.

@francisoliverlee
Copy link
Member

francisoliverlee commented Sep 22, 2021

DiskCheckScheduledThread1

@francisoliverlee Thank you for the notice.
Error in DiskCheckScheduledThread1 is due to storePathCommitLog usage in "DefaultMessageStore.CleanCommitLogService#isSpaceFull". I fixed it and added test in last commit.
Sorry for missing that. I have checked all the usage of storePathCommitLog.

It seems this error still exists ,and maybe you discarded this method org.apache.rocketmq.common.UtilAll#getDiskPartitionSpaceUsedPercent, or should we check the existence of a directory at the start of the broker?

error stills.
image

when doing getDiskPartitionSpaceUsedPercent(), how about a WARNING for NO consume queue dir ?
@Jason918 @duhenglucky

@vongosling vongosling added the progress/wip Work in progress. Accept or refused to be continue. label Sep 22, 2021
@lollipopjin
Copy link
Contributor

If we add a cloud disk to the running ecs, can the new cloud disk be recognized by updating broker.conf dynamically?

@Jason918
Copy link
Contributor Author

If we add a cloud disk to the running ecs, can the new cloud disk be recognized by updating broker.conf dynamically?

Yes, It should work. You can add path after storePathCommitLog.
But, one thing to be noticed, if your server is started with only one commit log path, you have to restart the server to change it to multi-path-commit-log mode. Because mappedFileQueue in class Commitlog is initialized during start up.
One way to avoid this restart is to add a MessageStoreConfig#MULTI_PATH_SPLITTER(default is ',' and can be changed by system property "rocketmq.broker.multiPathSplitter") after origin single storePathCommitLog, e.g. "~/store/commitlog,".

Copy link
Member

@francisoliverlee francisoliverlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@cserwen
Copy link
Member

cserwen commented Feb 24, 2022

readOnlyCommitLogStorePaths: I have a question to ask. What is the meaning of this configuration, is it used for smooth upgrade? @Jason918

@Jason918
Copy link
Contributor Author

readOnlyCommitLogStorePaths: I have a question to ask. What is the meaning of this configuration, is it used for smooth upgrade? @Jason918

Yep, it can be used to decommission some broken disks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
progress/wip Work in progress. Accept or refused to be continue. type/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet