You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "gaoyf (via GitHub)" <gi...@apache.org> on 2023/12/01 07:49:41 UTC
[PR] fix slave acting master bug [rocketmq]
gaoyf opened a new pull request, #7603:
URL: https://github.com/apache/rocketmq/pull/7603
<!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. -->
### Which Issue(s) This PR Fixes
<!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. -->
Fixes #7601
### Brief Description
<!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. -->
Fix #7601's exception and master use slave's TimerCheckPoint。
### How Did You Test This Change?
<!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. -->
Use #7601's reproduce step to test.
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "joeCarf (via GitHub)" <gi...@apache.org>.
joeCarf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1412724350
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
could you explain why comment these lines and how the second bug occurs?
--
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
Re: [PR] [ISSUE #7601] Fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1418237986
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
> Alternatively, we should add a messageAccessior.deepCopyProperties instead of using the same reference.
Your idea looks better, although I don't think commenting out this code will have any impact,but I modified the code as you suggested.
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
On the other hand,`MessageExtBrokerInner`‘s will reput to commitlog,it will contains property `MessageConst.PROPERTY_REAL_TOPIC` and `MessageConst.PROPERTY_REAL_TOPIC`,because the fllowing [code](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1127):
```
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
```
So I don't think commenting out these codes will affect the previous functionality
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#issuecomment-1835658936
## [Codecov](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: `7 lines` in your changes are missing coverage. Please review.
> Comparison is base [(`65faea2`)](https://app.codecov.io/gh/apache/rocketmq/commit/65faea22fd54fd9875f2ca9d3088b4dc46d31cce?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 43.19% compared to head [(`3509621`)](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 43.16%.
| [Files](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...apache/rocketmq/store/timer/TimerMessageStore.java](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL3RpbWVyL1RpbWVyTWVzc2FnZVN0b3JlLmphdmE=) | 0.00% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...apache/rocketmq/broker/slave/SlaveSynchronize.java](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc2xhdmUvU2xhdmVTeW5jaHJvbml6ZS5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## develop #7603 +/- ##
=============================================
- Coverage 43.19% 43.16% -0.03%
- Complexity 9782 9783 +1
=============================================
Files 1162 1162
Lines 84378 84381 +3
Branches 10955 10957 +2
=============================================
- Hits 36451 36427 -24
- Misses 43397 43434 +37
+ Partials 4530 4520 -10
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/rocketmq/pull/7603?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
On the other hand,**the original logic**: `MessageExtBrokerInner` will be reputed to commitlog,it will contains property `MessageConst.PROPERTY_REAL_TOPIC` and `MessageConst.PROPERTY_REAL_TOPIC`,because the fllowing [code](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1127):
```
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
```
That is to say, when retrieving this message, it must contains these two properties,So I don't think commenting out these codes will affect the original logic.
--
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
Re: [PR] [ISSUE #7601] Fix slave acting master bug [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1417232281
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
Alternatively, we should add a messageAccessior.deepCopyProperties instead of using the same reference.
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
On the other hand,**the original logic**: `MessageExtBrokerInner` will be reputed to commitlog,it will contains property `MessageConst.PROPERTY_REAL_TOPIC` and `MessageConst.PROPERTY_REAL_TOPIC`,because the fllowing [code](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1127):
```
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
```
That is to say, when retrieving this message, it must contains these two properties,So I don't think commenting out these codes will affect the previous functionality
--
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
Re: [PR] fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1413285830
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
I extracted [TimerDequeuePutMessageService](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1486)‘s some key codes, as follows:
```
while (!isStopped() && !doRes) {
try {
MessageExtBrokerInner msg = convert(msgExt, tr.getEnqueueTime(), needRoll(tr.getMagic()));
doRes = PUT_NEED_RETRY != doPut(msg, needRoll(tr.getMagic()));
} catch (Throwable t) {
LOGGER.info("Unknown error", t);
}
}
```
If method `doPut` throw exception, the logic try to execute method `convert` in a loop。
However, `MessageExtBrokerInner` and `MessageExt` hold the same Map of `properties`, [convertMessage](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1122) FYI, so the following code will return null:
```
msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC)
msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)
```
Because property `MessageConst.PROPERTY_REAL_QUEUE_ID` has been removed in the first execution.
**So canot remove these properties for the retry logic.**
On the other hand,`MessageExtBrokerInner` will be reputed to commitlog,it will contains property `MessageConst.PROPERTY_REAL_TOPIC` and `MessageConst.PROPERTY_REAL_TOPIC`,because the fllowing [code](https://github.com/apache/rocketmq/blob/develop/store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java#L1127):
```
msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));
```
So I don't think commenting out these codes will affect the previous functionality
--
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
Re: [PR] [ISSUE #7601] Fix slave acting master bug [rocketmq]
Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin merged PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603
--
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
Re: [PR] [ISSUE #7601] Fix slave acting master bug [rocketmq]
Posted by "gaoyf (via GitHub)" <gi...@apache.org>.
gaoyf commented on code in PR #7603:
URL: https://github.com/apache/rocketmq/pull/7603#discussion_r1418237986
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
> Alternatively, we should add a messageAccessior.deepCopyProperties instead of using the same reference.
Your idea looks better, although I don't think commenting out this code will have any impact,so I modified the code as you suggested.
##########
store/src/main/java/org/apache/rocketmq/store/timer/TimerMessageStore.java:
##########
@@ -1140,8 +1146,8 @@ public MessageExtBrokerInner convertMessage(MessageExt msgExt, boolean needRoll)
} else {
msgInner.setTopic(msgInner.getProperty(MessageConst.PROPERTY_REAL_TOPIC));
msgInner.setQueueId(Integer.parseInt(msgInner.getProperty(MessageConst.PROPERTY_REAL_QUEUE_ID)));
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
- MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_QUEUE_ID);
+ // MessageAccessor.clearProperty(msgInner, MessageConst.PROPERTY_REAL_TOPIC);
Review Comment:
> Alternatively, we should add a messageAccessior.deepCopyProperties instead of using the same reference.
Your idea looks better, although I don't think commenting out this code will have any impact,so I modified the code as you suggested.
--
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