Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files added via files API get garbage collected #2697

Closed
kevina opened this issue May 15, 2016 · 1 comment · Fixed by #2872
Closed

Files added via files API get garbage collected #2697

kevina opened this issue May 15, 2016 · 1 comment · Fixed by #2872
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support topic/files Topic files

Comments

@kevina
Copy link
Contributor

kevina commented May 15, 2016

It seams that there is nothing protecting files added via the files API from being garbage collected:

$ ipfs version
ipfs version 0.4.1
$ echo "hello world"  | ipfs files write --create /hello.txt
$ ipfs files stat  /hello.txt
QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
$ ipfs repo gc
...
removed QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
...
$ ipfs cat QmVib14uvPnCP73XaCDpwugRuwfTsVbGyWbatHAmLSdZUS
Error: merkledag: not found

And I can't even remove the file:

$ ipfs files rm /hello.txt
Error: merkledag: not found

(but for some reason ipfs files rm -r /hello.txt works as a workaround).

Am I missing something?

@kevina
Copy link
Contributor Author

kevina commented May 16, 2016

If I understand how the files API works, the easiest way to fix this is to maintain a pin to the files root directory. Every time somethings changes the old pin will be removed and a new pin will be created to the new root.

Another way is to make the garbage collector aware of the files root node.

I think I can try implementing either option once we decide what we want to do. Fixing this will probably fix #2698.

Slightly related is @whyrusleeping idea of moving pinned objects inside the files api space (in a comment in issue #257). Although I thinks .pins would be better to prevent accidental removal if wildcards are eventually supported and someone does something like "ipfs files rm -r /*".

@RichardLitt RichardLitt added kind/support A question or request for support topic/files Topic files labels May 16, 2016
@Kubuxu Kubuxu added the kind/bug A bug in existing code (including security flaws) label May 16, 2016
kevina added a commit to ipfs-filestore/go-ipfs that referenced this issue Jun 20, 2016
Closes ipfs#2697.  Closes ipfs#2698.

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
kevina added a commit to ipfs-filestore/go-ipfs that referenced this issue Jun 20, 2016
Closes ipfs#2697.  Closes ipfs#2698.

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this issue Apr 7, 2022
Closes ipfs#2697.  Closes ipfs#2698.

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) kind/support A question or request for support topic/files Topic files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants