You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/07/22 07:11:31 UTC
[GitHub] [rocketmq] Oliverwqcwrw opened a new pull request, #4661: [ISSUE #4660] Fix updateBrokerConfig
Oliverwqcwrw opened a new pull request, #4661:
URL: https://github.com/apache/rocketmq/pull/4661
**Make sure set the target branch to `develop`**
## What is the purpose of the change
Close #4660
## Brief changelog
XX
## Verifying this change
XXXX
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`.
- [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) 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.
- [x] 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.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] 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](https://github.com/apache/rocketmq/tree/master/test).
- [x] 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](http://www.apache.org/licenses/#clas).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] complone commented on a diff in pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
complone commented on code in PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#discussion_r965795257
##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +224,35 @@ public void persist() {
}
}
+ public void persistBrokerConf(Properties from) {
+ BufferedReader reader = null;
+ try {
+ readWriteLock.readLock().lockInterruptibly();
Review Comment:
The following inline method already exists in getAllConfigsFormatString Is it possible to take the relevant logic?
##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +224,35 @@ public void persist() {
}
}
+ public void persistBrokerConf(Properties from) {
+ BufferedReader reader = null;
+ try {
+ readWriteLock.readLock().lockInterruptibly();
+ String fileName = this.getStorePath();
+ File file = new File(fileName);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ Properties properties = new Properties();
+ reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
+ properties.load(reader);
+ merge(from, properties);
+ final String str = MixAll.properties2String(properties);
+ MixAll.string2File(str, fileName);
+ } catch (Exception e) {
+ log.error("persist brokerConf error", e);
Review Comment:
Maybe when an exception is thrown, we also need to close the reader?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] Oliverwqcwrw closed pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by "Oliverwqcwrw (via GitHub)" <gi...@apache.org>.
Oliverwqcwrw closed pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
URL: https://github.com/apache/rocketmq/pull/4661
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] tsunghanjacktsai commented on a diff in pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
tsunghanjacktsai commented on code in PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#discussion_r944066385
##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +221,35 @@ public void persist() {
}
}
+ public void persistBrokerConf(Properties from) {
+ FileReader reader = null;
+ try {
+ readWriteLock.readLock().lockInterruptibly();
+ String fileName = this.getStorePath();
+ File file = new File(fileName);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ Properties properties = new Properties();
+ reader = new FileReader(fileName);
+ properties.load(reader);
+ merge(from, properties);
+ final String str = MixAll.properties2String(properties);
+ MixAll.string2File(str, fileName);
+ } catch (Exception e) {
+ log.error("persist brokerConf error", e);
+ } finally {
+ readWriteLock.readLock().unlock();
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ log.error("Close FileReader occur error", e);
Review Comment:
unable to close FileReader
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] coveralls commented on pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
coveralls commented on PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#issuecomment-1192300839
[![Coverage Status](https://coveralls.io/builds/51077911/badge)](https://coveralls.io/builds/51077911)
Coverage increased (+0.06%) to 48.986% when pulling **ff98f78fe310711ea806e859e3d3ddfe6095b725 on Oliverwqcwrw:develop-persist-brokerConf-33** into **7f97d5f86be7624d38c7e4df6567089bc1a6532b on apache:develop**.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#discussion_r944326209
##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +221,35 @@ public void persist() {
}
}
+ public void persistBrokerConf(Properties from) {
+ FileReader reader = null;
+ try {
+ readWriteLock.readLock().lockInterruptibly();
+ String fileName = this.getStorePath();
+ File file = new File(fileName);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ Properties properties = new Properties();
+ reader = new FileReader(fileName);
+ properties.load(reader);
+ merge(from, properties);
+ final String str = MixAll.properties2String(properties);
+ MixAll.string2File(str, fileName);
+ } catch (Exception e) {
+ log.error("persist brokerConf error", e);
+ } finally {
+ readWriteLock.readLock().unlock();
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ log.error("Close FileReader occur error", e);
Review Comment:
Thanks for your review, I have solved it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] codecov-commenter commented on pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#issuecomment-1192300089
# [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4661?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#4661](https://codecov.io/gh/apache/rocketmq/pull/4661?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ff98f78) into [develop](https://codecov.io/gh/apache/rocketmq/commit/3a1d1a7e60f9049fb7e5048a9f08cdcdbf996601?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3a1d1a7) will **decrease** coverage by `0.16%`.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## develop #4661 +/- ##
=============================================
- Coverage 44.75% 44.58% -0.17%
+ Complexity 7526 7488 -38
=============================================
Files 975 975
Lines 67378 67399 +21
Branches 8892 8894 +2
=============================================
- Hits 30153 30053 -100
- Misses 33504 33615 +111
- Partials 3721 3731 +10
```
| [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/4661?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...java/org/apache/rocketmq/common/Configuration.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vQ29uZmlndXJhdGlvbi5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
| [...apache/rocketmq/broker/longpolling/PopRequest.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvbG9uZ3BvbGxpbmcvUG9wUmVxdWVzdC5qYXZh) | `31.03% <0.00%> (-13.80%)` | :arrow_down: |
| [.../apache/rocketmq/common/stats/MomentStatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtLmphdmE=) | `38.09% <0.00%> (-9.53%)` | :arrow_down: |
| [...q/namesrv/routeinfo/BrokerHousekeepingService.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bmFtZXNydi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbmFtZXNydi9yb3V0ZWluZm8vQnJva2VySG91c2VrZWVwaW5nU2VydmljZS5qYXZh) | `72.72% <0.00%> (-9.10%)` | :arrow_down: |
| [...ache/rocketmq/common/stats/MomentStatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvTW9tZW50U3RhdHNJdGVtU2V0LmphdmE=) | `39.13% <0.00%> (-8.70%)` | :arrow_down: |
| [...a/org/apache/rocketmq/logging/inner/SysLogger.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bG9nZ2luZy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbG9nZ2luZy9pbm5lci9TeXNMb2dnZXIuamF2YQ==) | `28.57% <0.00%> (-5.72%)` | :arrow_down: |
| [...etmq/namesrv/routeinfo/BatchUnRegisterService.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bmFtZXNydi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvbmFtZXNydi9yb3V0ZWluZm8vQmF0Y2hVblJlZ2lzdGVyU2VydmljZS5qYXZh) | `94.73% <0.00%> (-5.27%)` | :arrow_down: |
| [...va/org/apache/rocketmq/common/stats/StatsItem.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtLmphdmE=) | `50.00% <0.00%> (-5.00%)` | :arrow_down: |
| [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtU2V0LmphdmE=) | `41.79% <0.00%> (-4.48%)` | :arrow_down: |
| ... and [27 more](https://codecov.io/gh/apache/rocketmq/pull/4661/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [rocketmq] Oliverwqcwrw commented on a diff in pull request #4661: [ISSUE #4660] Fix updateBrokerConfig
Posted by GitBox <gi...@apache.org>.
Oliverwqcwrw commented on code in PR #4661:
URL: https://github.com/apache/rocketmq/pull/4661#discussion_r966489737
##########
common/src/main/java/org/apache/rocketmq/common/Configuration.java:
##########
@@ -219,6 +224,35 @@ public void persist() {
}
}
+ public void persistBrokerConf(Properties from) {
+ BufferedReader reader = null;
+ try {
+ readWriteLock.readLock().lockInterruptibly();
+ String fileName = this.getStorePath();
+ File file = new File(fileName);
+ if (!file.exists()) {
+ file.createNewFile();
+ }
+ Properties properties = new Properties();
+ reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
+ properties.load(reader);
+ merge(from, properties);
+ final String str = MixAll.properties2String(properties);
+ MixAll.string2File(str, fileName);
+ } catch (Exception e) {
+ log.error("persist brokerConf error", e);
Review Comment:
Thanks for your review,i will fix it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org