mirror of
https://github.com/pgsty/minio.git
synced 2026-11-09 17:21:51 +03:00
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 <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user