Skip to content

Commit

Permalink
enableTransientPool and sync_flush will cause flush_time_out
Browse files Browse the repository at this point in the history
  • Loading branch information
fujian-zfj committed Nov 1, 2023
1 parent 49c3dc0 commit f6984cc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions store/src/main/java/org/apache/rocketmq/store/CommitLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1634,12 +1634,18 @@ private void swapRequests() {
private void doCommit() {
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 = CommitLog.this.mappedFileQueue.getFlushedWhere() >= req.getNextOffset();
for (int i = 0; i < 2 && !flushOK; i++) {
boolean flushOK = false;
for (int i = 0; i < 1000; i++) {
CommitLog.this.mappedFileQueue.flush(0);
flushOK = CommitLog.this.mappedFileQueue.getFlushedWhere() >= req.getNextOffset();
if (flushOK) {
break;
} else {
try {
Thread.sleep(1);
} catch (InterruptedException ignored) {
}
}
}

req.wakeupCustomer(flushOK ? PutMessageStatus.PUT_OK : PutMessageStatus.FLUSH_DISK_TIMEOUT);
Expand Down Expand Up @@ -1846,7 +1852,7 @@ public AppendMessageResult doAppend(final long fileFromOffset, final ByteBuffer
// Record ConsumeQueue information
Long queueOffset = msgInner.getQueueOffset();

// this msg maybe a inner-batch msg.
// this msg maybe an inner-batch msg.
short messageNum = getMessageNum(msgInner);

// Transaction messages that require special handling
Expand Down

0 comments on commit f6984cc

Please sign in to comment.