rocksdb/examples
Yanqin Jin 9358178edc Support for single-primary, multi-secondary instances (#4899)
Summary:
This PR allows RocksDB to run in single-primary, multi-secondary process mode.
The writer is a regular RocksDB (e.g. an `DBImpl`) instance playing the role of a primary.
Multiple `DBImplSecondary` processes (secondaries) share the same set of SST files, MANIFEST, WAL files with the primary. Secondaries tail the MANIFEST of the primary and apply updates to their own in-memory state of the file system, e.g. `VersionStorageInfo`.

This PR has several components:
1. (Originally in #4745). Add a `PathNotFound` subcode to `IOError` to denote the failure when a secondary tries to open a file which has been deleted by the primary.

2. (Similar to #4602). Add `FragmentBufferedReader` to handle partially-read, trailing record at the end of a log from where future read can continue.

3. (Originally in #4710 and #4820). Add implementation of the secondary, i.e. `DBImplSecondary`.
3.1 Tail the primary's MANIFEST during recovery.
3.2 Tail the primary's MANIFEST during normal processing by calling `ReadAndApply`.
3.3 Tailing WAL will be in a future PR.

4. Add an example in 'examples/multi_processes_example.cc' to demonstrate the usage of secondary RocksDB instance in a multi-process setting. Instructions to run the example can be found at the beginning of the source code.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4899

Differential Revision: D14510945

Pulled By: riversand963

fbshipit-source-id: 4ac1c5693e6012ad23f7b4b42d3c374fecbe8886
2019-03-26 16:45:31 -07:00
..
.gitignore Support for single-primary, multi-secondary instances (#4899) 2019-03-26 16:45:31 -07:00
c_simple_example.c Change RocksDB License 2017-07-15 16:11:23 -07:00
column_families_example.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
compact_files_example.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
compaction_filter_example.cc Replace dynamic_cast<> 2017-07-28 16:27:16 -07:00
Makefile Support for single-primary, multi-secondary instances (#4899) 2019-03-26 16:45:31 -07:00
multi_processes_example.cc Support for single-primary, multi-secondary instances (#4899) 2019-03-26 16:45:31 -07:00
optimistic_transaction_example.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
options_file_example.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
README.md Improve examples/README.md 2015-12-16 16:27:37 +01:00
rocksdb_option_file_example.ini Pin top-level index on partitioned index/filter blocks (#4037) 2018-06-22 15:27:46 -07:00
simple_example.cc Pinnableslice examples and blog post 2017-08-24 12:26:07 -07:00
transaction_example.cc Change RocksDB License 2017-07-15 16:11:23 -07:00

  1. Compile RocksDB first by executing make static_lib in parent dir
  2. Compile all examples: cd examples/; make all