-
Notifications
You must be signed in to change notification settings - Fork 212
RocksDB best practices
Column-family tables are not supported by LevelDB (RocksDB) repair tool, so it is better to avoid it unless all the data in the table, including the data in different column families, must be consistent.
If the data in column-family tables must be consistent between families, make sure the atomic flush option is set; this will make RocksDB dump and flush all the data for all the column families at the same time, ensuring consistency.
RocksDB relies on OS-level mechanisms in order to sync data to the disk, but in case of hardware issues this will not help, as the data will be lost with the OS reboot. In order to reduce the chance of losing the data, perform periodic memtables flushes and write-ahead logs syncs, that will force OS to sync data to the disk. The interval between sync calls is a tradeoff between speed and reliability.
Sync mode will dump all the data to the disk every time the data is written to the table. In some scenarios this is the desired behavior.
Repair tool most likely will not do what you expect: it will read the database MANIFEST and try to rebuild it reading the data from memtables found on disk. In case the memtable file is corrupted, it will ignore it and move forward. If you really want to try the reapir tool, ensure the data is backed up first and then check for orphan memtable files on disk (those will be copied into separate directory). Note, that repair tool will always ignore column families except the very first one.