Summary:
Problem:
In RocksDB, the file id used for block cache key prefix is generated using file inode information (inode device ID, inode number, and inode generation).
However, file systems like XFS and ext4 reuse inodes(inode number, and inode generation), which means the block cache key for new files may point to stale entries from deleted files.
Fix:
The mtime and the checksum of the meta-block are added to the prefix key. The mtime (4 bytes) is finalized once the data is flushed and
remains unchanged even if a hard link is created. The checksum (4 bytes) is calculated based on the meta-block content of the SST file.
With the combination of inode, mtime and checksum, a conflict will be extremely unlikely.
Jira: DB-9839
Test Plan:
1. existing rocksdb unit test.
2. Added a new unit test: ybd tsan --cxx-test table_test --gtest_filter TableTest.BlockCacheWithHardlink --clang17
Reviewers: timur, arybochkin, rthallam
Reviewed By: timur
Subscribers: ybase
Differential Revision: https://phorge.dev.yugabyte.com/D39729