junrao commented on code in PR #23316:
URL: https://github.com/apache/kafka/pull/23316#discussion_r3897561523
##########
storage/src/main/java/org/apache/kafka/storage/internals/log/AbstractIndex.java:
##########
@@ -294,8 +288,9 @@ public int sizeInBytes() {
}
public void close() throws IOException {
- flush(); // Ensure the index content is flushed to disk as
LogSegment.close may append an entry
- trimToValidSize(true);
+ flush(false); // Ensure the index content is flushed to disk as
LogSegment.close may append an entry
Review Comment:
Hmm, mmap maps page cache into user memory space. All writes to mmap are
reflected in page cache. unmapping destroys the reference in user memory, but
doesn't destroy page cache. So, remapping should preserve the data in page
cache without flushing.
If that assumption is not true, we have problems elsewhere. When we roll a
segment, we call trimToValidSize() on a rolled segment without flushing too.
Flushing only happens later in the background job.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]