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 ef11ab39a..72ad6dc87 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java @@ -104,15 +104,14 @@ public class SeaweedOutputStream extends OutputStream { public synchronized long getPos() throws IOException { getPosCallCount++; - // Return virtual position (flushed + buffered) - // This represents where the next byte will be written - long virtualPos = position + buffer.position(); - - if (path.contains("parquet")) { - + // Guard against NPE if called after close() + if (buffer == null) { + return position; } - return virtualPos; + // Return virtual position (flushed + buffered) + // This represents where the next byte will be written + return position + buffer.position(); } public static String getParentDirectory(String path) { @@ -149,18 +148,7 @@ public class SeaweedOutputStream extends OutputStream { attrBuilder.setFileSize(offset); entry.setAttributes(attrBuilder); - if (path.contains("parquet") || path.contains("employees")) { - LOG.error( - "[METADATA-CHECK] BEFORE writeMeta: path={} fileSize={} offset={} totalBytes={} chunks={}", - path.substring(Math.max(0, path.length() - 80)), offset, offset, totalBytesWritten, entry.getChunksCount()); - } - SeaweedWrite.writeMeta(filerClient, getParentDirectory(path), entry); - - if (path.contains("parquet") || path.contains("employees")) { - LOG.error("[METADATA-CHECK] AFTER writeMeta: path={} fileSize={} - metadata written!", - path.substring(Math.max(0, path.length() - 80)), offset); - } } catch (Exception ex) { throw new IOException(ex); } 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 4b34b1ca7..c55d05797 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -161,38 +161,14 @@ public class SeaweedFileSystemStore { if (source.isRoot()) { return; } - + FilerProto.Entry entry = lookupEntry(source); if (entry == null) { LOG.warn("rename non-existing source: {}", source); return; } - - // Log source file metadata before rename - long sourceSize = entry.getAttributes().getFileSize(); - int sourceChunks = entry.getChunksCount(); - - + filerClient.mv(source.toUri().getPath(), destination.toUri().getPath()); - - - - // Lookup destination to verify metadata was preserved - FilerProto.Entry destEntry = lookupEntry(destination); - if (destEntry != null) { - long destSize = destEntry.getAttributes().getFileSize(); - int destChunks = destEntry.getChunksCount(); - - - if (sourceSize != destSize) { - - } - if (sourceChunks != destChunks) { - - } - } else { - - } } public OutputStream createFile(final Path path,