ColinLeeo commented on issue #923:
URL: https://github.com/apache/tsfile/issues/923#issuecomment-5903102347

   Sorry for the delayed response, and please excuse the delay. I carefully 
reviewed your implementation, and it looks very good. I also compared the 
proposed flow with the Java implementation.
   
   Overall, the design is aligned with Java’s completed-file append workflow. 
In Java, 
RestorableTsFileIOWriter.getWriterForAppendingDataOnCompletedTsFile(File) 
detects a complete file, uses the metadata size in the footer to locate 
fileMetadataPos, removes the existing metadata tail, and then enters the normal 
RestorableTsFileIOWriter recovery flow so that new data can be appended and a 
new footer can be generated on close.
   
   Therefore, I agree with adding a separate open_for_append() entry point 
instead of changing the behavior of the existing open(). The current open() 
semantics can remain unchanged, with a normally completed file remaining 
non-writable, while the new entry point handles the explicit append workflow.
   
   For the marker at the metadata boundary, I suggest following the actual Java 
behavior. The Java append helper calculates the truncation position from the 
footer metadata size and calls truncate(fileMetadataPos - 1) without requiring 
the boundary byte to be a specific marker. Therefore, I do not think the C++ 
implementation needs to introduce a stricter marker requirement than Java.
   
   Regarding the file version, Java currently supports versions V3 through V4, 
while the current C++ implementation only supports V4. I suggest that this 
issue should first align the C++ completed-file append workflow with Java while 
keeping the current C++ version scope limited to V4. V3 compatibility can be 
handled as a separate follow-up task, since it would require complete support 
in the corresponding chunk, page, metadata, and configuration deserialization 
paths.
   
   The ownership and lifetime handling in the C API also look clear. The 
recovered RestorableTsFileIOWriter needs to remain alive for the entire 
lifetime of the higher-level tree/table writer and should only be released 
after the higher-level writer has completed its close operation. The proposed 
context/lifetime design should be sufficient for this.
   
   Overall, I agree with the current design and think it is ready to move 
forward. The scope can remain:
   
   - align with Java’s completed-file append workflow;
   - add a dedicated open_for_append() API;
   - preserve the existing open() behavior;
   - support V4 only for now;
   - manage the recovered writer lifetime correctly in the C API;
   - add coverage for completed-file append, repeated append/close cycles, 
no-op append, malformed footers, and C-wrapper lifetime handling.


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