danny0405 commented on code in PR #9776:
URL: https://github.com/apache/hudi/pull/9776#discussion_r1349440950
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java:
##########
@@ -233,41 +234,45 @@ private static Schema getWriteSchema(HoodieWriteConfig
config) {
return new Schema.Parser().parse(config.getWriteSchema());
}
- protected HoodieLogFormat.Writer createLogWriter(
- Option<FileSlice> fileSlice, String baseCommitTime) throws IOException {
- return createLogWriter(fileSlice, baseCommitTime, null);
+ protected HoodieLogFormat.Writer createLogWriter(String deltaCommitTime) {
+ return createLogWriter(deltaCommitTime, null);
}
- protected HoodieLogFormat.Writer createLogWriter(
- Option<FileSlice> fileSlice, String baseCommitTime, String suffix)
throws IOException {
- Option<HoodieLogFile> latestLogFile = fileSlice.isPresent()
- ? fileSlice.get().getLatestLogFile()
- : Option.empty();
-
- return HoodieLogFormat.newWriterBuilder()
-
.onParentPath(FSUtils.getPartitionPath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
- .withFileId(fileId)
- .overBaseCommit(baseCommitTime)
-
.withLogVersion(latestLogFile.map(HoodieLogFile::getLogVersion).orElse(HoodieLogFile.LOGFILE_BASE_VERSION))
- .withFileSize(latestLogFile.map(HoodieLogFile::getFileSize).orElse(0L))
- .withSizeThreshold(config.getLogFileMaxSize())
- .withFs(fs)
- .withRolloverLogWriteToken(writeToken)
-
.withLogWriteToken(latestLogFile.map(HoodieLogFile::getLogWriteToken).orElse(writeToken))
- .withSuffix(suffix)
- .withFileExtension(HoodieLogFile.DELTA_EXTENSION).build();
- }
-
- protected HoodieLogFormat.Writer createLogWriter(String baseCommitTime,
String fileSuffix) {
+ protected HoodieLogFormat.Writer createLogWriter(String deltaCommitTime,
String fileSuffix) {
try {
- return createLogWriter(Option.empty(),baseCommitTime, fileSuffix);
+ return HoodieLogFormat.newWriterBuilder()
+
.onParentPath(FSUtils.getPartitionPath(hoodieTable.getMetaClient().getBasePath(),
partitionPath))
+ .withFileId(fileId)
+ .withDeltaCommit(deltaCommitTime)
+ .withFileSize(0L)
Review Comment:
Because we write a new file each time, so the initial file size is 0,
actually, the `fileLen` is not used by any code in `HoodieLogFile` now, there
might be some historical reasons.
--
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]