ipfs / ipfs/kubo

Ipfs add --copy should replace duplicate blocks

Open
#10,255 0 comments 1 reaction 0 assignees View on GitHub
kind/enhancement P2 topic/filestore
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

### Checklist

- [X] My issue is specific & actionable.
- [X] I am not suggesting a protocol enhancement.
- [X] I have searched on the [issue tracker](https://github.com/ipfs/kubo/issues?q=is%3Aissue) for my issue.

### Description

I think this particular issue has been brought up in different contexts, (https://github.com/ipfs/kubo/issues/8948), but here's a practical example.

Folder A is added to ipfs with --nocopy
Folder B is added with --nocopy. Folder B contains blocks that are duplicated with Folder A

Later, Folder A is removed, (Upinned, Removed from MSF, and deleted from host filesystem)

The blocks that used to be duplicated by Folder A will no longer be available. (they still reference the files in Folder A)

Even a garbage collection and re-adding Folder B will not correct this issue. The only easy way to fix this, once the problem is perceived, it Unpin Folder B, run Garbage Collection, then Re-add Folder B

My proposal here is that when ipfs add --nocopy finds a dubplicate block, it should replace the reference to the new file (this could be optional if there is a case for not doing so.) That way, missing blocks could always be restored by re-adding all the content, without having to unpin and gc first.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.