Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect comment of method[TransactionalMessageBridge#addRemoveTagInTransactionOp()] may mislead others. #3687

Closed
XiaoyiPeng opened this issue Dec 31, 2021 · 0 comments
Milestone

Comments

@XiaoyiPeng
Copy link
Contributor

XiaoyiPeng commented Dec 31, 2021

BUG REPORT

  1. Please describe the issue you observed:

    When I read the following code about transaction messages, I noticed a problem with the method comments in class TransactionalMessageBridge.

 /**
     * Use this function while transaction msg is committed or rollback write a flag 'd' to operation queue for the
     * msg's offset
     *
     * @param messageExt Op message
     * @param messageQueue Op message queue
     * @return This method will always return true.
     */
    private boolean addRemoveTagInTransactionOp(MessageExt messageExt, MessageQueue messageQueue) {
        Message message = new Message(TransactionalMessageUtil.buildOpTopic(), TransactionalMessageUtil.REMOVETAG,
            String.valueOf(messageExt.getQueueOffset()).getBytes(TransactionalMessageUtil.charset));
        writeOp(message, messageQueue);
        return true;
    }

But in fact:

The param messageExt of the method is half message instead of Op message.
The param messageQueue of the method is half message queue instead of Op message queue.

To prove my point, I debugged the code,as shown below:

image

image

This may mislead others unfamiliar with the code's logic.
  1. Please tell us about your environment:

    Windows 10.

XiaoyiPeng added a commit to XiaoyiPeng/rocketmq that referenced this issue Dec 31, 2021
@XiaoyiPeng XiaoyiPeng changed the title Incorrect method[TransactionalMessageBridge#addRemoveTagInTransactionOp()] description may mislead others. Incorrect comment of method[TransactionalMessageBridge#addRemoveTagInTransactionOp()] may mislead others. Jan 1, 2022
francisoliverlee added a commit that referenced this issue Jan 6, 2022
…ransaction_msg

[ISSUE #3687] Fix wrong method comment about transaction message.
@duhenglucky duhenglucky added this to the 4.9.3 milestone Jan 17, 2022
devfat pushed a commit to devfat/rocketmq that referenced this issue Mar 3, 2022
GenerousMan pushed a commit to GenerousMan/rocketmq that referenced this issue Aug 12, 2022
GenerousMan pushed a commit to GenerousMan/rocketmq that referenced this issue Aug 12, 2022
…bout_transaction_msg

[ISSUE apache#3687] Fix wrong method comment about transaction message.
carlvine500 pushed a commit to carlvine500/rocketmq-apache that referenced this issue Sep 10, 2024
carlvine500 pushed a commit to carlvine500/rocketmq-apache that referenced this issue Sep 10, 2024
…bout_transaction_msg

[ISSUE apache#3687] Fix wrong method comment about transaction message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants