美文网首页
RocketMq-TransientStorePool

RocketMq-TransientStorePool

作者: 飞哈飞 | 来源:发表于2020-11-09 22:36 被阅读0次

是否应用判断条件,在主节点上异步刷盘和配置为true同时满足

  /**
     * Enable transient commitLog store pool only if transientStorePoolEnable is true and the FlushDiskType is
     * ASYNC_FLUSH
     *
     * @return <tt>true</tt> or <tt>false</tt>
     */
    public boolean isTransientStorePoolEnable() {
        return transientStorePoolEnable && FlushDiskType.ASYNC_FLUSH == getFlushDiskType()
            && BrokerRole.SLAVE != getBrokerRole();
    }

作用为在初始化MappedFile的时候进行ByteBuffer的分配回收

 public void returnBuffer(ByteBuffer byteBuffer) {
        byteBuffer.position(0);
        byteBuffer.limit(fileSize);
        this.availableBuffers.offerFirst(byteBuffer);
    }

    public ByteBuffer borrowBuffer() {
        ByteBuffer buffer = availableBuffers.pollFirst();
        if (availableBuffers.size() < poolSize * 0.4) {
            log.warn("TransientStorePool only remain {} sheets.", availableBuffers.size());
        }
        return buffer;
    }

相关文章

  • RocketMq-TransientStorePool

    是否应用判断条件,在主节点上异步刷盘和配置为true同时满足 作用为在初始化MappedFile的时候进行Byte...

网友评论

      本文标题:RocketMq-TransientStorePool

      本文链接:https://www.haomeiwen.com/subject/koecbktx.html