feat(storage): give teardown CancelSession and the resume a release, part 1 of 3 (upload-session-concurrency-cap plan: 12/12)

Stacked MRs

Part MR Scope LOC Target
1/3 this MR CancelSession, the DELETE move, the resume's release 847 main
2/3 !3316 (merged) turn the resume charge on 764 part 1
3/3 !3317 (merged) handler tests and the e2e overfill 718 part 2

Merge order: !3315 (merged), then !3316 (merged), then !3317 (merged). Each is blocked by the one before. This MR is also blocked by the ADR-003 amendment handbook!21493.

Summary

Step 12, part 1 of 3. It moves upload teardown off the resume path. It does not turn the resume charge on yet.

  • DELETE .../blobs/uploads/<id> calls the new BlobStore.CancelSession. It takes no admission slot, so a full gate never refuses a cancel.
  • DELETE on a D2b session (staging object and blob both gone) now answers 204, not 404. CancelSession deletes the row and runs no recovery. PATCH and PUT still get 404.
  • A teardown that cannot reopen the staging writer stays best-effort and now logs storage: cancel staging: reopen writer failed at WARN. A *PathNotFoundError stays silent. This is a review-driven correction in internal/storage/pg_session.go, which is outside Step 12's file list.
  • ResumeSession now takes a reservation and an admission source, and returns a release. The release frees nothing yet. PATCH and PUT defer it.
  • Every fake and suite that calls ResumeSession moves to the new signature.

Governing ADRs

  • ADR-003: a deviation, recorded by handbook!21493, which blocks this MR.
  • ADR-004, ADR-011: no conflict.

Testing

  • New CancelSession integration tests (session binding, caller gone, a D2b session, a session with live staging) and OCI DELETE tests.
  • A unit test for the reopen WARN: it fires on any reopen failure but *PathNotFoundError, and stays silent on that one.
  • Hooks pass. go vet and golangci-lint with -tags=integration are clean. The integration suites run in CI only.
  • Checked at runtime on the full stack (S3 on MinIO): DELETE at a full gate gives 204 for docker and oci, an unknown or other-repo id gives 404, a client gone gives 499.
  • Not run yet: OCI conformance.
  • e2e: none here; part 3 adds the rows. docs/user: no change.

Plan and spec amendments

  • S12: DELETE goes through CancelSession.
  • Plan, Step 12 ("Why a method rather than a carve-out"): a teardown's memory cost depends on the driver. S3 allocates nothing at open. GCS reads the resume marker into a 256 KiB buffer, so each concurrent cancel holds up to 256 KiB.

Size

847 LOC: 204 code, 578 tests, 65 docs. The signature updates across fakes and suites are mechanical.

Overlap

!2944 (closed) (S06 retirement) touches most of these files. Whichever merges second rebases.

Related to #1242 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading
Loading