Skip to content

fix and optimize methods for sending and storing batch message #2931

Description

@sunxi92

1.refactor public static byte[] encodeMessages(List messages) in MessageDecoder.java to reduce the number of copies of data

2.BUG REPORT
(1). Please describe the issue you observed:
The method public static boolean validateTopic(String topic, RemotingCommand response) in TopicValidator.java is used to check the topic, and when topic does not comply with regulations, the response's code will be set ResponseCode.SYSTEM_ERROR. I think it's better for user that the response'code wiil be set ResponseCode.MESSAGE_ILLEGAL

  • What did you do (The steps to reproduce)?
  • What did you expect to see?
  • What did you see instead?
    (2). Please tell us about your environment:
    (3). Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):

3.when broker process the request RequestCode.SEND_BATCH_MESSAGE, the method private CompletableFuture asyncSendBatchMessage(ChannelHandlerContext ctx, RemotingCommand request, SendMessageContext mqtraceContext, SendMessageRequestHeader requestHeader) will be called, and the topic is checked repeatedly in this method.
image
In the method preSend, msgCheck(final ChannelHandlerContext ctx,final SendMessageRequestHeader requestHeader, final RemotingCommand response) is called, and it contains the logic of topic checking

4.when broker store batch message,I think it is better to distinguish between two exceptions in the method public ByteBuffer encode(final MessageExtBatch messageExtBatch) of Commitlog.java
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions