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 2022/05/16 07:33:50 UTC

[GitHub] [rocketmq] dongeforever commented on a diff in pull request #4306: [ISSUE #2706] FIX SEND_OK will still be returned when the storage is abnormal ,which may cause message loss

dongeforever commented on code in PR #4306:
URL: https://github.com/apache/rocketmq/pull/4306#discussion_r873407942


##########
store/src/main/java/org/apache/rocketmq/store/MappedFile.java:
##########
@@ -295,13 +295,15 @@ public int flush(final int flushLeastPages) {
 
                 try {
                     //We only append data to fileChannel or mappedByteBuffer, never both.
+                    this.flushError = false;
                     if (writeBuffer != null || this.fileChannel.position() != 0) {
                         this.fileChannel.force(false);
                     } else {
                         this.mappedByteBuffer.force();
                     }
                 } catch (Throwable e) {
                     log.error("Error occurred when force data to disk.", e);
+                    this.flushError = true;

Review Comment:
   Flush error rarely happens. And the client does not need to know the flush error.
   How about just making it simple, just do not change the flushed position when encountering some unexpected error.
   
   Do not introduce a new response code, and do not need to change other files.



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

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org