You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "danny0405 (via GitHub)" <gi...@apache.org> on 2026/01/23 03:22:59 UTC
Re: [PR] perf: Reduce unnecessary FSDataOutputStream#hsync to enhance append performance [hudi]
danny0405 commented on code in PR #17517:
URL: https://github.com/apache/hudi/pull/17517#discussion_r2719437743
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/table/log/HoodieLogFormatWriter.java:
##########
@@ -244,21 +250,28 @@ public void close() throws IOException {
private void closeStream() throws IOException {
if (output != null) {
- flush();
+ // Call flush and `FSDataOutputStream#hsync` to persist all the data to DataNodes
+ flush(true);
output.close();
output = null;
closed = true;
}
}
private void flush() throws IOException {
+ flush(syncDuringFlush);
+ }
+
+ private void flush(boolean sync) throws IOException {
if (output == null) {
return; // Presume closed
}
output.flush();
- // NOTE : the following API call makes sure that the data is flushed to disk on DataNodes (akin to POSIX fsync())
- // See more details here : https://issues.apache.org/jira/browse/HDFS-744
- output.hsync();
+ if (sync) {
+ // NOTE : the following API call makes sure that the data is flushed to disk on DataNodes (akin to POSIX fsync())
+ // See more details here : https://issues.apache.org/jira/browse/HDFS-744
+ output.hsync();
Review Comment:
cc @balaji-varadarajan-ai again for the review
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org