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/06/28 02:33:43 UTC

[GitHub] [rocketmq] liuzongliang0202 commented on a diff in pull request #4518: [ISSUE #4463] fix broker is normal exit, but indexFile not flush disk

liuzongliang0202 commented on code in PR #4518:
URL: https://github.com/apache/rocketmq/pull/4518#discussion_r907972485


##########
store/src/main/java/org/apache/rocketmq/store/index/IndexService.java:
##########
@@ -366,7 +366,18 @@ public void start() {
 
     }
 
+    // fix issue 4463
     public void shutdown() {
-
+        if (!indexFileList.isEmpty()) {
+            final IndexFile indexFile = indexFileList.get(indexFileList.size() - 1);
+            long indexMsgTimestamp = 0;
+            if (indexFile.isWriteFull()) {
+                indexMsgTimestamp = indexFile.getEndTimestamp();
+            }
+            indexFile.flush();
+            if (indexMsgTimestamp > 0) {
+                this.defaultMessageStore.getStoreCheckpoint().setIndexMsgTimestamp(indexMsgTimestamp);
+            }

Review Comment:
    I don't want to call getstorecheckpoint().flush() twice during shutdown .This code can be optimized, but the flush method should be modified



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