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 2019/01/17 09:06:50 UTC

[GitHub] zhhlovely opened a new issue #697: doReput() 问题

zhhlovely opened a new issue #697: doReput() 问题
URL: https://github.com/apache/rocketmq/issues/697
 
 
   开启了transientStorePoolEable之后,commitLog刷写磁盘的任务应该是交由channel.force(),而这个channel中每次要刷写的缓存来源于transientStorePool创建分配的的writeBuffer。而不是mappedByteBuffer。
   也就说mappedByteBuffer中应该都是空的。从消息发送过来追加消息的过程中也能印证用的是writeBuffer先将消息追加到堆外内存中. 
   那么问题来了,我看了下doReput方法中的SelectMappedBufferResult result = DefaultMessageStore.this.commitLog.getData(reputFromOffset);
   getData方法在找寻这个result调用的方法最终会调到selectMappedBuffer(int pos)如图,这个方法里面用的是 ByteBuffer byteBuffer = this.mappedByteBuffer.slice();这个方法,这个成员变量mappedByteBuffer里面应该是没有相关的东西吧。我认为应该是用另外一个成员变量 writeBuffer才对吧。   针对transientStorePoolEable开启的情况下我认为有问题。`    public SelectMappedBufferResult selectMappedBuffer(int pos) {
           int readPosition = getReadPosition();
           if (pos < readPosition && pos >= 0) {
               if (this.hold()) {
                   ByteBuffer byteBuffer = this.mappedByteBuffer.slice();
                   byteBuffer.position(pos);
                   int size = readPosition - pos;
                   ByteBuffer byteBufferNew = byteBuffer.slice();
                   byteBufferNew.limit(size);
                   return new SelectMappedBufferResult(this.fileFromOffset + pos, byteBufferNew, size, this);
               }
           }
   
           return null;
       }`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services