rocksdb/env
anand76 d8fb849b7e Basic RocksDB follower implementation (#12540)
Summary:
A basic implementation of RocksDB follower mode, which opens a remote database (referred to as leader) on a distributed file system by tailing its MANIFEST. It leverages the secondary instance mode, but is different in some key ways -
1. It has its own directory with links to the leader's database
2. Periodically refreshes itself
3. (Future) Snapshot support
4. (Future) Garbage collection of obsolete links
5. (Long term) Memtable replication

There are two main classes implementing this functionality - `DBImplFollower` and `OnDemandFileSystem`. The former is derived from `DBImplSecondary`. Similar to `DBImplSecondary`, it implements recovery and catch up through MANIFEST tailing using the `ReactiveVersionSet`, but does not consider logs. In a future PR, we will implement memtable replication, which will eliminate the need to catch up using logs. In addition, the recovery and catch-up tries to avoid directory listing as repeated metadata operations are expensive.

The second main piece is the `OnDemandFileSystem`, which plugs in as an `Env` for the follower instance and creates the illusion of the follower directory as a clone of the leader directory. It creates links to SSTs on first reference. When the follower tails the MANIFEST and attempts to create a new `Version`, it calls `VerifyFileMetadata` to verify the size of the file, and optionally the unique ID of the file. During this process, links are created which prevent the underlying files from getting deallocated even if the leader deletes the files.

TODOs: Deletion of obsolete links, snapshots, robust checking against misconfigurations, better observability etc.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12540

Reviewed By: jowlyzhang

Differential Revision: D56315718

Pulled By: anand1976

fbshipit-source-id: d19e1aca43a6af4000cb8622a718031b69ebd97b
2024-04-19 19:13:31 -07:00
..
composite_env.cc internal_repo_rocksdb (4372117296613874540) (#12117) 2023-12-04 11:17:32 -08:00
composite_env_wrapper.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
emulated_clock.h Remove 'virtual' when implied by 'override' (#12319) 2024-01-31 13:14:42 -08:00
env.cc Group SST write in flush, compaction and db open with new stats (#11910) 2023-12-29 15:29:23 -08:00
env_basic_test.cc internal_repo_rocksdb (4372117296613874540) (#12117) 2023-12-04 11:17:32 -08:00
env_chroot.cc internal_repo_rocksdb (4372117296613874540) (#12117) 2023-12-04 11:17:32 -08:00
env_chroot.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
env_encryption.cc Remove extra semi colon from internal_repo_rocksdb/repo/env/env_encryption.cc (#12274) 2024-01-24 07:22:49 -08:00
env_encryption_ctr.h Remove extra semi colon from internal_repo_rocksdb/repo/env/env_encryption_ctr.h 2024-01-23 06:07:30 -08:00
env_posix.cc Prefer static_cast in place of most reinterpret_cast (#12308) 2024-02-07 10:44:11 -08:00
env_test.cc Change ReadAsync callback API to remove const from FSReadRequest (#11649) 2024-02-16 09:14:55 -08:00
file_system.cc Group SST write in flush, compaction and db open with new stats (#11910) 2023-12-29 15:29:23 -08:00
file_system_tracer.cc Change ReadAsync callback API to remove const from FSReadRequest (#11649) 2024-02-16 09:14:55 -08:00
file_system_tracer.h Change ReadAsync callback API to remove const from FSReadRequest (#11649) 2024-02-16 09:14:55 -08:00
fs_on_demand.cc Basic RocksDB follower implementation (#12540) 2024-04-19 19:13:31 -07:00
fs_on_demand.h Basic RocksDB follower implementation (#12540) 2024-04-19 19:13:31 -07:00
fs_posix.cc Prefer static_cast in place of most reinterpret_cast (#12308) 2024-02-07 10:44:11 -08:00
fs_readonly.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
fs_remap.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
fs_remap.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
io_posix.cc Change ReadAsync callback API to remove const from FSReadRequest (#11649) 2024-02-16 09:14:55 -08:00
io_posix.h Change ReadAsync callback API to remove const from FSReadRequest (#11649) 2024-02-16 09:14:55 -08:00
io_posix_test.cc Print stack traces on frozen tests in CI (#10828) 2022-10-18 00:35:35 -07:00
mock_env.cc internal_repo_rocksdb (4372117296613874540) (#12117) 2023-12-04 11:17:32 -08:00
mock_env.h Run clang-format on env/ folder (#10859) 2022-10-24 17:54:14 -07:00
mock_env_test.cc internal_repo_rocksdb (4372117296613874540) (#12117) 2023-12-04 11:17:32 -08:00
unique_id_gen.cc Fix windows build errors (rdtsc and fnptr) (#12008) 2023-10-24 16:20:37 -07:00
unique_id_gen.h Internal API for generating semi-random salt (#11331) 2023-06-21 11:32:49 -07:00