Keep stale virtual member copy when the remote lookup fails #171

Merged
benvin merged 3 commits from benvin/stale-keep-on-lookup-error into master 2026-10-25 20:24:20 +11:00
Member

A transient remote lookup error dropped the serve_stale copy of a virtual member and forced a blocking fetch, so a short DB blip stalled every merge.

  • serve the existing copy on a lookup error and refresh it in the background
  • fetch directly without storing anything on a lookup error with no copy
  • create copies only after a successful lookup with serve_stale on
A transient remote lookup error dropped the serve_stale copy of a virtual member and forced a blocking fetch, so a short DB blip stalled every merge. - serve the existing copy on a lookup error and refresh it in the background - fetch directly without storing anything on a lookup error with no copy - create copies only after a successful lookup with serve_stale on
unkin-agent added 1 commit 2026-10-25 19:07:26 +11:00
Keep stale virtual member copy when the remote lookup fails
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
de80fd84c2
Author
Member
  • internal/virtual/engine.go:552 — a lookup error now routes a member with serve_stale off into the stale path: it serves a leftover warm copy (from a past toggle) up to maxStaleAge, and a cold fetch stores a new copy for it → state this explicitly as intended, or on error with no existing copy call fetch(ctx) directly without storing.
  • internal/virtual/engine_stale_test.go:331 — only the warm-copy case is covered; add a lookup-error case for a cold member (blocks, no stale copy retained or retained as intended) and for a member with serve_stale off → pin the chosen behaviour.
- internal/virtual/engine.go:552 — a lookup error now routes a member with `serve_stale` off into the stale path: it serves a leftover warm copy (from a past toggle) up to maxStaleAge, and a cold fetch stores a new copy for it → state this explicitly as intended, or on error with no existing copy call `fetch(ctx)` directly without storing. - internal/virtual/engine_stale_test.go:331 — only the warm-copy case is covered; add a lookup-error case for a cold member (blocks, no stale copy retained or retained as intended) and for a member with `serve_stale` off → pin the chosen behaviour.
unkin-agent added 1 commit 2026-10-25 19:16:20 +11:00
Create virtual member stale copies only after a successful serve_stale lookup
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
f1fd1a442c
Author
Member
  • internal/virtual/engine_stale_test.go:332 — TestServeStaleLookupErrorKeepsCopy cannot tell "served copy + background refresh" from "blocking direct fetch that leaves the copy alone": fetch returns constant content and calls is never checked, so the repomd equality and the copy-still-present assertion hold either way → use a blocking/changing fetch (as TestServeStaleMemberDoesNotBlockMerge does) and assert the merge returns without waiting, or assert the post-refresh copy is newer.
  • nit: internal/virtual/engine.go:565 — the lookup-error-with-in-flight-placeholder path (prev != nil, prev.m == nil) falls through to the direct fetch but has no test → add one.
- internal/virtual/engine_stale_test.go:332 — TestServeStaleLookupErrorKeepsCopy cannot tell "served copy + background refresh" from "blocking direct fetch that leaves the copy alone": fetch returns constant content and calls is never checked, so the repomd equality and the copy-still-present assertion hold either way → use a blocking/changing fetch (as TestServeStaleMemberDoesNotBlockMerge does) and assert the merge returns without waiting, or assert the post-refresh copy is newer. - nit: internal/virtual/engine.go:565 — the lookup-error-with-in-flight-placeholder path (prev != nil, prev.m == nil) falls through to the direct fetch but has no test → add one.
unkin-agent added 1 commit 2026-10-25 19:23:17 +11:00
Prove lookup-error stale serving and cold-fetch isolation in tests
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
b54eb5fe2f
Author
Member

No findings.

No findings.
benvin merged commit f5d30cc96e into master 2026-10-25 20:24:20 +11:00
benvin deleted branch benvin/stale-keep-on-lookup-error 2026-10-25 20:24:21 +11:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#171