From 95078cd7642b4ce82b14c76c04117eaec9bc0059 Mon Sep 17 00:00:00 2001 From: chrislu Date: Mon, 10 Nov 2025 15:41:53 -0800 Subject: [PATCH] edge case on modified time --- weed/shell/command_volume_check_disk_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/weed/shell/command_volume_check_disk_test.go b/weed/shell/command_volume_check_disk_test.go index 24c0ae516..84d62ca77 100644 --- a/weed/shell/command_volume_check_disk_test.go +++ b/weed/shell/command_volume_check_disk_test.go @@ -222,6 +222,26 @@ func TestShouldSkipVolume(t *testing.T) { syncDeletions: true, shouldSkipVolume: false, // Large difference requires sync }, + // Edge case: Both volumes modified AFTER pulse cutoff time + // When ModifiedAtSecond >= pulseTimeAtSecond for both volumes with same counts, + // the condition (a.info.FileCount != b.info.FileCount) is false, so we skip + // without calling eqVolumeFileCount + { + name: "both volumes modified after pulse cutoff with same file counts should be skipped", + a: VolumeReplica{nil, &master_pb.VolumeInformationMessage{ + FileCount: 1000, + DeleteCount: 100, + ModifiedAtSecond: 1696583405}, // After pulse cutoff (1696583380) + }, + b: VolumeReplica{nil, &master_pb.VolumeInformationMessage{ + FileCount: 1000, + DeleteCount: 100, + ModifiedAtSecond: 1696583410}, // After pulse cutoff + }, + pulseTimeAtSecond: 1696583400, + syncDeletions: true, + shouldSkipVolume: true, // Same counts = skip without calling eqVolumeFileCount + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {