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 610454789..ea4c99805 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java @@ -100,8 +100,7 @@ public class SeaweedOutputStream extends OutputStream { return position; } - // Return virtual position (flushed + buffered) - // This represents where the next byte will be written + // Return current position (flushed + buffered) return position + buffer.position(); } diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java index aedde568c..1b7e1b3d4 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedRead.java @@ -28,11 +28,6 @@ public class SeaweedRead { int originalRemaining = buf.remaining(); List chunkViews = viewFromVisibles(visibleIntervals, position, originalRemaining); - - - if (chunkViews.isEmpty()) { - - } Map knownLocations = new HashMap<>(); @@ -88,16 +83,16 @@ public class SeaweedRead { } } catch (Exception e) { - + throw e; } - // Fix: Calculate the correct limit based on the read position and requested size, - // not the buffer's absolute limit. This fixes the 78-byte EOF error when seeking + // Fix: Calculate the correct limit based on the read position and requested + // size, + // not the buffer's absolute limit. This fixes the 78-byte EOF error when + // seeking // near the end of the file. long limit = Math.min(position + originalRemaining, fileSize); - - if (startOffset < limit) { long gap = limit - startOffset; @@ -107,8 +102,6 @@ public class SeaweedRead { startOffset += gap; } - - return readCount; } @@ -262,8 +255,6 @@ public class SeaweedRead { long chunksSize = totalSize(entry.getChunksList()); long attrSize = entry.getAttributes().getFileSize(); long finalSize = Math.max(chunksSize, attrSize); - LOG.info("Calculated file size: {} (chunks: {}, attr: {}, #chunks: {})", - finalSize, chunksSize, attrSize, entry.getChunksCount()); return finalSize; } diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java index ca30e87c1..0fadd53cc 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java @@ -125,8 +125,6 @@ public class SeaweedWrite { String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey); - - return FilerProto.FileChunk.newBuilder() .setFileId(fileId) .setOffset(offset) @@ -143,14 +141,6 @@ public class SeaweedWrite { synchronized (entry) { List chunks = FileChunkManifest.maybeManifestize(filerClient, entry.getChunksList(), parentDirectory); - long totalSize = 0; - for (FilerProto.FileChunk chunk : chunks) { - totalSize = Math.max(totalSize, chunk.getOffset() + chunk.getSize()); - } - - // Check if there's a size mismatch with attributes - long attrFileSize = entry.getAttributes().getFileSize(); - entry.clearChunks(); entry.addAllChunks(chunks);