mirror of
https://github.com/pgsty/minio.git
synced 2026-10-17 23:16:09 +03:00
87c1c6b3dc
Distinguish all-drive native absence from read uncertainty and confirm current pool targets before omitting a recovered name. Cover both existing single-pool writer lock domains, release before encoding or output, and preserve cache terminal errors without blocking the HTTP error response on remote publication. Keep ordinary entries free of recovery I/O and locks. Bound the selective short lock-conflict wait, preserve existing retry intervals and quorum, and make retries cancelable with late-grant cleanup coverage. Restore the original raw listing callback and unchanged scanner/healing/migration callers now that recovery errors originate in the merger. Add deterministic deletion, pool ordering, cache, lock-routing and cancellation regressions to race CI. Focused cmd/dsync/lsync race suites and verifiers pass; complete current-main integration and bare-binary performance validation are recorded in PR #239. Refs: https://github.com/pgsty/silo/issues/218 Signed-off-by: Feng Ruohang <rh@vonng.com>
73 lines
1.9 KiB
Go
73 lines
1.9 KiB
Go
// Copyright (c) 2026 Feng Ruohang
|
|
//
|
|
// This file is part of Silo Object Storage stack
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package lsync
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"testing/synctest"
|
|
"time"
|
|
)
|
|
|
|
func TestLRWMutexRetryCancellation(t *testing.T) {
|
|
for _, read := range []bool{false, true} {
|
|
synctest.Test(t, func(t *testing.T) {
|
|
lm := NewLRWMutex()
|
|
lm.Lock()
|
|
defer lm.Unlock()
|
|
ctx, cancel := context.WithCancel(t.Context())
|
|
defer cancel()
|
|
done := make(chan bool, 1)
|
|
go func() {
|
|
if read {
|
|
done <- lm.GetRLock(ctx, "waiter", "retry-test", time.Hour)
|
|
} else {
|
|
done <- lm.GetLock(ctx, "waiter", "retry-test", time.Hour)
|
|
}
|
|
}()
|
|
synctest.Wait()
|
|
cancel()
|
|
synctest.Wait()
|
|
select {
|
|
case locked := <-done:
|
|
if locked {
|
|
t.Fatal("canceled waiter acquired lock")
|
|
}
|
|
default:
|
|
t.Error("cancellation did not interrupt local retry wait")
|
|
<-done
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestLRWMutexRetryDeadline(t *testing.T) {
|
|
synctest.Test(t, func(t *testing.T) {
|
|
lm := NewLRWMutex()
|
|
lm.Lock()
|
|
defer lm.Unlock()
|
|
start := time.Now()
|
|
if lm.GetLock(t.Context(), "waiter", "retry-test", time.Millisecond) {
|
|
t.Fatal("unavailable lock was acquired")
|
|
}
|
|
if elapsed := time.Since(start); elapsed != time.Millisecond {
|
|
t.Fatalf("local retry wait overran deadline: %v", elapsed)
|
|
}
|
|
})
|
|
}
|