Skip to content

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

@XiaoyiPeng

Description

@XiaoyiPeng

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions