ethersphere / swarm

Swarm: Censorship resistant storage and communication infrastructure for a truly sovereign digital society
https://swarm.ethereum.org/
GNU Lesser General Public License v3.0
489 stars 110 forks source link

storage/localstore: fix for pinned chunks that are GC under certain conditions #2190

Closed santicomp2014 closed 4 years ago

santicomp2014 commented 4 years ago

This PR is a fix, for pinned chunks that are being garbage collected when multiple GC is run.

This can be verified by

This should be tested by pinning once the content, and also by pinning multiple times the same chunk and repeating the test.

After the first run of the Garbage collection, the pinned chunk is removed from gcExcludeIndex So the next time the GC is run it will be deleted from the chunks.

I moved this delete from gcExcludeIndex from removeChunksInExcludeIndexFromGC (gc.go) to setUnpin (mode_set.go)

Another issue was the metric localstore/gc/exclude/excluded-count this was only increasing, also decreased it in thesetUnpin

closes #2195

mortelli commented 4 years ago

awaiting comment from @jmozah before properly reviewing this

mortelli commented 4 years ago

although not strictly a global-pinning issue, i have added the label since it impacts its implementation.

(keep in mind this merges to master)

santicomp2014 commented 4 years ago

This PR was closed due to feedback with @jmozah A new PR (#2200) is created with correct fix for local pinning bug.