rocksdb/utilities/persistent_cache
anand76 afa2420c2b Introduce a new storage specific Env API (#5761)
Summary:
The current Env API encompasses both storage/file operations, as well as OS related operations. Most of the APIs return a Status, which does not have enough metadata about an error, such as whether its retry-able or not, scope (i.e fault domain) of the error etc., that may be required in order to properly handle a storage error. The file APIs also do not provide enough control over the IO SLA, such as timeout, prioritization, hinting about placement and redundancy etc.

This PR separates out the file/storage APIs from Env into a new FileSystem class. The APIs are updated to return an IOStatus with metadata about the error, as well as to take an IOOptions structure as input in order to allow more control over the IO.

The user can set both ```options.env``` and ```options.file_system``` to specify that RocksDB should use the former for OS related operations and the latter for storage operations. Internally, a ```CompositeEnvWrapper``` has been introduced that inherits from ```Env``` and redirects individual methods to either an ```Env``` implementation or the ```FileSystem``` as appropriate. When options are sanitized during ```DB::Open```, ```options.env``` is replaced with a newly allocated ```CompositeEnvWrapper``` instance if both env and file_system have been specified. This way, the rest of the RocksDB code can continue to function as before.

This PR also ports PosixEnv to the new API by splitting it into two - PosixEnv and PosixFileSystem. PosixEnv is defined as a sub-class of CompositeEnvWrapper, and threading/time functions are overridden with Posix specific implementations in order to avoid an extra level of indirection.

The ```CompositeEnvWrapper``` translates ```IOStatus``` return code to ```Status```, and sets the severity to ```kSoftError``` if the io_status is retryable. The error handling code in RocksDB can then recover the DB automatically.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5761

Differential Revision: D18868376

Pulled By: anand1976

fbshipit-source-id: 39efe18a162ea746fabac6360ff529baba48486f
2019-12-13 14:48:41 -08:00
..
block_cache_tier.cc Move some logging related files to logging/ (#5387) 2019-05-31 17:23:59 -07:00
block_cache_tier.h Move some memory related files from util/ to memory/ (#5382) 2019-05-30 17:44:09 -07:00
block_cache_tier_file.cc Introduce a new storage specific Env API (#5761) 2019-12-13 14:48:41 -08:00
block_cache_tier_file.h Introduce a new storage specific Env API (#5761) 2019-12-13 14:48:41 -08:00
block_cache_tier_file_buffer.h Move some memory related files from util/ to memory/ (#5382) 2019-05-30 17:44:09 -07:00
block_cache_tier_metadata.cc Fix unused var warnings in Release mode 2017-10-23 14:27:04 -07:00
block_cache_tier_metadata.h Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_table.h Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_table_bench.cc Fix build for linux 2017-12-18 12:28:03 -08:00
hash_table_evictable.h Enable MSVC W4 with a few exceptions. Fix warnings and bugs 2017-10-19 10:57:12 -07:00
hash_table_test.cc Move some memory related files from util/ to memory/ (#5382) 2019-05-30 17:44:09 -07:00
lrulist.h Change RocksDB License 2017-07-15 16:11:23 -07:00
persistent_cache_bench.cc Organizing rocksdb/table directory by format 2019-05-30 14:51:11 -07:00
persistent_cache_test.cc Fix block cache ID uniqueness for Windows builds (#5844) 2019-10-11 18:19:31 -07:00
persistent_cache_test.h Move some memory related files from util/ to memory/ (#5382) 2019-05-30 17:44:09 -07:00
persistent_cache_tier.cc Apply formatter to recent 200+ commits. (#5830) 2019-09-20 12:04:26 -07:00
persistent_cache_tier.h fix compilation with g++ option -Wsuggest-override (#4272) 2018-08-14 15:13:10 -07:00
persistent_cache_util.h Fix MyRocks compile warnings-treated-as-errors on Fedora 30, gcc 9.1.1 (#5553) 2019-07-12 17:30:51 -07:00
volatile_tier_impl.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
volatile_tier_impl.h Change RocksDB License 2017-07-15 16:11:23 -07:00