You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/11/11 13:41:27 UTC

[GitHub] [rocketmq] mxsm opened a new pull request, #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

mxsm opened a new pull request, #5514:
URL: https://github.com/apache/rocketmq/pull/5514

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   fix #5511 
   
   ## Brief changelog
   - Fix Proxy start up throw NullPointerException
   
   ## 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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] lizhanhui merged pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
lizhanhui merged PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514


-- 
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] codecov-commenter commented on pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#issuecomment-1312652932

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5514?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 [#5514](https://codecov.io/gh/apache/rocketmq/pull/5514?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5aa7a90) into [develop](https://codecov.io/gh/apache/rocketmq/commit/a5b40fba10cc941e509c4bf20ec4ae95bf47bc3a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a5b40fb) will **decrease** coverage by `0.17%`.
   > The diff coverage is `40.15%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5514      +/-   ##
   =============================================
   - Coverage      42.92%   42.75%   -0.18%     
   + Complexity      8069     8028      -41     
   =============================================
     Files           1029     1029              
     Lines          72662    72673      +11     
     Branches        9604     9605       +1     
   =============================================
   - Hits           31191    31070     -121     
   - Misses         37527    37668     +141     
   + Partials        3944     3935       -9     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5514?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ava/org/apache/rocketmq/acl/common/Permission.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YWNsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9hY2wvY29tbW9uL1Blcm1pc3Npb24uamF2YQ==) | `92.68% <ø> (ø)` | |
   | [...apache/rocketmq/acl/plain/PlainAccessResource.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YWNsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9hY2wvcGxhaW4vUGxhaW5BY2Nlc3NSZXNvdXJjZS5qYXZh) | `57.57% <ø> (ø)` | |
   | [...pache/rocketmq/acl/plain/PlainAccessValidator.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YWNsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9hY2wvcGxhaW4vUGxhaW5BY2Nlc3NWYWxpZGF0b3IuamF2YQ==) | `78.57% <ø> (ø)` | |
   | [...che/rocketmq/acl/plain/PlainPermissionManager.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YWNsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9hY2wvcGxhaW4vUGxhaW5QZXJtaXNzaW9uTWFuYWdlci5qYXZh) | `78.76% <ø> (ø)` | |
   | [...a/org/apache/rocketmq/broker/BrokerController.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvQnJva2VyQ29udHJvbGxlci5qYXZh) | `43.55% <ø> (ø)` | |
   | [...apache/rocketmq/broker/BrokerPreOnlineService.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvQnJva2VyUHJlT25saW5lU2VydmljZS5qYXZh) | `0.00% <ø> (ø)` | |
   | [...java/org/apache/rocketmq/broker/BrokerStartup.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvQnJva2VyU3RhcnR1cC5qYXZh) | `7.74% <0.00%> (ø)` | |
   | [...ache/rocketmq/broker/client/ConsumerGroupInfo.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY2xpZW50L0NvbnN1bWVyR3JvdXBJbmZvLmphdmE=) | `68.46% <ø> (ø)` | |
   | [...roker/client/DefaultConsumerIdsChangeListener.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY2xpZW50L0RlZmF1bHRDb25zdW1lcklkc0NoYW5nZUxpc3RlbmVyLmphdmE=) | `40.74% <ø> (ø)` | |
   | [...ache/rocketmq/broker/client/net/Broker2Client.java](https://codecov.io/gh/apache/rocketmq/pull/5514/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY2xpZW50L25ldC9Ccm9rZXIyQ2xpZW50LmphdmE=) | `6.83% <ø> (ø)` | |
   | ... and [635 more](https://codecov.io/gh/apache/rocketmq/pull/5514/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) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] ShadowySpirits commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
ShadowySpirits commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1020878971


##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (brokerMetricsManager.getBrokerConfig().getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   The brokerMetricsManager could be null, use ProxyConfig#getMetricsExporterType instead.



-- 
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] ShadowySpirits commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
ShadowySpirits commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1020885830


##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   We should skip init process when metrics exporter is disable and not the other way around.



##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   This check should also be added in ProxyMetricsManager#start.



-- 
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] mxsm commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1021109647


##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   @lizhimins thanks for you modify this error



-- 
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] mxsm commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1020890473


##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   > This check should also be added in ProxyMetricsManager#start.
   ProxyMetricsManager#start has existed
   



##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   > This check should also be added in ProxyMetricsManager#start.
   
   ProxyMetricsManager#start has existed
   



-- 
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] ShadowySpirits commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
ShadowySpirits commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1020851513


##########
proxy/src/main/java/org/apache/rocketmq/proxy/ProxyStartup.java:
##########
@@ -173,7 +174,9 @@ protected static MessagingProcessor createMessagingProcessor() {
             PROXY_START_AND_SHUTDOWN.appendStartAndShutdown(proxyMetricsManager);
         } else if (ProxyMode.isLocalMode(proxyModeStr)) {
             BrokerController brokerController = createBrokerController();
-            ProxyMetricsManager.initLocalMode(brokerController.getBrokerMetricsManager(), ConfigurationManager.getProxyConfig());
+            if (brokerController.getBrokerConfig().getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   It seems to me that checking this config in ProxyMetricsManager#initLocalMode and ProxyMetricsManager#start should be better.



-- 
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] mxsm commented on a diff in pull request #5514: [ISSUE #5511]Fix Proxy start up throw NullPointerException

Posted by GitBox <gi...@apache.org>.
mxsm commented on code in PR #5514:
URL: https://github.com/apache/rocketmq/pull/5514#discussion_r1021029542


##########
proxy/src/main/java/org/apache/rocketmq/proxy/metrics/ProxyMetricsManager.java:
##########
@@ -69,6 +69,9 @@ public class ProxyMetricsManager implements StartAndShutdown {
     public static ObservableLongGauge proxyUp = null;
 
     public static void initLocalMode(BrokerMetricsManager brokerMetricsManager, ProxyConfig proxyConfig) {
+        if (proxyConfig.getMetricsExporterType() != BrokerConfig.MetricsExporterType.DISABLE) {

Review Comment:
   I will fix some problems and submit again.



-- 
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