vinothchandar commented on a change in pull request #2300:
URL: https://github.com/apache/hudi/pull/2300#discussion_r549509916
##########
File path:
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieAppendHandle.java
##########
@@ -203,31 +213,136 @@ private void init(HoodieRecord record) {
return Option.empty();
}
+ private void initNewStatus() {
+ HoodieDeltaWriteStat prevStat = (HoodieDeltaWriteStat)
this.writeStatus.getStat();
+ // Make a new write status and copy basic fields over.
+ HoodieDeltaWriteStat stat = new HoodieDeltaWriteStat();
+ stat.setFileId(fileId);
+ stat.setPartitionPath(partitionPath);
+ stat.setPrevCommit(prevStat.getPrevCommit());
+ stat.setBaseFile(prevStat.getBaseFile());
+ stat.setLogFiles(new ArrayList<>(prevStat.getLogFiles()));
+
+ this.writeStatus = (WriteStatus)
ReflectionUtils.loadClass(config.getWriteStatusClassName(),
+ !hoodieTable.getIndex().isImplicitWithStorage(),
config.getWriteStatusFailureFraction());
+ this.writeStatus.setFileId(fileId);
+ this.writeStatus.setPartitionPath(partitionPath);
+ this.writeStatus.setStat(stat);
+ }
+
+ private String makeFilePath(HoodieLogFile logFile) {
+ return partitionPath.length() == 0
+ ? new Path(logFile.getFileName()).toString()
+ : new Path(partitionPath, logFile.getFileName()).toString();
+ }
+
+ private void resetWriteCounts() {
+ recordsWritten = 0;
+ updatedRecordsWritten = 0;
+ insertRecordsWritten = 0;
+ recordsDeleted = 0;
+ }
+
+ private void updateWriteCounts(HoodieDeltaWriteStat stat, AppendResult
result) {
+ stat.setNumWrites(recordsWritten);
+ stat.setNumUpdateWrites(updatedRecordsWritten);
+ stat.setNumInserts(insertRecordsWritten);
+ stat.setNumDeletes(recordsDeleted);
+ stat.setTotalWriteBytes(result.size());
+ }
+
+ private void accumulateWriteCounts(HoodieDeltaWriteStat stat, AppendResult
result) {
+ stat.setNumWrites(stat.getNumWrites() + recordsWritten);
+ stat.setNumUpdateWrites(stat.getNumUpdateWrites() + updatedRecordsWritten);
+ stat.setNumInserts(stat.getNumInserts() + insertRecordsWritten);
+ stat.setNumDeletes(stat.getNumDeletes() + recordsDeleted);
+ stat.setTotalWriteBytes(stat.getTotalWriteBytes() + result.size());
+ }
+
+ private void updateWriteStat(HoodieDeltaWriteStat stat, AppendResult result)
{
+ stat.setPath(makeFilePath(result.logFile()));
+ stat.setLogOffset(result.offset());
Review comment:
so the earliest offset it writes to . i.e the first time a log was
written to by this append handle.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]