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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]