From 6a73f03000d8e3dad30b7fbd046de0e0a867ffe7 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 23 Nov 2025 00:03:23 -0800 Subject: [PATCH] debug: track position and buffer state at close time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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! --- .../src/main/java/seaweedfs/client/SeaweedOutputStream.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java index c76aee2f7..0779a1343 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java @@ -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);