Skip to content

pdp: serve long-term parked pieces with no deal or pdp ref from the cached reader - #1430

Open
TippyFlitsUK wants to merge 1 commit into
filecoin-project:mainfrom
TippyFlitsUK:fix/cachedreader-longterm-park
Open

pdp: serve long-term parked pieces with no deal or pdp ref from the cached reader#1430
TippyFlitsUK wants to merge 1 commit into
filecoin-project:mainfrom
TippyFlitsUK:fix/cachedreader-longterm-park

Conversation

@TippyFlitsUK

Copy link
Copy Markdown
Collaborator

Setup: mainnet PDP SPs holding Storacha-migration first copies as long-term parked aggregates (~226k+ pieces), now sourcing second-copy replication pulls. Running v1.28.4.

Retrieving a parked piece that has neither a market deal nor a pdp_piecerefs row returns ErrNoDeal, so /piece requests 404 while the bytes sit complete in the piece park. Migration aggregates are parked long_term = TRUE by design with no pdp ref until claimed - stock Curio cannot serve them at all. Hit this on main2.ezpdpz.net on 2026-07-29 (every retrieval of a parked complete aggregate 404'd), and these pieces are exactly what the second-copy repair campaign pulls from a first-copy SP, so on stock the campaign has no source.

The fix adds a last-resort fallback in getPieceReaderFromMarketPieceDeal: when there is no market deal and no pdp ref, look the piece up in parked_pieces with long_term = TRUE AND complete = TRUE and serve it via the piece park reader. ErrNoDeal is unchanged when the fallback finds nothing.

Running in production on both my mainnet SPs since late July, carried locally across v1.28.2-rc3, v1.28.3 and v1.28.4 - currently serving the live second-copy pulls to two other SPs. Happy to adjust or add coverage if wanted.

…ached reader

Migration aggregates are parked long_term with no pdp ref until claimed;
the cached reader returned ErrNoDeal for them, 404ing retrievals of
complete parked pieces. Fall back to parked_pieces (long_term AND
complete) via the piece park reader when no market deal and no pdp ref
exists. ErrNoDeal behaviour is unchanged when the fallback finds nothing.
@TippyFlitsUK
TippyFlitsUK requested review from a team and ZenGround0 as code owners August 14, 2026 15:27
@FilOzzy FilOzzy added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Aug 14, 2026
@FilOzzy FilOzzy added this to FOC Aug 14, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 14, 2026
@LexLuthr

Copy link
Copy Markdown
Collaborator

We are basically opening another security hole here.

@ZenGround0

Copy link
Copy Markdown
Collaborator

Following onto what @LexLuthr is saying I think this is not the best fix. I want to first understand what pieces are not being tracked by a pdp_piecref and why. Our first recourse should be to track these pieces correctly. If there is a reason the code is explicitly not tracking them we need to ammend this wholistically. If this is a matter of troubled database state resulting from the understandbly difficult storacha migration then a better option is probably to repair your db. Is there an issue describing the exact problem and if we know why these pieces are not tracked by piecrefs?

@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants