Debug replication corruption issue

This commit is contained in:
2025-11-22 12:56:33 +08:00
parent 471cf5a305
commit fe3eacd2be
2 changed files with 83 additions and 25 deletions

View File

@@ -133,18 +133,7 @@ class ReplicationManager:
content_type, _ = mimetypes.guess_type(path)
file_size = path.stat().st_size
# Debug: Calculate MD5 of source file
import hashlib
md5_hash = hashlib.md5()
with path.open("rb") as f:
# Log first 32 bytes
header = f.read(32)
logger.info(f"Source first 32 bytes: {header.hex()}")
md5_hash.update(header)
for chunk in iter(lambda: f.read(4096), b""):
md5_hash.update(chunk)
source_md5 = md5_hash.hexdigest()
logger.info(f"Replicating {bucket_name}/{object_key}: Size={file_size}, MD5={source_md5}, ContentType={content_type}")
logger.info(f"Replicating {bucket_name}/{object_key}: Size={file_size}, ContentType={content_type}")
try:
with path.open("rb") as f: