alexeykudinkin commented on code in PR #6476:
URL: https://github.com/apache/hudi/pull/6476#discussion_r971363419


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteHandle.java:
##########
@@ -273,6 +283,33 @@ protected HoodieFileWriter createNewFileWriter(String 
instantTime, Path path, Ho
     return HoodieFileWriterFactory.getFileWriter(instantTime, path, 
hoodieTable, config, schema, taskContextSupplier);
   }
 
+  protected HoodieLogFormat.Writer createLogWriter(
+      Option<FileSlice> fileSlice, String baseCommitTime) throws IOException {
+    int logVersion = HoodieLogFile.LOGFILE_BASE_VERSION;
+    long logFileSize = 0L;
+    String logWriteToken = writeToken;
+    if (fileSlice.isPresent()) {
+      Option<HoodieLogFile> latestLogFileOpt = 
fileSlice.get().getLatestLogFile();
+      if (latestLogFileOpt.isPresent()) {
+        HoodieLogFile latestLogFile = latestLogFileOpt.get();
+        logVersion = latestLogFile.getLogVersion();
+        logFileSize = latestLogFile.getFileSize();
+        logWriteToken = 
FSUtils.getWriteTokenFromLogPath(latestLogFile.getPath());
+      }
+    }
+    return HoodieLogFormat.newWriterBuilder()
+        
.onParentPath(FSUtils.getPartitionPath(hoodieTable.getMetaClient().getBasePath(),
 partitionPath))
+        .withFileId(fileId)
+        .overBaseCommit(baseCommitTime)
+        .withLogVersion(logVersion)
+        .withFileSize(logFileSize)
+        .withSizeThreshold(config.getLogFileMaxSize())
+        .withFs(fs)
+        .withRolloverLogWriteToken(writeToken)
+        .withLogWriteToken(logWriteToken)
+        .withFileExtension(HoodieLogFile.DELTA_EXTENSION).build();

Review Comment:
   So one of the pre-requisites of the CDC is: 
   
   - When we're issuing normal Data query (and not a CDC one), there should be 
**no performance impact** to it
   
   Moreover, we should clearly disambiguate the CDC infra from the Data infra 
w/o the need to even fetch the first block of the file (we can still use the 
same Log format, but we should definitely create separate naming scheme for CDC 
Log files to not mix these up w/ the Data Delta Log files)



-- 
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]

Reply via email to