debug: track position and buffer state at close time

Added logging to show:
1. totalPosition: Total bytes ever written to stream
2. buffer.position(): Bytes still in buffer before flush
3. finalPosition: Position after flush completes

This will reveal if:
- Parquet wrote 1338 bytes → position should be 1338
- Only 1260 bytes reached write() → position would be 1260
- 78 bytes stuck in buffer → buffer.position() would be 78

Expected output:
  close: path=...parquet totalPosition=1338 buffer.position()=78
  → Shows 78 bytes in buffer need flushing

OR:
  close: path=...parquet totalPosition=1260 buffer.position()=0
  → Shows Parquet never wrote the 78 bytes!
This commit is contained in:
chrislu committed 2025-11-23 00:03:23 -08:00
1 parent bdf8d89fbb
commit 6a73f03000
1 file changed
+2 -1
@@ -191,10 +191,11 @@ public class SeaweedOutputStream extends OutputStream {
return;
}
LOG.debug("close path: {}", path);
LOG.info("close: path={} totalPosition={} buffer.position()={}", path, position, buffer.position());
try {
flushInternal();
threadExecutor.shutdown();
LOG.info("close completed: path={} finalPosition={}", path, position);
} finally {
lastError = new IOException("Stream is closed!");
ByteBufferPool.release(buffer);