storage: require real CAS samples for freeze admission

This commit is contained in:
pingqiu committed 2026-11-20 04:57:19 -08:00
1 parent 40d217d91a
commit 7d0195d8a7
2 files changed
+7 -1

No files matched your search

@@ -204,6 +204,10 @@ func (l *chunkLayerImpl) precopyEstimate(tail uint64, attempts int) PrecopyRepor
}
func (l *chunkLayerImpl) samplePrecopy(st chunkCutStats, fixedNs int64) {
// A no-op root read is not a measurement of final CAS + confirmation.
if st.CASNs <= 0 {
return
}
s := precopySample{at: time.Now(), fixed: time.Duration(max(int64(1), fixedNs))}
if st.UploadedBytes > 0 && st.PayloadNs > 0 {
s.rate = float64(st.UploadedBytes) / time.Duration(st.PayloadNs).Seconds()
@@ -231,7 +231,8 @@ func TestPrecopyDetachQueuedCancellationReturnsWhileOtherCutOwnsPipeline(t *test
_, f, l, _ := precopyLayer(t, 1024, 1)
entered, release := holdPuts(t, f)
cutDone, preDone := make(chan struct{}), make(chan struct{})
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
var ctx context.Context
cancel := func() {}
var precopyErr error
t.Cleanup(func() {
release()
@@ -251,6 +252,7 @@ func TestPrecopyDetachQueuedCancellationReturnsWhileOtherCutOwnsPipeline(t *test
close(preDone)
t.Fatal("other cut did not reach held upload")
}
ctx, cancel = context.WithTimeout(context.Background(), 100*time.Millisecond)
go func() {
defer close(preDone)
_, precopyErr = l.PrecopyDetach(ctx, func() bool { t.Error("queued canceled caller stopped I/O"); return false })