Optimize FileChannelJournalSegmentWriter.truncate() 65/110565/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Mar 2024 13:09:45 +0000 (14:09 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 11 Mar 2024 12:51:11 +0000 (12:51 +0000)
commit4a74d808e33fef2e002af1acc996b7a2ba228757
tree4037c02468bd45dc7d8ebc9c7213e9a88ee630ee
parentb2106c7c4fbc91f6cdfd8bf4371b723db6fdae2f
Optimize FileChannelJournalSegmentWriter.truncate()

FileChannelJournalSegmentWriter.truncate() is inefficient in that it
zeroes-out its memory buffer and then writes it completely out.

This patch aligns it with what MappedJournalSegmentWriter does, which is
just zeroing out the entry header -- reducing both IO and CPU overheads.

JIRA: CONTROLLER-2095
Change-Id: I487157e78524cc9b00c9efff2064dbe892638ae4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
atomix-storage/src/main/java/io/atomix/storage/journal/FileChannelJournalSegmentWriter.java