diff --git a/seaweed-block/cmd/blockvolume/host_limit.go b/seaweed-block/cmd/blockvolume/host_limit.go index 7eba88af39..f2d94d7aa0 100644 --- a/seaweed-block/cmd/blockvolume/host_limit.go +++ b/seaweed-block/cmd/blockvolume/host_limit.go @@ -15,6 +15,6 @@ func registerHostLimitFlags(fs *flag.FlagSet, c *hostlimit.Config) { fs.Int64Var(&c.PayloadBytes, "host-limit-payload-bytes", c.PayloadBytes, "maximum cut payload per slot") fs.Int64Var(&c.COWBytes, "host-limit-cow-bytes", c.COWBytes, "maximum saved COW bytes per slot") fs.Int64Var(&c.BytesPerSecond, "host-limit-upload-bytes-sec", c.BytesPerSecond, "pacing parameter divided per process by cut-slot count; not a host rate cap") - fs.IntVar(&c.FallbackVolumes, "host-limit-fallback-volumes", c.FallbackVolumes, "urgent-fallback per-process divisor; coordinated host cap is not enforced") + fs.IntVar(&c.FallbackVolumes, "host-limit-fallback-volumes", c.FallbackVolumes, "kept for configuration compatibility; the urgent fallback is not paced (no shared host cap to protect)") fs.DurationVar(&c.MaxHold, "host-limit-max-hold", c.MaxHold, "cut lease timeout; expiration aborts but waits for admitted I/O before release") } diff --git a/seaweed-block/core/frontend/durable/provider_chunk.go b/seaweed-block/core/frontend/durable/provider_chunk.go index e356da62a4..f4a2680e6f 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk.go +++ b/seaweed-block/core/frontend/durable/provider_chunk.go @@ -584,7 +584,7 @@ func (r *closeBoundRemote) Put(ctx context.Context, key string, data []byte) err defer end() if r.waitUpload != nil { if err := r.waitUpload(c, len(data)); err != nil { - return err + return fmt.Errorf("hostlimit: upload pacing before put %s: %w", key, err) } } return r.ChunkRemote.Put(c, key, data) diff --git a/seaweed-block/core/hostlimit/limiter.go b/seaweed-block/core/hostlimit/limiter.go index d6486f6764..494d293d60 100644 --- a/seaweed-block/core/hostlimit/limiter.go +++ b/seaweed-block/core/hostlimit/limiter.go @@ -469,10 +469,13 @@ func (l *Limiter) WaitUpload(ctx context.Context, n int) error { l.mu.Unlock() return ErrRevoked } - div := l.cfg.NormalSlots + l.cfg.UrgentSlots if l.fallback { - div = l.cfg.FallbackVolumes + // Only an urgent cut runs on the fallback, and with the shared + // pool unusable there is no host cap to protect: not paced. + l.mu.Unlock() + return nil } + div := l.cfg.NormalSlots + l.cfg.UrgentSlots rate := l.cfg.BytesPerSecond / int64(div) if rate < 1 { rate = 1 diff --git a/seaweed-block/core/hostlimit/limiter_test.go b/seaweed-block/core/hostlimit/limiter_test.go index d0f35b0533..8e43876c9b 100644 --- a/seaweed-block/core/hostlimit/limiter_test.go +++ b/seaweed-block/core/hostlimit/limiter_test.go @@ -635,3 +635,24 @@ func TestAdmitClosedDuringPoolAcquisitionIsRevoked(t *testing.T) { t.Fatalf("admission racing Close: id=%d err=%v; want ErrRevoked", id, err) } } + +// An urgent cut on the static fallback (the shared pool is unusable) is not +// rate-paced: there is no shared cap to protect, and pacing it at +// BytesPerSecond/FallbackVolumes made a seal time out (issue 486). +func TestUrgentFallbackUploadIsNotPaced(t *testing.T) { + c := testConfig(t) + c.Directory += "-missing" + l := newTest(t, c) + id, err := l.Acquire(context.Background(), Urgent, nil) + if err != nil || !l.Snapshot().(Stats).FallbackActive { + t.Fatalf("urgent fallback: id=%d err=%v", id, err) + } + defer l.Release(id) + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + for i := 0; i < 4; i++ { + if err := l.WaitUpload(ctx, 16<<20); err != nil { + t.Fatalf("upload %d on the fallback was paced: %v", i, err) + } + } +}