Retrieval Redundancy Level not set (defaults to PARANOID)
ldeffenb opened this issue · 3 comments
Context
2.1.0-rc2 (and probably 2.0.* as well)
Summary
See #4693 for details, but tracking that down found that SetLevelInContext
is never invoked by the /bytes api therefore when the joiner invokes GetLevelFromContext
, it gets the default value of 4 or PARANOID.
Expected behavior
If the Swarm-Redundancy-Strategy
is specified on /bytes, then I would expect it to be honored by the joiner.
Actual behavior
My hacked logs (see here ) prove that the joiner is using rLevel = 4.
Steps to reproduce
Add your own logs, retrieve something with the /bytes API specifying Swarm-Redundancy-Strategy
and verify that it doesn't get to the joiner. Or just grep the source code for SetLevelInContext
and GetLevelInContext
. The file pipeline invokes the former, but that isn't invoked for the root chunk.
Possible solution
Have the API invoke SetLevelInContext before creating the joiner like maybe as in this hack that only handles NONE:
https://github.com/ldeffenb/bee/blob/ed323f9561f1ae541895153383fcb6edc1d142fc/pkg/api/bzz.go#L546
In actual fact, it appears that the API doesn't have a way to specify the retrieval redundancy level, but only the strategy for prefetching and/or changing that strategy to a fallback.
This is decidedly bad IMHO.
I added this workaround:
https://github.com/ldeffenb/bee/blob/ed323f9561f1ae541895153383fcb6edc1d142fc/pkg/api/bzz.go#L546
Do you really want this to default to PARANOID? It will cause LOTS of canceled retrievals when accessing /bzz files from a browser. Just hit the following URL on a sepolia testnet node and watch the retrieval failed
debug logs.
http://localhost:1633/bzz/fdfd170f73953bc262d936d3a5329b787980335dc0547032bb2a6239ebe95a76/14/coverage.png