rocksdb/include/rocksdb
Sagar Vemuri ce3b2912d2 Level Compaction with TTL
Summary:
Level Compaction with TTL.

As of today, a file could exist in the LSM tree without going through the compaction process for a really long time if there are no updates to the data in the file's key range. For example, in certain use cases, the keys are not actually "deleted"; instead they are just set to empty values. There might not be any more writes to this "deleted" key range, and if so, such data could remain in the LSM for a really long time resulting in wasted space.

Introducing a TTL could solve this problem. Files (and, in turn, data) older than TTL will be scheduled for compaction when there is no other background work. This will make the data go through the regular compaction process and get rid of old unwanted data.
This also has the (good) side-effect of all the data in the non-bottommost level being newer than ttl, and all data in the bottommost level older than ttl. It could lead to more writes while reducing space.

This functionality can be controlled by the newly introduced column family option -- ttl.

TODO for later:
- Make ttl mutable
- Extend TTL to Universal compaction as well? (TTL is already supported in FIFO)
- Maybe deprecate CompactionOptionsFIFO.ttl in favor of this new ttl option.
Closes https://github.com/facebook/rocksdb/pull/3591

Differential Revision: D7275442

Pulled By: sagar0

fbshipit-source-id: dcba484717341200d419b0953dafcdf9eb2f0267
2018-04-13 04:51:17 -07:00
..
utilities WritePrepared Txn: rollback_merge_operands hack 2018-04-12 14:01:54 -07:00
advanced_options.h Level Compaction with TTL 2018-04-13 04:51:17 -07:00
c.h C API for PerfContext 2018-03-21 22:13:34 -07:00
cache.h Comment out unused variables 2018-03-05 13:13:41 -08:00
cleanable.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
compaction_filter.h Comment out unused variables 2018-03-05 13:13:41 -08:00
compaction_job_stats.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
comparator.h Move ~Comparator define to comparator.h 2017-10-17 09:58:13 -07:00
convenience.h Delete files in multiple ranges at once 2018-01-30 13:56:39 -08:00
db_bench_tool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
db_dump_tool.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
db.h allowing CompactFiles to return new file names 2018-03-15 11:58:12 -07:00
env_encryption.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
env.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
experimental.h Change RocksDB License 2017-07-15 16:11:23 -07:00
filter_policy.h Comment out unused variables 2018-03-05 13:13:41 -08:00
flush_block_policy.h Change RocksDB License 2017-07-15 16:11:23 -07:00
iostats_context.h Change RocksDB License 2017-07-15 16:11:23 -07:00
iterator.h Add rocksdb.iterator.internal-key property 2018-02-20 19:12:09 -08:00
ldb_tool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
listener.h Level Compaction with TTL 2018-04-13 04:51:17 -07:00
memtablerep.h InlineSkiplist: don't decode keys unnecessarily during comparisons 2018-03-23 12:14:30 -07:00
merge_operator.h Update comments about MergeOperator::AllowSingleOperand 2018-03-27 17:13:53 -07:00
metadata.h Fix coverity issues in include/rocksdb 2017-11-02 17:56:48 -07:00
options.h Add delay before flush in CompactRange to avoid write stalling 2018-02-12 15:42:47 -08:00
perf_context.h Add lock wait time as a perf context counter 2017-11-06 10:57:19 -08:00
perf_level.h Change RocksDB License 2017-07-15 16:11:23 -07:00
persistent_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
rate_limiter.h Comment out unused variables 2018-03-05 13:13:41 -08:00
slice_transform.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
slice.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
snapshot.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sst_dump_tool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sst_file_manager.h SstFileManager: add bytes_max_delete_chunk 2018-03-22 15:58:37 -07:00
sst_file_writer.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
statistics.h WritePrepared Txn: add stats 2018-04-12 13:56:07 -07:00
status.h Disallow compactions if there isn't enough free space 2018-03-06 16:27:54 -08:00
table_properties.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
table.h Align SST file data blocks to avoid spanning multiple pages 2018-03-26 20:26:10 -07:00
thread_status.h fix ThreadStatus for bottom-pri compaction threads 2017-12-14 14:57:49 -08:00
threadpool.h Change RocksDB License 2017-07-15 16:11:23 -07:00
transaction_log.h Change RocksDB License 2017-07-15 16:11:23 -07:00
types.h Fix WriteBatch rep_ format for RangeDeletion records 2018-01-23 12:57:32 -08:00
universal_compaction.h Change RocksDB License 2017-07-15 16:11:23 -07:00
version.h Update history for future 5.13 release 2018-03-22 14:59:27 -07:00
wal_filter.h Comment out unused variables 2018-03-05 13:13:41 -08:00
write_batch_base.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
write_batch.h Fix some typos in comments and docs. 2018-03-08 10:27:25 -08:00
write_buffer_manager.h Change RocksDB License 2017-07-15 16:11:23 -07:00