I'm wondering if the 'snapshot' facility of the LevelDB library can create a snapshot reference that could be saved even after a close of the open database object (and thus reused on a subsequent open).
I suspect not, which leads to a followup: is there a good/recommended way to make a consistent backup of the database as of a snapshot-instant, ideally even while other activity continues? (That is, short of iterating the entire snapshot keyrange via the API?)
(Essentially I'm looking for something analogous to saving aside the append-only JDB log files of BerkeleyDB-JE up through a certain checkpointed place.)
A good approach would be to close the DB, then hard link all the sst files (cp -l) and copy all the non-sst files. This way you only actually copy a small amount of data (size of your log, 4MB by default). Then you can open the DB again.
You do have to block while this happens, but hopefully it should be quick.
I suspect not, which leads to a followup: is there a good/recommended way to make a consistent backup of the database as of a snapshot-instant, ideally even while other activity continues? (That is, short of iterating the entire snapshot keyrange via the API?)
I haven't seen anything in leveldb that would allow you to save the snapshot, aside from doing what you don't really want to do: create a new leveldb instance, iterate over the entire current snapshot key range and write it into the new leveldb instance. Does your situation prevent you from doing that?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With