rocksdb/utilities
Andrew Kryczka 6c40806e51 Digest ZSTD compression dictionary once per SST file (#4251)
Summary:
In RocksDB, for a given SST file, all data blocks are compressed with the same dictionary. When we compress a block using the dictionary's raw bytes, the compression library first has to digest the dictionary to get it into a usable form. This digestion work is redundant and ideally should be done once per file.

ZSTD offers APIs for the caller to create and reuse a digested dictionary object (`ZSTD_CDict`). In this PR, we call `ZSTD_createCDict` once per file to digest the raw bytes. Then we use `ZSTD_compress_usingCDict` to compress each data block using the pre-digested dictionary. Once the file's created `ZSTD_freeCDict` releases the resources held by the digested dictionary.

There are a couple other changes included in this PR:

- Changed the parameter object for (un)compression functions from `CompressionContext`/`UncompressionContext` to `CompressionInfo`/`UncompressionInfo`. This avoids the previous pattern, where `CompressionContext`/`UncompressionContext` had to be mutated before calling a (un)compression function depending on whether dictionary should be used. I felt that mutation was error-prone so eliminated it.
- Added support for digested uncompression dictionaries (`ZSTD_DDict`) as well. However, this PR does not support reusing them across uncompression calls for the same file. That work is deferred to a later PR when we will store the `ZSTD_DDict` objects in block cache.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4251

Differential Revision: D9257078

Pulled By: ajkr

fbshipit-source-id: 21b8cb6bbdd48e459f1c62343780ab66c0a64438
2018-08-23 19:28:18 -07:00
..
backupable Add path to WritableFileWriter. (#4039) 2018-08-23 10:12:58 -07:00
blob_db Digest ZSTD compression dictionary once per SST file (#4251) 2018-08-23 19:28:18 -07:00
cassandra Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
checkpoint Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
compaction_filters Comment out unused variables 2018-03-05 13:13:41 -08:00
convenience Change RocksDB License 2017-07-15 16:11:23 -07:00
date_tiered Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
document Suppress clang analyzer error (#4299) 2018-08-21 16:43:05 -07:00
geodb Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
leveldb_options Change RocksDB License 2017-07-15 16:11:23 -07:00
lua Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
memory Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
merge_operators Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
option_change_migration comment unused parameters to turn on -Wunused-parameter flag 2018-04-12 17:59:16 -07:00
options Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
persistent_cache fix compilation with g++ option -Wsuggest-override (#4272) 2018-08-14 15:13:10 -07:00
redis Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
simulator_cache Add path to WritableFileWriter. (#4039) 2018-08-23 10:12:58 -07:00
spatialdb Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
table_properties_collectors Reduce runtime of compact_on_deletion_collector_test (#4117) 2018-07-11 23:41:58 -07:00
trace Add path to WritableFileWriter. (#4039) 2018-08-23 10:12:58 -07:00
transactions Suppress clang analyzer error (#4299) 2018-08-21 16:43:05 -07:00
ttl Per-thread unique test db names (#4135) 2018-07-13 17:27:39 -07:00
write_batch_with_index WriteUnPrepared: Implement unprepared batches for transactions (#4104) 2018-07-24 00:13:18 -07:00
col_buf_decoder.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
col_buf_decoder.h Comment out unused variables 2018-03-05 13:13:41 -08:00
col_buf_encoder.cc fix shift UBSAN error in col_buf_encoder.cc 2018-02-20 16:44:00 -08:00
col_buf_encoder.h Change RocksDB License 2017-07-15 16:11:23 -07:00
column_aware_encoding_exp.cc fix memory leak in two_level_iterator 2018-04-15 17:26:26 -07:00
column_aware_encoding_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
column_aware_encoding_util.cc Digest ZSTD compression dictionary once per SST file (#4251) 2018-08-23 19:28:18 -07:00
column_aware_encoding_util.h Move prefix_extractor to MutableCFOptions 2018-05-21 14:43:11 -07:00
debug.cc GetAllKeyVersions() to take an extra argument of max_num_ikeys. (#4271) 2018-08-16 15:57:08 -07:00
env_librados_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
env_librados.cc Suppress lint in old files 2018-01-29 12:56:42 -08:00
env_librados.md Add EnvLibrados - RocksDB Env of RADOS (#1222) 2016-07-21 11:16:34 -07:00
env_mirror_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
env_mirror.cc Add path to WritableFileWriter. (#4039) 2018-08-23 10:12:58 -07:00
env_timed_test.cc fix memory leak in two_level_iterator 2018-04-15 17:26:26 -07:00
env_timed.cc comment unused parameters to turn on -Wunused-parameter flag 2018-04-12 17:59:16 -07:00
merge_operators.h Support StringAppendOperator(delimiter_char) constructor in java-api 2018-03-08 16:17:47 -08:00
object_registry_test.cc fix memory leak in two_level_iterator 2018-04-15 17:26:26 -07:00
util_merge_operators_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00