rocksdb/env
Andrew Kryczka 4708a6875c Repair DBs with trailing slash in name
Summary:
Problem:

- `DB::SanitizeOptions` strips trailing slash from `wal_dir` but not `dbname`
- We check whether `wal_dir` and `dbname` refer to the same directory using string equality: https://github.com/facebook/rocksdb/blob/master/db/repair.cc#L258
- Providing `dbname` with trailing slash causes default `wal_dir` to be misidentified as a separate directory.
- Then the repair tries to add all SST files to the `VersionEdit` twice (once for `dbname` dir, once for `wal_dir`) and fails with coredump.

Solution:

- Add a new `Env` function, `AreFilesSame`, which uses device and inode number to check whether files are the same. It's currently only implemented in `PosixEnv`.
- Migrate repair to use `AreFilesSame` to check whether `dbname` and `wal_dir` are same. If unsupported, falls back to string comparison.
Closes https://github.com/facebook/rocksdb/pull/2827

Differential Revision: D5761349

Pulled By: ajkr

fbshipit-source-id: c839d548678b742af1166d60b09abd94e5476238
2017-09-22 12:42:22 -07:00
..
env.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
env_basic_test.cc Move some files under util/ to separate dirs 2017-04-05 19:09:16 -07:00
env_chroot.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
env_chroot.h Change RocksDB License 2017-07-15 16:11:23 -07:00
env_encryption.cc Revert "comment out unused parameters" 2017-07-21 18:26:26 -07:00
env_hdfs.cc Revert "comment out unused parameters" 2017-07-21 18:26:26 -07:00
env_posix.cc Repair DBs with trailing slash in name 2017-09-22 12:42:22 -07:00
env_test.cc Introduce bottom-pri thread pool for large universal compactions 2017-08-03 15:43:29 -07:00
io_posix.cc Revert "comment out unused parameters" 2017-07-21 18:26:26 -07:00
io_posix.h Revert "comment out unused parameters" 2017-07-21 18:26:26 -07:00
mock_env.cc Replace dynamic_cast<> 2017-07-28 16:27:16 -07:00
mock_env.h Change RocksDB License 2017-07-15 16:11:23 -07:00
mock_env_test.cc Move some files under util/ to separate dirs 2017-04-05 19:09:16 -07:00
posix_logger.h Change RocksDB License 2017-07-15 16:11:23 -07:00