Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

More sled pinstore changes #444

Merged
merged 13 commits into from
Jan 18, 2021
Merged

Conversation

koivunej
Copy link
Collaborator

@koivunej koivunej commented Jan 11, 2021

This PR adds:

  • docs for the feature and the struct
  • even longer TODOs, but with less FIXMEs
  • pin key reuse in some cases from get_pinned_mode
  • use TransactionalTree::flush instead of Db::flush_async, see sled pinstore tests deadlock rarely #443
  • the use of spawn_blocking to do sled operations

Closes #443.

@koivunej koivunej marked this pull request as ready for review January 11, 2021 10:47
@koivunej
Copy link
Collaborator Author

It seems that cargo ndk is out with a new major version. I'll post another PR for fixing the pre-2.0 version. I am not so sure if we should continue building these, as we still are missing perhaps more important other builds.

@koivunej
Copy link
Collaborator Author

@fetchadd another follow-up. the changes are a bit a gnarly to read with some back and forth. If you are interested in reviewing and have trouble seeing whats going on, perhaps splitting the commit range at a2793f3 or the introduction of spawn_blocking is helpful.

@fetchadd
Copy link
Contributor

fetchadd commented Jan 12, 2021

I have read the codes, amazing changes has been made from the original 👍 . I have only one doubt now, that is the atomic of the list method. The is_pinned, insert_direct_pin... methods use transaction that do the operations like db.lock(); db.read_or_write(); db.unlock(), which make the sequence of operations be atomic and isolated. As the transaction of sled has no range to iter the keys, we have to use db.range, but it is not atomic and isolated, example like this can show this, so, will there be something bad?

By the way, a senior ruster is more appropriate for the review :).

@koivunej
Copy link
Collaborator Author

that is the atomic of the list method ... As the transaction of sled has no range to iter the keys

To be fair, I had missed this that there was no TransactionalTree::range. I figured that the atomic reads are not so bad, if we only ever update the tree through transactions. It might end up showing some pins which were added or removed during a listing, but at least from the http api point of view, it is more of an "introspection" use case than anything more serious.

For GC purposes, I am still thinking that an always-up-to-date set of collectable blocks is the way to go, given how I've understood go-ipfs aims to support this more of a stop the world process, but perhaps I am just naive as I haven't thought this through enough. The always up-to-date set of collectable blocks coupled with an LRU of trees would probably be the best solution, but I am guessing even either of those would work fine. Of course with an "LRU of trees" there's the issue of "which tree" in case a block is referenced from multiple but ... Perhaps a way can be found later on.

Also the current method has the issue of the unbounded channel which I had already noted. It's good that you brought this up, I added a bit more of comments in a4515f7.

By the way, a senior ruster is more appropriate for the review :)

I think you have a good POV as having now looked into at least leveldb and sled to comment on the matters, just to make sure the direction seems good. If there are any smaller bugs beign created that'd be a great opportunity to enhance the "common pinstore tests" as I've already noted in some FIXMEs. I'll start doing issues for the FIXMEs perhaps next following this PR.

@koivunej
Copy link
Collaborator Author

All right, lets get this in before #446 (not that the update was ready to go).

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 18, 2021

Build succeeded:

@bors bors bot merged commit d4b13d9 into rs-ipfs:master Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sled pinstore tests deadlock rarely
2 participants