mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-15 02:50:45 +02:00
debug: add detailed chunk size logging to diagnose EOF issue
Added INFO-level logging to track: 1. Every chunk write: offset, size, etag, target URL 2. Metadata update: total chunks count and calculated file size 3. File size calculation: breakdown of chunks size vs attr size This will reveal: - If chunks are being written with correct sizes - If metadata file size matches sum of chunks - If there's a mismatch causing the '78 bytes left' EOF Example output expected: ✓ Wrote chunk to http://volume:8080/3,xxx at offset 0 size 1048576 bytes ✓ Wrote chunk to http://volume:8080/3,yyy at offset 1048576 size 524288 bytes ✓ Writing metadata with 2 chunks, total size: 1572864 bytes Calculated file size: 1572864 (chunks: 1572864, attr: 0, #chunks: 2) If we see size=X in write but size=X-78 in read, that's the smoking gun.
This commit is contained in:
@@ -239,7 +239,12 @@ public class SeaweedRead {
|
||||
}
|
||||
|
||||
public static long fileSize(FilerProto.Entry entry) {
|
||||
return Math.max(totalSize(entry.getChunksList()), entry.getAttributes().getFileSize());
|
||||
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;
|
||||
}
|
||||
|
||||
public static long totalSize(List<FilerProto.FileChunk> chunksList) {
|
||||
|
||||
@@ -125,7 +125,7 @@ public class SeaweedWrite {
|
||||
|
||||
String etag = multipartUpload(targetUrl, auth, bytes, bytesOffset, bytesLength, cipherKey);
|
||||
|
||||
LOG.debug("write file chunk {} size {}", targetUrl, bytesLength);
|
||||
LOG.info("✓ Wrote chunk to {} at offset {} size {} bytes, etag: {}", targetUrl, offset, bytesLength, etag);
|
||||
|
||||
return FilerProto.FileChunk.newBuilder()
|
||||
.setFileId(fileId)
|
||||
@@ -143,6 +143,12 @@ public class SeaweedWrite {
|
||||
synchronized (entry) {
|
||||
List<FilerProto.FileChunk> chunks = FileChunkManifest.maybeManifestize(filerClient, entry.getChunksList(),
|
||||
parentDirectory);
|
||||
long totalSize = 0;
|
||||
for (FilerProto.FileChunk chunk : chunks) {
|
||||
totalSize = Math.max(totalSize, chunk.getOffset() + chunk.getSize());
|
||||
}
|
||||
LOG.info("✓ Writing metadata to {} with {} chunks, total size: {} bytes",
|
||||
parentDirectory + "/" + entry.getName(), chunks.size(), totalSize);
|
||||
entry.clearChunks();
|
||||
entry.addAllChunks(chunks);
|
||||
filerClient.getBlockingStub().createEntry(
|
||||
|
||||
Reference in New Issue
Block a user