From 04c657d03feb83904c6d68e31037b1f0dde33f10 Mon Sep 17 00:00:00 2001 From: Feng Ruohang Date: Fri, 6 Nov 2026 19:41:32 +0800 Subject: [PATCH] test(pools): cover aliases of other sets in a shared lock table The implementation review of the lock fixes found two gaps in the merge test of lockObjects: - Where the sets share one local table, it only tried an alias of the clean name's own set, so dropping the shared-table normalization of the lock domain still passed. It now tries an alias of another set in every mode; with that mutation the shared case times out. - In a split distributed domain it probed readers before writers. The reader probe releases asynchronously and could hold off the writer probe right after it, so a missing alias read lock passed some runs. Writers are probed first now. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Feng Ruohang --- cmd/erasure-server-pool-lock-copy_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/erasure-server-pool-lock-copy_test.go b/cmd/erasure-server-pool-lock-copy_test.go index 24457cfc7..5ccfd073f 100644 --- a/cmd/erasure-server-pool-lock-copy_test.go +++ b/cmd/erasure-server-pool-lock-copy_test.go @@ -135,11 +135,9 @@ func TestLockObjectsMergesByResource(t *testing.T) { t.Fatalf("no names with sameSet=%v", sameSet) return "", "" } - cases := []bool{true} - if split { - cases = append(cases, false) - } - for _, sameSet := range cases { + // Where the sets share one table, an alias of another set still + // names the same resource there. + for _, sameSet := range []bool{true, false} { clean, alias := pick(sameSet) ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second) start := time.Now() @@ -159,13 +157,15 @@ func TestLockObjectsMergesByResource(t *testing.T) { } if split && !sameSet { // The alias's table holds the alias's read lock. + // Writers first: a reader probe's release is asynchronous + // and would hold off a writer probe right after it. aliasSet := pool.getHashedSet(alias) - if !ldTry(t, aliasSet.NewNSLock(bucket, alias), false) { - t.Errorf("%s: readers excluded in its own table", alias) - } if ldTry(t, aliasSet.NewNSLock(bucket, alias), true) { t.Errorf("%s: writers admitted in its own table, the alias lock is missing", alias) } + if !ldTry(t, aliasSet.NewNSLock(bucket, alias), false) { + t.Errorf("%s: readers excluded in its own table", alias) + } } unlock() }