[
https://issues.apache.org/jira/browse/ROCKETMQ-265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16139672#comment-16139672
]
ASF GitHub Bot commented on ROCKETMQ-265:
-----------------------------------------
Github user lizhanhui commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/146#discussion_r134940614
--- Diff:
store/src/test/java/org/apache/rocketmq/store/ConsumeQueueTest.java ---
@@ -148,6 +148,52 @@ protected void deleteFile(File file) {
}
@Test
+ public void
test_putMessagePositionInfo_build_consume_queue_idempotent() {
+ DefaultMessageStore messageStore = null;
+ try {
+
+ messageStore = gen();
+
+ int totalMessages = 10;
+
+ for (int i = 0; i < totalMessages; i++) {
+ putMsg(messageStore);
+ }
+ Thread.sleep(5);
+
+ ConsumeQueue cq =
messageStore.getConsumeQueueTable().get(topic).get(queueId);
+ Method method =
cq.getClass().getDeclaredMethod("putMessagePositionInfo", long.class,
int.class, long.class, long.class);
+
+ assertThat(method).isNotNull();
+
+ method.setAccessible(true);
+
+ SelectMappedBufferResult result =
messageStore.getCommitLog().getData(0);
+ assertThat(result != null).isTrue();
+
+ DispatchRequest dispatchRequest =
messageStore.getCommitLog().checkMessageAndReturnSize(result.getByteBuffer(),
false, false);
+
+ assertThat(cq).isNotNull();
+
+ Object dispatchResult = method.invoke(cq,
dispatchRequest.getCommitLogOffset(),
+ dispatchRequest.getMsgSize(),
dispatchRequest.getTagsCode(), dispatchRequest.getConsumeQueueOffset());
+
+
assertThat(Boolean.parseBoolean(dispatchResult.toString())).isTrue();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertThat(Boolean.FALSE).isTrue();
--- End diff --
Should directly fail it.
> when os crash for some reasons, the broker consume queue’s data maybe repeat,
> consumer can’t pull the latest message, cause message lag
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: ROCKETMQ-265
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-265
> Project: Apache RocketMQ
> Issue Type: Bug
> Components: rocketmq-store
> Affects Versions: 4.0.0-incubating, 4.1.0-incubating
> Reporter: yubaofu
> Assignee: yukon
> Priority: Critical
> Labels: bug
> Fix For: 4.2.0-incubating
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> when os crash for some reasons, the broker consume queue’s data maybe repeat,
> consumer can’t pull the latest message, cause message lag
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)