You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/21 13:58:28 UTC

[GitHub] [rocketmq-externals] ferrirW commented on issue #66: rocketmq-cpp/producer/tryToCompressMessage没有判断msg是否被压缩过

ferrirW commented on issue #66:
URL: https://github.com/apache/rocketmq-externals/issues/66#issuecomment-1105247718

   > 看了下bugfix的代码[apache/rocketmq#294](https://github.com/apache/rocketmq/pull/294),不太理解DefaultMQProducerImpl.sendKernelImpl在异步发送逻辑单独resetbody的原因,在大的try,catch,finally中不是已经resetbody,在异步发送的callback回调里再次使用改msg,应该不会是压缩后的吧
   
   https://github.com/apache/rocketmq/pull/294 解决的问题恰好与 @kelly6 的问题相反
   
   异步发送时 finally 重新赋值的时机并不确定,有很大概率是在第一次发送结束前就完成了 finally 中的赋值,因此在内部重试前 msg.body 大概率已经被重新赋值过,而 onExceptionImpl 中的重试逻辑 MQClientAPIImpl.sendMessageAsync 不会再对数据进行压缩,简言之,在异步发送的情况下,如果调用 onExceptionImpl 内部的重试,有很大概率发送的是无压缩的数据
   
   注释也阐明了这一点
   //If msg body was compressed, msgbody should be reset using prevBody.
   //Clone new message using commpressed message body and recover origin massage.
   
   
   
   
   
   
   
   


-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org