From c834e30a72a0034662846937d9b050813ad9474d Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 23 Nov 2025 22:35:18 -0800 Subject: [PATCH] debug: add logging to SeaweedFileSystemStore.createFile() Critical diagnostic: Our FSDataOutputStream.getPos() override is NOT being called! Adding WARN logs to SeaweedFileSystemStore.createFile() to determine: 1. Is createFile() being called at all? 2. If yes, but FSDataOutputStream override not called, then streams are being returned WITHOUT going through SeaweedFileSystem.create/append 3. This would explain why our position tracking fix has no effect Hypothesis: SeaweedFileSystemStore.createFile() returns SeaweedHadoopOutputStream directly, and it gets wrapped by something else (not our custom FSDataOutputStream). --- .../src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java | 4 ++++ .../src/main/java/seaweed/hdfs/SeaweedHadoopOutputStream.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index f65c1961b..e58a563db 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -179,6 +179,8 @@ public class SeaweedFileSystemStore { permission = permission == null ? FsPermission.getFileDefault() : permission; + LOG.warn("[DEBUG-2024] SeaweedFileSystemStore.createFile CALLED: path={} overwrite={} bufferSize={}", + path, overwrite, bufferSize); LOG.debug("createFile path: {} overwrite: {} permission: {}", path, overwrite, @@ -216,6 +218,8 @@ public class SeaweedFileSystemStore { SeaweedWrite.writeMeta(filerClient, getParentDirectory(path), entry); } + LOG.warn("[DEBUG-2024] SeaweedFileSystemStore.createFile RETURNING SeaweedHadoopOutputStream: path={} bufferSize={}", + path, bufferSize); return new SeaweedHadoopOutputStream(filerClient, path.toString(), entry, writePosition, bufferSize, replication); } diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedHadoopOutputStream.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedHadoopOutputStream.java index e36618aa9..8028b31d7 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedHadoopOutputStream.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedHadoopOutputStream.java @@ -18,9 +18,9 @@ public class SeaweedHadoopOutputStream extends SeaweedOutputStream implements Sy private static final Logger LOG = LoggerFactory.getLogger(SeaweedHadoopOutputStream.class); public SeaweedHadoopOutputStream(FilerClient filerClient, final String path, FilerProto.Entry.Builder entry, - final long position, final int bufferSize, final String replication) { + final long position, final int bufferSize, final String replication) { super(filerClient, path, entry, position, bufferSize, replication); - LOG.warn("[DEBUG-2024] SeaweedHadoopOutputStream created: path={} position={} bufferSize={} replication={}", + LOG.warn("[DEBUG-2024] SeaweedHadoopOutputStream created: path={} position={} bufferSize={} replication={}", path, position, bufferSize, replication); }