Reputation: 300
The doubt is around the namespacing scope of lmdb keys. Are the keys supposed to be unique across an lmdb environment? Or are they supposed to be unique within a DBI? IOW, Can we address two different objects, via the same key, in the same lmdb environment, if they are located under two different dbis?
Analogy, in SQL, a primary key needs to be unique across a table. So, different tables can have the same primary key, eg, 1 which will locate different records depending on which table it is applied to. Is this same use-case possible with lmdb, where in, a key can be reused and it will locate different objects depending on the dbi it is applied to?
analogy2: can-a-uuid-be-reused-in-firestore in firestore, i can store two different objects under the same key, if they are in a different firestore collection.
Upvotes: 0
Views: 341
Reputation: 1443
Questions about LMDB should be directed to the OpenLDAP-technical email list. Stackoverflow is not an LMDB support forum.
Named DBs in LMDB are independent namespaces.
Upvotes: -1
Reputation: 446
The are unique per DBI, unless you use the MDB_DUPSORT
flag when creating the DBI:
http://www.lmdb.tech/doc/group__mdb__dbi__open.html#gae0626566c2562e9007f5c8c9535bab1a
In this case, you may have multiple entries with the same key. They will be sorted by their corresponding values instead. This is especially useful for building secondary indices (where multiple records can have the same index entry).
In your case, where you have 2 records with the same UUID, you could either use sorted duplicates, or store some sort of array structure in the value.
Upvotes: 0