Skip to content

s3, wal: endpoint test drains bodies and always aborts once; pacing tests bound a hold, not a runner's speed - #11

Closed
Seif Lotfy (seiflotfy) wants to merge 2 commits into
mainfrom
endpoint-test-drain
Closed

Seif Lotfy (seiflotfy) wants to merge 2 commits into
mainfrom
endpoint-test-drain

Conversation

@seiflotfy

Copy link
Copy Markdown
Member

Architecture changes: none. Test-only; no production code changes.

1. TestEndpointCacheMatchesRules (aws/s3)

Cause. The fake S3 server answered each 8 MiB UploadPart without reading the request body, then closed the connection while the client was still writing it. On a starved runner the client gets write: broken pipe and the SDK retries the part. When every attempt fails, multipart calls AbortMultipartUpload. The test then resolves one more operation than its exact list allows, and fails. The cached endpoint matched the SDK's rules for every operation in every run, Abort included: only the operation list differed. Nothing outside the repository moved. objstore main 398732b passed its s3 job at 14:29 and failed it at 21:01 with the same runner image (ubuntu-26.04 20261111.196.1), the same Go (1.26.0) and the same MinIO digest (sha256:6dabb4a2…). The 21:01 runner was slow: fs took 9.8 s against 5.0 s, and two wall-clock wal tests failed in the same job.

Fix. The fake drains every body. One upload, whose body is short of its declared size, aborts on purpose, so AbortMultipartUpload is in the list on every run. It is an operation the backend sends, so the test's "every operation" contract covers it now.

Evidence, under a 25% CPU quota (systemd-run --scope -p CPUQuota=25%, GOMAXPROCS=4, -race, on a 4-vCPU orb):

Test Runs Result Part attempts that failed (instrumented client)
old 15 (plus 5 at a 10% quota) 20 passes 6 of 166 part requests, all write: broken pipe, each retried (10 runs)
new 40 40 passes 0 of 160 (10 runs)

Locally, at both quotas, the old test's race showed up as broken pipes, and the SDK's retries always succeeded. So the test failure itself did not reproduce in the orb: it needs every attempt of one part to fail, which at the measured per-attempt rate is about 1 in 1,000 runs. On CI it failed 3 of 3 s3 jobs from 20:48 (main 398732b attempt 2, store-time ebb3848 attempts 1 and 2), and passed in every test job, which runs it without MinIO's parallel tests. This PR's s3 job, and a rerun of it, are the CI check of the fix.

2. wal pacing tests

TestCommitIntervalCoalescesIntoOnePage failed in 2 of the last 82 test and s3 jobs (166 ms against a 100 ms limit). TestAdoptionDoesNotRearmPacing failed once (786 ms against 750), in the same starved job. Both were wall-clock overruns, and the counts were right.

  • Coalesce, immediate commit: limit 100 ms → 250 ms (interval-50ms). It separates an immediate commit (one 20 ms PUT plus scheduling; 166 ms on the starved runner) from a commit held one 300 ms interval. The count alone is not enough: a held commit also carries both records in one entry. Mutant check: a writer that holds its first idle commit for an interval fails at 324 ms.
  • Coalesce, rate limit: the third append's lower bound was timed from after the replay, although the interval runs from the first PUT. It failed locally at 237 ms under load. It is now timed from before the first appends, a true lower bound (≥ 300 ms) on any runner.
  • Adoption: limit 750 ms → 950 ms (2*interval-50ms). The retry waits one 500 ms interval and then adopts, so the second append is due about 500 ms after the original PUT. Pacing re-armed at the adoption holds it until 1,000 ms or later. Mutant check: setting lastCommit at adoption fails at 1.007 s.

Checks: gofmt -l . clean, go vet ./..., go test -race -count=1 ./... all pass; 30× -race of both wal tests pass.

Amp (ampagent) and others added 2 commits November 14, 2026 21:39
…rpose

The fake answered each 8 MiB UploadPart unread and closed the
connection under a client still writing it. A starved runner then failed
the part (write: broken pipe); when every SDK retry failed, the upload
aborted and AbortMultipartUpload joined the resolved operations, failing
the exact list. An upload whose body is short of its size now aborts
every run, so the list covers AbortMultipartUpload, an operation the
backend sends.

Co-authored-by: Seif Lotfy <seif@axiom.co>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1dba3-f1a0-7360-bec3-57072ae78b08
TestCommitIntervalCoalescesIntoOnePage limited an immediate commit to
100 ms and failed at 166 ms on a starved runner; a commit held an
interval takes at least 300 ms, so the limit is now 250. Its rate-limit
check timed the third append from after the replay, though the interval
runs from the first PUT; it now times from before the first appends, a
lower bound on any runner. TestAdoptionDoesNotRearmPacing allowed 750
ms and failed at 786; a re-armed adoption holds the second append to
1,000 ms or more, so the limit is now 950.

Co-authored-by: Seif Lotfy <seif@axiom.co>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1dba3-f1a0-7360-bec3-57072ae78b08

Copy link
Copy Markdown
Member Author

Landed on main as 2378225 and a17a2e1 (rebased onto store-time, same content as d4ea923 and 5143ce4); main is a17a2e1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants