junrao commented on code in PR #14242:
URL: https://github.com/apache/kafka/pull/14242#discussion_r1562928115
##########
server-common/src/main/java/org/apache/kafka/server/common/CheckpointFile.java:
##########
@@ -72,18 +72,20 @@ public CheckpointFile(File file,
tempPath = Paths.get(absolutePath + ".tmp");
}
- public void write(Collection<T> entries) throws IOException {
+ public void write(Collection<T> entries, boolean sync) throws IOException {
synchronized (lock) {
// write to temp file and then swap with the existing file
try (FileOutputStream fileOutputStream = new
FileOutputStream(tempPath.toFile());
BufferedWriter writer = new BufferedWriter(new
OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8))) {
CheckpointWriteBuffer<T> checkpointWriteBuffer = new
CheckpointWriteBuffer<>(writer, version, formatter);
checkpointWriteBuffer.write(entries);
writer.flush();
- fileOutputStream.getFD().sync();
+ if (sync) {
+ fileOutputStream.getFD().sync();
Review Comment:
Thanks, @ocadaruma !
--
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]