support bulk insert and drop for kvstore
Categories
(Core :: SQLite and Embedded Database Bindings, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox68 | --- | fixed |
People
(Reporter: nanj, Assigned: nanj)
References
Details
Attachments
(1 file)
As Activity Stream is planning on replacing the json cache files with kvstore, we've found these two features could be helpful for some use cases.
In particular, for a big dataset, bulk insert, i.e. put multiple key/value pairs to the store in a single transaction, will be way more efficient than calling kvstore.put separately on each key/value pair, because there is an implicit transaction involved for each call. This also benefits the consumer with the "all-or-nothing" semantics when the batch insert is desired.
As a dual feature, a drop API, which drops everything in the given store, would be better than calling delete repeatedly if the consumer wants to truncate the store in a single transaction. LMDB has mdb_drop for this, we can add it to rkv and expose it via kvstore.
Comment 1•6 years ago
|
||
Agreed, both bulk insert and drop would be useful. Is bulk insert different from the support for transactions requested in bug 1499238?
Assignee | ||
Comment 2•6 years ago
•
|
||
(In reply to Myk Melez [:myk] [@mykmelez] from comment #1)
Agreed, both bulk insert and drop would be useful. Is bulk insert different from the support for transactions requested in bug 1499238?
Yes, they are related. I was actually commenting this feature request in bug 1499238 first, but then realized that this might want a separate bug on its own.
To implement bulk insert, presumably we will be using cursor plus a write transaction. We can still hide this implementation detail in the kvstore without exposing the transaction to the user at all. And I believe it's better for now than letting the consumers do so with a transaction. I quite like the current API design in kvstore.jsm, it's neat, also hides the unnecessary complexity for the regular uses.
Still trying to wrap my head into this XPCom, hopefully, I can at least help to review some patches, or even better hack on it directly :-)
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
|
||
This adds the bulk insert to kvstore as discussed in Bug 1522638
Updated•6 years ago
|
Comment 5•6 years ago
|
||
bugherder |
Updated•6 months ago
|
Description
•