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/10/10 06:50:06 UTC

[GitHub] [rocketmq] ltamber opened a new pull request, #5260: [ISSUE 3799] add compaction delete policy

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   fix #3799 base on release-5.0.0
   
   ## Brief changelog
   
   add compaction delete policy
   
   ## 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 merged pull request #5260: [ISSUE 3799] add compaction delete policy

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


-- 
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 #5260: [ISSUE 3799] add compaction delete policy

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


##########
common/src/main/java/org/apache/rocketmq/common/attribute/DeletePolicy.java:
##########
@@ -0,0 +1,22 @@
+/*
+ * 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.attribute;
+
+public enum DeletePolicy {
+    NORMAL,

Review Comment:
   STANDARD may be more appropriate than NORMAL.



-- 
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 #5260: [ISSUE 3799] add compaction delete policy

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


##########
.gitignore:
##########
@@ -13,6 +13,7 @@ devenv
 .DS_Store
 localbin
 nohup.out
+docker/

Review Comment:
   If this ignore entry applies to your local development only, best to add it to your user profile .gitignore



-- 
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 #5260: [ISSUE 3799] add compaction delete policy

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

   @ltamber CI failed.


-- 
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 #5260: [ISSUE 3799] add compaction delete policy

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

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5260?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 [#5260](https://codecov.io/gh/apache/rocketmq/pull/5260?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (83d5d2c) into [develop](https://codecov.io/gh/apache/rocketmq/commit/32c7d37f488ef3ba78e2318e1535717d5efb1f7b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (32c7d37) will **decrease** coverage by `0.08%`.
   > The diff coverage is `20.83%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5260      +/-   ##
   =============================================
   - Coverage      43.20%   43.12%   -0.09%     
   + Complexity      7810     7790      -20     
   =============================================
     Files            998     1000       +2     
     Lines          69454    69477      +23     
     Branches        9171     9175       +4     
   =============================================
   - Hits           30010    29961      -49     
   - Misses         35683    35743      +60     
   - Partials        3761     3773      +12     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...apache/rocketmq/common/attribute/DeletePolicy.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vYXR0cmlidXRlL0RlbGV0ZVBvbGljeS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...pache/rocketmq/common/utils/DeletePolicyUtils.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vdXRpbHMvRGVsZXRlUG9saWN5VXRpbHMuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ocketmq/broker/processor/SendMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1NlbmRNZXNzYWdlUHJvY2Vzc29yLmphdmE=) | `44.15% <16.66%> (-0.48%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/common/TopicAttributes.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vVG9waWNBdHRyaWJ1dGVzLmphdmE=) | `92.30% <100.00%> (+2.30%)` | :arrow_up: |
   | [...va/org/apache/rocketmq/store/FlushDiskWatcher.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL0ZsdXNoRGlza1dhdGNoZXIuamF2YQ==) | `81.25% <0.00%> (-9.38%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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%> (-8.96%)` | :arrow_down: |
   | [...ketmq/common/protocol/body/ConsumerConnection.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vcHJvdG9jb2wvYm9keS9Db25zdW1lckNvbm5lY3Rpb24uamF2YQ==) | `95.83% <0.00%> (-4.17%)` | :arrow_down: |
   | [...ketmq/client/impl/consumer/PullMessageService.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9QdWxsTWVzc2FnZVNlcnZpY2UuamF2YQ==) | `49.23% <0.00%> (-3.08%)` | :arrow_down: |
   | [...lient/impl/consumer/DefaultMQPushConsumerImpl.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9jb25zdW1lci9EZWZhdWx0TVFQdXNoQ29uc3VtZXJJbXBsLmphdmE=) | `33.20% <0.00%> (-2.21%)` | :arrow_down: |
   | [.../org/apache/rocketmq/store/ha/DefaultHAClient.java](https://codecov.io/gh/apache/rocketmq/pull/5260/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-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL0RlZmF1bHRIQUNsaWVudC5qYXZh) | `59.48% <0.00%> (-2.06%)` | :arrow_down: |
   | ... and [17 more](https://codecov.io/gh/apache/rocketmq/pull/5260/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 #5260: [ISSUE 3799] add compaction delete policy

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


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java:
##########
@@ -245,6 +249,16 @@ public RemotingCommand sendMessage(final ChannelHandlerContext ctx,
         }
 
         MessageAccessor.setProperties(msgInner, oriProps);
+
+        DeletePolicy deletePolicy = DeletePolicyUtils.getDeletePolicy(Optional.of(topicConfig));
+        if (Objects.equals(deletePolicy, DeletePolicy.COMPACTION)) {
+            if (StringUtils.isBlank(msgInner.getKeys())) {
+                response.setCode(ResponseCode.MESSAGE_ILLEGAL);
+                response.setRemark("the message don't have message key");

Review Comment:
   ```suggestion
                   response.setRemark("Required message key is missing");
   ```



-- 
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 #5260: [ISSUE 3799] add compaction delete policy

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


##########
common/src/main/java/org/apache/rocketmq/common/attribute/DeletePolicy.java:
##########
@@ -0,0 +1,22 @@
+/*
+ * 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.attribute;
+
+public enum DeletePolicy {

Review Comment:
   It looks weird DeletePolicy has variants DELETE and COMPACTION, how about renaming DeletePolicy to ReclaimPolicy?



-- 
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] ltamber commented on pull request #5260: [ISSUE 3799] add compaction delete policy

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

   @lizhanhui @ni-ze PTAL


-- 
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] ltamber commented on a diff in pull request #5260: [ISSUE 3799] add compaction delete policy

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


##########
common/src/main/java/org/apache/rocketmq/common/attribute/DeletePolicy.java:
##########
@@ -0,0 +1,22 @@
+/*
+ * 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.attribute;
+
+public enum DeletePolicy {

Review Comment:
   maybe `CleanupPolicy` is more readable 



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