-
Notifications
You must be signed in to change notification settings - Fork 253
keystore: revamp #1142
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
keystore: revamp #1142
Conversation
60369ab to
3394087
Compare
a7c83de to
8f262c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, but I am concerned about performance given that each bit of the key needs a path separator.
Data stores such a pebble do allow for iterating items by specifying bitwise key prefix bounds (see here). It may be worth providing a way to access this functionality through our datastore/query wrappers so that datastore queries can operate on a bitwise key prefix instead of only a path prefix, for datastores that support it.
Seems like it would doable with go-ds-pebble, here.
We can release the provider keystore as it currently is, or even with this PR if performance does not suffer, and then upgrade to an implementation that does bitwise key prefix iteration later.
|
@gammazero I share your concerns. See #1143 for optimization attempts. Forcing to use pebble might be a good thing (either supplied as option, or a new pebble db is created for the provider)- Using pebble would help reduce the key size, but it would give us prefix matching on bytes (instead of If we need to match on a bitstring on length 7, using pebble, it means we would match absolutely all the keys from the store (because they all match up to the byte that isn't fully covered by the bitstring), and we then need to filter the query results. I am not sure how much of an overhead it represents. In the current solution, we basically match on 4 bits, which is slightly better in that regard, but we have the One other option would be to use separators only for the first (16-32) bits, and then an efficient encoding for the last (224-240) bits. To allow for optimal bit-wise prefix match we could have prefixes using:
In this example we get at most 18 This would allow for efficient bit-wise matching for short prefixes, while remaining compatible with |
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
* keystore: revamp * fix: KeyStore.Close dependencies * keystore: implement KeyStore4
Supersedes #1140
Fixes #1112
Part of #1095
KeyStore Revamp
KeyStore3(winner) implementation from DON'T MERGE: provider: keystore benchmark #1143/-separated key:base/path/f/2/a/...Size()function that will be used for StatsPutandDeleteoperations