Question: Badger num of versions for a key - how to fetch versions back?

I see badger allows keeping multiple versions for a key which is a very cool feature

but how do I get the different versions when I fetch the key again? Get returns an item and a single version method? How do I access all the versions available for a given key?

Hi @asad-awadia, great that you like the multiple versions feature.
In iterator options, you would have to set iterator’s allVersions=true. You can have a look at this test as an example.

1 Like

Hi, Thanks for your answer! I have a question, since bagder is a versioned kv store, is it possible to design a version control system for dgraph on top of that? or at least support some kind of snapshot retrieval?

Another question is that is allVersions is set to true? wouldn’t there be a lot of versions such that they incur a large storage cost?

Thanks for your answer again!!!

Hi @TheCzzZ,

Not sure about the full fledged version control system, but a basic one can be. In managed mode, you can run transactions at specified timestamp and get a view of DB at that point. Badger provides Snapshot Isolation gaurantees. Dgraph uses badger in managed mode and leverages some sort of versioning.
See badger/managed_db.go at 5a96b2cfcb6fcbbd63c2908c6e492bf3b33e5249 · dgraph-io/badger · GitHub

You can SetDiscardTs(). It will clear all the entries below the mentioned ts from the LSM as well as value log files.

1 Like

is it versioning a feature of Cete or it has been implemented only in Badger?

1 Like