rocksdb - How to ensure consistent reads relative to rocksdb backup state
问题描述
I have a RocksDB
instance which I'm backing up using BackupEngine
. This backup then goes to S3. I'd like to also write some metadata to S3, as a separate, light file that can be used to at a glance understand the contents of the backup.
This metadata is already saved in the database itself, so all I need to do is read the data from the db, and write it to S3. My concern is how to make sure my metadata is consistent with the state of the backup; if I read before backing up, my metadata might be stale. If I read after the backup, my metadata might be ahead. What's the right way to read "from the backup" (i.e. to read the same db state the backup reads), without literally restoring the backup into a new instance?
I've read the documentation on Checkpoints
and also this question which says:
The process of copying the files from the database to the backup, is protected from modifications happening on the database while the call is active, by creating a
rocksdb::Checkpoint
[...]
I could make a Checkpoint
, and read my metadata from it, and the Checkpoints documentation says you can use a Checkpoint to backup a database, but I don't see a way to do that via BackupEngine
. So I'm looking for a clean solution which lets me guarantee my db backup and my metadata read from the db are reading exactly the same state.
解决方案
推荐阅读
- filesystems - 是否可以在任何地方创建 >8 EiB 稀疏文件?
- flask - Flask WTForms Form 自动内联样式显示:无
- android - 在 JNI 中提取 SensorEvent
- python - python将(“”)加倍到(“”“”)我该如何解决这个问题
- c# - 使用计时器和毫秒来淡出表格,但持续时间加倍
- python - youtube-dl 完成下载时运行异步函数(python)
- amazon-web-services - 是否可以通过服务器发送事件使用 AWS S3 存储的电子邮件?
- javascript - 在图片加载之前预加载 JS 计算
- node.js - 使用 node.js 和 Express 时,为什么额外的 / 在地址中会中断链接到图像而不是 html 文件?
- sql - 在 dbgrid 中的子选择 SQL 查询列上写入值