SST file format incompatibility during RocksDB version downgrade
0 reputation · 07 May 2021, 07:56 UTC
0 reputation · 07 May 2021, 07:56 UTC
RocksDB ensures that newer versions can read SST files created by older versions. However, forward compatibility is not guaranteed. When a database is upgraded to a newer version, the engine may rewrite SST files during compaction or ingestion using a more recent on-disk format version embedded in the file footer.
\nIf a system must be reverted to a previous version after an upgrade has already triggered these rewrites, the older binary will encounter files it cannot parse, leading to a failure to open the database.
\nGiven that recovery typically relies on restoring a snapshot or backup from before the upgrade, there is uncertainty regarding the stability of the SST format across minor version increments.
\nA minor version update in RocksDB does not always maintain the same SST file format version. While backward compatibility (new versions reading old files) is a core guarantee, forward compatibility is not. If a minor version introduces an optimization to the SST footer or block format, any file rewritten by that version will be unreadable by previous releases.
There is no fixed threshold of version increments (e.g., "every three versions") that triggers incompatibility. Instead, incompatibility occurs the moment a release increments the internal on-disk format version. This can happen in any release, including minor updates, if the storage engine's internal layout is modified.
When you upgrade RocksDB, the existing SST files remain in the old format until they are touched. The incompatibility typically triggers after one of the following events occurs under the newer version:
If you attempt to downgrade after these events, the older binary encounters a file footer version it does not recognize and fails to open the database to prevent data corruption.
If you must revert to a previous version, follow these scoped steps:
sst_dump utility (provided with RocksDB) to inspect the footer of your SST files. Compare the format version of a file created by the old version versus one created by the new version.db->CompactRange(column_family, NULL, NULL). Attempt to open that specific directory with the previous binary to verify if the format changed.Required Diagnostic: To provide a more specific compatibility window, please provide the exact version numbers (e.g., v7.1.0 to v7.2.0) you are transitioning between.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.