zhangyue19921010 opened a new issue, #11233:
URL: https://github.com/apache/paimon/issues/11233

   ### Search before asking
   
   - [x] I searched the issues and found no matching writer-close problem.
   
   ### Paimon version
   
   Master at `d90a902d0a4f11d8c8512b8f3ccd6d6a4e92e89a` (2.2-SNAPSHOT).
   
   ### Compute Engine
   
   Java Table API, OpenJDK 11.0.18.
   
   ### Minimal reproduce step
   
   1. Create a primary-key table with `bucket=1` and `write-only=true`.
   2. Give a `BatchTableWrite` a shared `MemoryPoolFactory` backed by three 
4096-byte pages and a caller-owned `IOManager`.
   3. Write a row, then close the writer without calling `prepareCommit`. 
Create another writer with the same pool and write another row.
   4. For the spill case, enable `write-buffer-spillable` and write 100 rows 
with 900-character values before closing. Check the spill directory while the 
IO manager is still open.
   
   ### What doesn't meet your expectations?
   
   Closing the first writer leaves only one of the three pages available. 
Writing with the next writer fails with `Error getting first segment for record 
collector`. In the spill workload, 12 temporary files also remain after the 
writer closes.
   
   `MergeTreeWriter.close()` never clears its write buffer. Its enclosing 
file-store writer drops the memory-owner references, so the shared pool cannot 
preempt those pages afterward. Closing should discard unprepared rows and 
return the buffer's pages and spill files; it should not commit the rows.
   
   ### Anything else?
   
   The same workloads succeed when prepared and committed before closing. The 
proposed fix calls the existing write-buffer clear operation at close entry. 
Table-level regressions cover both buffer modes, shared-pool reuse, and 
committed-row readback.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


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