mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
fix: expose incompatible pool configuration refusals
This commit is contained in:
1 parent
8bf7cfd663
commit
7899cd9240
2 files changed
+12
No files matched your search
@@ -216,6 +216,15 @@ func (l *Limiter) Admit(ctx context.Context, payload int64, abort func(error)) (
|
||||
return 0, err
|
||||
}
|
||||
if errors.Is(err, ErrConfig) {
|
||||
l.mu.Lock()
|
||||
warn := l.stats.LastPoolError != err.Error()
|
||||
l.stats.LastPoolError = err.Error()
|
||||
l.stats.Skipped++
|
||||
l.stats.SkippedByClass[c]++
|
||||
l.mu.Unlock()
|
||||
if warn {
|
||||
log.Printf("hostlimit: shared pool configuration refused; background protection may lag: %v", err)
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
fallback := err != nil // A is deliberately degraded: no shared memory/spill cap.
|
||||
|
||||
@@ -164,6 +164,9 @@ func TestFallbackAndConfigMismatch(t *testing.T) {
|
||||
if _, e = b.Admit(context.Background(), 1, nil); !errors.Is(e, ErrConfig) {
|
||||
t.Fatalf("config mismatch bypassed cap: %v", e)
|
||||
}
|
||||
if st := b.Snapshot().(Stats); st.LastPoolError == "" || st.Skipped != 1 {
|
||||
t.Fatal("configuration refusal was silent", st)
|
||||
}
|
||||
c.Directory += "-missing"
|
||||
f := newTest(t, c)
|
||||
x, e = f.Admit(context.Background(), 1, nil)
|
||||
|
||||
Reference in new issue
Block a user