-
Notifications
You must be signed in to change notification settings - Fork 39
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
Expose FoundationDB versionstamp in API #926
Comments
That makes sense could this be solved via the secondary index functionality? We currently have That would give you the ordering you the commit order. I'm not sure on exposing the |
Or we can expose versionstamp as one of the primary key alternatives? Similar to what you have described we can call it "sequencer/commitOrder" and then if this is set in the schema then we fill it |
Along with So user can define it in the models like this:
It translates to the following in the schema:
The updated_at and created_at annotations behave the same as for wall time. On the lower level we persist it at the known offset in the value, using SetVersionStampedValue, for example right after our For the read version we can return it as a part of begin transaction response, so it's available to the user during the transaction:
|
@efirs One correction to your suggestion, |
Is your feature request related to a problem? Please describe.
Databases that make sequencing simple and easy are in short supply, I can really only think of FoundationDB. It would be nice to add Tigris to the list :)
NOLA leverages this FDB functionality to ensure linearizability of actor invocations: https://github.com/richardartoul/nola/tree/master/proofs/stateright/activation-cache
Setting the commit version in the key/value will also be useful for implementing systems where ordering matters (like a journaling or FIFO queing system for example).
Describe the solution you'd like
I'd like to be able to read the FDB transaction's readversion in my transaction and provide a placeholder value in my primary key and document values that will be filled in with the commit version at commit time. Specifically the Tigris transaction object should expose a GetReadVersion similar to this method.
In addition, the logical equivalent of SetVersionStampedKey() and SetVersionStampedValue() should also be exposed.
I'm not exactly sure what the API should look like, but since the primary key drives the FDB key in tigris, someway to encode the primary ID in such a way that the commit version will be encoded it in a way that makes sense for sorting. I.E I should be able to insert documents into a collection in such a way that they end up ordered by commit order. Ideally this allows the userVersion its to be set as well like this: https://pkg.go.dev/github.com/apple/foundationdb/bindings/[email protected]/src/fdb/tuple#IncompleteVersionstamp and this: https://pkg.go.dev/github.com/apple/foundationdb/bindings/[email protected]/src/fdb/tuple#Tuple.PackWithVersionstamp
For the value, I think just some way to encode it as a "value" in the document should suffice.
Describe alternatives you've considered
I can't think of any way to get commit ordering.
The text was updated successfully, but these errors were encountered: