You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2022/07/04 03:12:39 UTC
[rocketmq] branch develop updated: [ISSUE #4531] fix unreachable statement, redundant code and code style (#4532)
This is an automated email from the ASF dual-hosted git repository.
duhengforever pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 06d954f86 [ISSUE #4531] fix unreachable statement, redundant code and code style (#4532)
06d954f86 is described below
commit 06d954f86fad4ad95927ed5435c53171a4ab2bfb
Author: Panson <Pa...@163.com>
AuthorDate: Mon Jul 4 11:12:32 2022 +0800
[ISSUE #4531] fix unreachable statement, redundant code and code style (#4532)
* [ISSUE #4513] elegant equals using apache-commons
* [ISSUE #4531] fix unreachable statement, redundant code and code style
---
.../apache/rocketmq/store/DefaultMessageStore.java | 36 +++++-----------------
1 file changed, 8 insertions(+), 28 deletions(-)
diff --git a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
index 30a8d1a40..8cbe690ea 100644
--- a/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
+++ b/store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
@@ -990,33 +990,17 @@ public class DefaultMessageStore implements MessageStore {
long offset = queryOffsetResult.getPhyOffsets().get(m);
try {
-
- boolean match = true;
MessageExt msg = this.lookMessageByOffset(offset);
if (0 == m) {
lastQueryMsgTime = msg.getStoreTimestamp();
}
-// String[] keyArray = msg.getKeys().split(MessageConst.KEY_SEPARATOR);
-// if (topic.equals(msg.getTopic())) {
-// for (String k : keyArray) {
-// if (k.equals(key)) {
-// match = true;
-// break;
-// }
-// }
-// }
-
- if (match) {
- SelectMappedBufferResult result = this.commitLog.getData(offset, false);
- if (result != null) {
- int size = result.getByteBuffer().getInt(0);
- result.getByteBuffer().limit(size);
- result.setSize(size);
- queryMessageResult.addMessage(result);
- }
- } else {
- log.warn("queryMessage hash duplicate, {} {}", topic, key);
+ SelectMappedBufferResult result = this.commitLog.getData(offset, false);
+ if (result != null) {
+ int size = result.getByteBuffer().getInt(0);
+ result.getByteBuffer().limit(size);
+ result.setSize(size);
+ queryMessageResult.addMessage(result);
}
} catch (Exception e) {
log.error("queryMessage exception", e);
@@ -1387,12 +1371,8 @@ public class DefaultMessageStore implements MessageStore {
private void checkSelf() {
this.commitLog.checkSelf();
- Iterator<Entry<String, ConcurrentMap<Integer, ConsumeQueue>>> it = this.consumeQueueTable.entrySet().iterator();
- while (it.hasNext()) {
- Entry<String, ConcurrentMap<Integer, ConsumeQueue>> next = it.next();
- Iterator<Entry<Integer, ConsumeQueue>> itNext = next.getValue().entrySet().iterator();
- while (itNext.hasNext()) {
- Entry<Integer, ConsumeQueue> cq = itNext.next();
+ for (Entry<String, ConcurrentMap<Integer, ConsumeQueue>> next : this.consumeQueueTable.entrySet()) {
+ for (Entry<Integer, ConsumeQueue> cq : next.getValue().entrySet()) {
cq.getValue().checkSelf();
}
}