From cf3693651cf4e36d4fa1989d15257fe749c5ee52 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 9 Mar 2026 19:33:02 -0700 Subject: [PATCH] fix: add IdxFileSize check to pre-delete volume verification The verification step checked DatFileSize and FileCount but not IdxFileSize, leaving a gap in the copy validation before source deletion. --- weed/worker/tasks/balance/balance_task.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weed/worker/tasks/balance/balance_task.go b/weed/worker/tasks/balance/balance_task.go index 140e5db06..261c0c5b9 100644 --- a/weed/worker/tasks/balance/balance_task.go +++ b/weed/worker/tasks/balance/balance_task.go @@ -137,6 +137,10 @@ func (t *BalanceTask) Execute(ctx context.Context, params *worker_pb.TaskParams) return fmt.Errorf("aborting: volume %d file count mismatch — source %d, target %d", volumeId, sourceStatus.FileCount, targetStatus.FileCount) } + if targetStatus.IdxFileSize != sourceStatus.IdxFileSize { + return fmt.Errorf("aborting: volume %d .idx size mismatch — source %d bytes, target %d bytes", + volumeId, sourceStatus.IdxFileSize, targetStatus.IdxFileSize) + } // Step 6: Delete from source — after this, the move is committed. // Clear the readonly flag so the defer doesn't try to restore writability.