mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
[ISSUE #3459] Fix the problem of Put messages to commitLog always failure after encountering any exception (#3460)
This commit is contained in:
@@ -658,7 +658,6 @@ public class CommitLog {
|
||||
}
|
||||
if (null == mappedFile) {
|
||||
log.error("create mapped file1 error, topic: " + msg.getTopic() + " clientAddr: " + msg.getBornHostString());
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPEDFILE_FAILED, null));
|
||||
}
|
||||
|
||||
@@ -673,26 +672,22 @@ public class CommitLog {
|
||||
if (null == mappedFile) {
|
||||
// XXX: warn and notify me
|
||||
log.error("create mapped file2 error, topic: " + msg.getTopic() + " clientAddr: " + msg.getBornHostString());
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPEDFILE_FAILED, result));
|
||||
}
|
||||
result = mappedFile.appendMessage(msg, this.appendMessageCallback, putMessageContext);
|
||||
break;
|
||||
case MESSAGE_SIZE_EXCEEDED:
|
||||
case PROPERTIES_SIZE_EXCEEDED:
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, result));
|
||||
case UNKNOWN_ERROR:
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, result));
|
||||
default:
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, result));
|
||||
}
|
||||
|
||||
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
|
||||
beginTimeInLock = 0;
|
||||
} finally {
|
||||
beginTimeInLock = 0;
|
||||
putMessageLock.unlock();
|
||||
}
|
||||
|
||||
@@ -777,7 +772,6 @@ public class CommitLog {
|
||||
}
|
||||
if (null == mappedFile) {
|
||||
log.error("Create mapped file1 error, topic: {} clientAddr: {}", messageExtBatch.getTopic(), messageExtBatch.getBornHostString());
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPEDFILE_FAILED, null));
|
||||
}
|
||||
|
||||
@@ -792,24 +786,21 @@ public class CommitLog {
|
||||
if (null == mappedFile) {
|
||||
// XXX: warn and notify me
|
||||
log.error("Create mapped file2 error, topic: {} clientAddr: {}", messageExtBatch.getTopic(), messageExtBatch.getBornHostString());
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPEDFILE_FAILED, result));
|
||||
}
|
||||
result = mappedFile.appendMessages(messageExtBatch, this.appendMessageCallback, putMessageContext);
|
||||
break;
|
||||
case MESSAGE_SIZE_EXCEEDED:
|
||||
case PROPERTIES_SIZE_EXCEEDED:
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, result));
|
||||
case UNKNOWN_ERROR:
|
||||
default:
|
||||
beginTimeInLock = 0;
|
||||
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, result));
|
||||
}
|
||||
|
||||
elapsedTimeInLock = this.defaultMessageStore.getSystemClock().now() - beginLockTimestamp;
|
||||
beginTimeInLock = 0;
|
||||
} finally {
|
||||
beginTimeInLock = 0;
|
||||
putMessageLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user