daigoopautoy commented on issue #7641:
URL: https://github.com/apache/rocketmq/issues/7641#issuecomment-1855267379
```java
public MessageExtEncoder(final int maxMessageBodySize) {
ByteBufAllocator alloc = UnpooledByteBufAllocator.DEFAULT;
//Reserve 64kb for encoding buffer outside body
int maxMessageSize = Integer.MAX_VALUE - maxMessageBodySize >= 64 *
1024 ?
maxMessageBodySize + 64 * 1024 : Integer.MAX_VALUE;
byteBuf = alloc.directBuffer(maxMessageSize);
this.maxMessageBodySize = maxMessageBodySize;
this.maxMessageSize = maxMessageSize;
}
```
my config's maxMessageSize=64kb, then maxMessageBodySize=64kb and
maxMessageSize=128kb
one delay message bodySize=63kb, properties=3kb, it can write in commitLog,
because 63<64, 63+3+other len<128
```java
bufferLocal = new ThreadLocal<ByteBuffer>() {
@Override
protected ByteBuffer initialValue() {
// 64kb+100
return
ByteBuffer.allocateDirect(storeConfig.getMaxMessageSize() + 100);
}
};
private MessageExt getMessageByCommitOffset(long offsetPy, int sizePy) {
for (int i = 0; i < 3; i++) {
MessageExt msgExt = null;
bufferLocal.get().position(0);
// throw IllegalArgumentException because sizePy>capacity
bufferLocal.get().limit(sizePy);
boolean res = messageStore.getData(offsetPy, sizePy,
bufferLocal.get());
if (res) {
bufferLocal.get().flip();
msgExt = MessageDecoder.decode(bufferLocal.get(), true,
false, false);
}
if (null == msgExt) {
LOGGER.warn("Fail to read msg from commitLog offsetPy:{}
sizePy:{}", offsetPy, sizePy);
} else {
return msgExt;
}
}
return null;
}
```
in
`org.apache.rocketmq.store.timer.TimerMessageStore#getMessageByCommitOffset` ,
this delay message's sizepy=63+3+other len>bufferLocal.capacity=64kb+100, throw
IllegalArgumentException, cause currQueueOffset cannot update.
I don't know if my opinion is right, wait for your reply, thx. @RongtongJin
@GenerousMan
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]