mongodb-partners/mongo-rocks

What key/value Pair is used in mongo-rocks?

Opened this issue · 2 comments

Couldn't understand what key/value pair is used inside mongo-rocks?

while connecting mongodb with rocksdb,
Which attribute is Key?

Which attribute is Value?

For data ident, rocksdb user-key is formated as

[4Byte CollectionPrefix][8Byte RecordId]

RecordId is a collection(or table in SQL) level global incremental unique field to identify a row.
value is simplely formated as the raw bson data user inserted.
For index ident, things are a little more complex, it depends on the index-type, unque or not, and so on.
Take a simple but not precise example, rocksdb user-key is formated as

[4Byte IndexPrefix][var len KeyString]

KeyString is an internal datastructure used in mongodb to represent the index data in an ordered way.