ZingBug opened a new issue #2274:
URL: https://github.com/apache/rocketmq/issues/2274


   
在Broke同步刷盘执行的org.apache.rocketmq.store.CommitLog.GroupCommitService#doCommit函数中。
   
   `private void doCommit() {
               synchronized (this.requestsRead) {
                   if (!this.requestsRead.isEmpty()) {
                       for (GroupCommitRequest req : this.requestsRead) {
                           // There may be a message in the next file, so a 
maximum of
                           // two times the flush
                           boolean flushOK = false;
                           for (int i = 0; i < 2 && !flushOK; i++) {
                               flushOK = 
CommitLog.this.mappedFileQueue.getFlushedWhere() >= req.getNextOffset();
                               if (!flushOK) {
                                   CommitLog.this.mappedFileQueue.flush(0);
                               }
                           }
                           req.wakeupCustomer(flushOK ? PutMessageStatus.PUT_OK 
: PutMessageStatus.FLUSH_DISK_TIMEOUT);
                       }
                      /**  省略  **/
                   } else {
                       CommitLog.this.mappedFileQueue.flush(0);
                   }
               }
           }`
   
   其中因为消息有可能跨越两个MappedFile中存储,最多执行两次flush操作。
   
若有一个消息跨越了两个MappedFile,第一次flushOK为false,刷盘之后刷盘起始点还是小于下次刷盘点,故开始第二次刷盘。而第二次刷盘成功,但此时flushOK还是为false!这块有些不理解。
   这块不应该在循环结束后再加一个flushOK的判断吗?谢谢。


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to