s3: keep the EOF read out of the timed body in the put stage test (#13016)

* s3: do not delay the EOF read in the put stage timing test

TestPutStagesRecordEachStage checks that the storage stage is at least
5ms. That stage is the second chunk's assign wait (20ms) minus the final
read that only returns EOF, which slowReader also delayed by 10ms. When
busy goroutines hold every P, the reader's wakeup can lag the assign's
by as much as a preemption slice, and storage drops below the floor.

slowReader now delays only reads that return data, so the EOF read is
instant and storage covers the whole assign wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: keep the EOF read out of the timed body in the put stage test

Skipping the delay on the EOF read still left that read inside
timedBody, so a stall there was subtracted from storage. Feed the upload
through an eight-byte limit instead: the final EOF comes from the limit
reader without reaching the timed body, so storage always covers the
second chunk's full assign wait. slowReader goes back to delaying every
read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-26 08:24:58 -08:00
1 parent dcce121d95
commit 87ee3c57cb
1 file changed
+1 -1
+1 -1
View File
@@ -105,7 +105,7 @@ func TestPutStagesRecordEachStage(t *testing.T) {
r = timeBodyReads(r)
stages := newPutStages(r)
result, err := stages.upload(context.Background(), r.Body, stagedUploadOption(20*time.Millisecond, nil))
result, err := stages.upload(context.Background(), io.LimitReader(r.Body, 8), stagedUploadOption(20*time.Millisecond, nil))
require.NoError(t, err)
require.Len(t, result.FileChunks, 2)
time.Sleep(5 * time.Millisecond)