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/08/29 13:05:48 UTC

[GitHub] [rocketmq] lizhanhui opened a new pull request, #4927: [ISSUE 4926]Fix FileWatchServiceTest

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   Fix https://github.com/apache/rocketmq/issues/4926
   
   ## 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] lizhanhui commented on pull request #4927: [ISSUE 4926]Fix FileWatchServiceTest

Posted by GitBox <gi...@apache.org>.
lizhanhui commented on PR #4927:
URL: https://github.com/apache/rocketmq/pull/4927#issuecomment-1231180303

   ![image](https://user-images.githubusercontent.com/641819/187360803-34229876-03d9-4e91-a73b-e560a4c25f1c.png)
   Now the test case is stable enough to pass 1024 concurrent runs.


-- 
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 #4927: [ISSUE 4926]Fix FileWatchServiceTest

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/4927?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 [#4927](https://codecov.io/gh/apache/rocketmq/pull/4927?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (909be96) into [develop](https://codecov.io/gh/apache/rocketmq/commit/62b383ae57be0005486cd86307615955b11f0e0f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (62b383a) will **decrease** coverage by `0.00%`.
   > The diff coverage is `25.00%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #4927      +/-   ##
   =============================================
   - Coverage      43.09%   43.08%   -0.01%     
   + Complexity      7677     7670       -7     
   =============================================
     Files            994      995       +1     
     Lines          68939    68956      +17     
     Branches        9132     9133       +1     
   =============================================
   + Hits           29710    29711       +1     
   - Misses         35494    35506      +12     
   - Partials        3735     3739       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/4927?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...e/rocketmq/common/LifecycleAwareServiceThread.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vTGlmZWN5Y2xlQXdhcmVTZXJ2aWNlVGhyZWFkLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [.../org/apache/rocketmq/srvutil/FileWatchService.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-c3J2dXRpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvc3J2dXRpbC9GaWxlV2F0Y2hTZXJ2aWNlLmphdmE=) | `81.81% <83.33%> (ø)` | |
   | [...etmq/namesrv/routeinfo/BatchUnRegisterService.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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: |
   | [.../apache/rocketmq/controller/ControllerManager.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-Y29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvY29udHJvbGxlci9Db250cm9sbGVyTWFuYWdlci5qYXZh) | `73.11% <0.00%> (-2.16%)` | :arrow_down: |
   | [...mq/client/impl/consumer/RebalanceLitePullImpl.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9SZWJhbGFuY2VMaXRlUHVsbEltcGwuamF2YQ==) | `69.86% <0.00%> (-1.37%)` | :arrow_down: |
   | [...cketmq/broker/schedule/ScheduleMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc2NoZWR1bGUvU2NoZWR1bGVNZXNzYWdlU2VydmljZS5qYXZh) | `55.26% <0.00%> (-1.18%)` | :arrow_down: |
   | [...ava/org/apache/rocketmq/store/index/IndexFile.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2luZGV4L0luZGV4RmlsZS5qYXZh) | `73.68% <0.00%> (-0.88%)` | :arrow_down: |
   | [...a/org/apache/rocketmq/store/StoreStatsService.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL1N0b3JlU3RhdHNTZXJ2aWNlLmphdmE=) | `39.22% <0.00%> (-0.56%)` | :arrow_down: |
   | [...he/rocketmq/broker/controller/ReplicasManager.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvY29udHJvbGxlci9SZXBsaWNhc01hbmFnZXIuamF2YQ==) | `43.09% <0.00%> (-0.55%)` | :arrow_down: |
   | [...cketmq/broker/processor/PopBufferMergeService.java](https://codecov.io/gh/apache/rocketmq/pull/4927/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BvcEJ1ZmZlck1lcmdlU2VydmljZS5qYXZh) | `37.44% <0.00%> (-0.24%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/rocketmq/pull/4927/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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #4927: [ISSUE 4926]Fix FileWatchServiceTest

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


##########
common/src/main/java/org/apache/rocketmq/common/LifecycleAwareServiceThread.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.common;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public abstract class LifecycleAwareServiceThread extends ServiceThread {
+
+    private final AtomicBoolean started = new AtomicBoolean(false);
+
+    @Override
+    public void run() {
+        started.set(true);
+        synchronized (started) {
+            started.notifyAll();
+        }
+
+        run0();
+    }
+
+    public abstract void run0();
+
+    public void awaitStarted(long timeout) throws InterruptedException {
+        synchronized (started) {
+            if (started.get()) {
+                return;
+            }
+            started.wait(timeout);

Review Comment:
   OK



-- 
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] lizhanhui merged pull request #4927: [ISSUE 4926]Fix FileWatchServiceTest

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


-- 
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] aaron-ai commented on a diff in pull request #4927: [ISSUE 4926]Fix FileWatchServiceTest

Posted by GitBox <gi...@apache.org>.
aaron-ai commented on code in PR #4927:
URL: https://github.com/apache/rocketmq/pull/4927#discussion_r958026401


##########
common/src/main/java/org/apache/rocketmq/common/LifecycleAwareServiceThread.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.common;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public abstract class LifecycleAwareServiceThread extends ServiceThread {
+
+    private final AtomicBoolean started = new AtomicBoolean(false);
+
+    @Override
+    public void run() {
+        started.set(true);
+        synchronized (started) {
+            started.notifyAll();
+        }
+
+        run0();
+    }
+
+    public abstract void run0();
+
+    public void awaitStarted(long timeout) throws InterruptedException {
+        synchronized (started) {
+            if (started.get()) {
+                return;
+            }
+            started.wait(timeout);

Review Comment:
   It seems that the wait here could not ensure that the service is started successfully.
   
   On the other hand, how could we avoid spurious wakeup?



##########
common/src/main/java/org/apache/rocketmq/common/LifecycleAwareServiceThread.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.common;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public abstract class LifecycleAwareServiceThread extends ServiceThread {
+
+    private final AtomicBoolean started = new AtomicBoolean(false);
+
+    @Override
+    public void run() {
+        started.set(true);
+        synchronized (started) {
+            started.notifyAll();
+        }
+
+        run0();
+    }
+
+    public abstract void run0();
+
+    public void awaitStarted(long timeout) throws InterruptedException {
+        synchronized (started) {
+            if (started.get()) {
+                return;
+            }
+            started.wait(timeout);

Review Comment:
   It seems that the wait here could not ensure that the service is started successfully. On the other hand, how could we avoid spurious wakeup?



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