rocksdb/util
Sagar Vemuri 04c11b867d 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-02 22:14:28 -07:00
..
aligned_buffer.h Align SST file data blocks to avoid spanning multiple pages 2018-03-26 20:26:10 -07:00
allocator.h Change RocksDB License 2017-07-15 16:11:23 -07:00
arena_test.cc arena: derive alignment unit from std::max_align_t 2017-10-17 11:13:19 -07:00
arena.cc fix advance reservation of arena block addresses 2018-02-15 19:41:52 -08:00
arena.h arena: derive alignment unit from std::max_align_t 2017-10-17 11:13:19 -07:00
auto_roll_logger_test.cc Add a Close() method to DB to return status when closing a db 2018-01-16 11:08:57 -08:00
auto_roll_logger.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
auto_roll_logger.h Fix the Logger::Close() and DBImpl::Close() design pattern 2018-02-23 13:57:26 -08:00
autovector_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
autovector.h Change RocksDB License 2017-07-15 16:11:23 -07:00
bloom_test.cc fix gflags namespace 2017-12-01 10:42:05 -08:00
bloom.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
build_version.cc.in Makefile: generate util/build_version.cc from .in file (#1384) 2016-10-25 11:31:39 -07:00
build_version.h Change RocksDB License 2017-07-15 16:11:23 -07:00
cast_util.h Add a missing "once" in .h 2017-07-31 12:12:03 -07:00
channel.h Change RocksDB License 2017-07-15 16:11:23 -07:00
coding_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
coding.cc Enable MSVC W4 with a few exceptions. Fix warnings and bugs 2017-10-19 10:57:12 -07:00
coding.h Change RocksDB License 2017-07-15 16:11:23 -07:00
compaction_job_stats_impl.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
comparator.cc Move ~Comparator define to comparator.h 2017-10-17 09:58:13 -07:00
compression.h Update 64-bit shift in compression.h 2018-03-30 11:28:05 -07:00
concurrent_arena.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
concurrent_arena.h util: Fix coverity issues 2017-11-03 14:42:08 -07:00
core_local.h Change RocksDB License 2017-07-15 16:11:23 -07:00
crc32c_ppc_asm.S Updated CRC32 Power Optimization Changes 2017-08-31 14:16:30 -07:00
crc32c_ppc_constants.h Make it explicit blob db doesn't support CF 2017-09-08 11:11:04 -07:00
crc32c_ppc.c Updated CRC32 Power Optimization Changes 2017-08-31 14:16:30 -07:00
crc32c_ppc.h Updated CRC32 Power Optimization Changes 2017-08-31 14:16:30 -07:00
crc32c_test.cc Port 3 way SSE4.2 crc32c implementation from Folly 2017-12-19 18:26:49 -08:00
crc32c.cc Suppress UBSAN error in finer guanularity 2018-02-13 12:18:07 -08:00
crc32c.h Updated CRC32 Power Optimization Changes 2017-08-31 14:16:30 -07:00
delete_scheduler_test.cc SstFileManager: add bytes_max_delete_chunk 2018-03-22 15:58:37 -07:00
delete_scheduler.cc SstFileManager: add bytes_max_delete_chunk 2018-03-22 15:58:37 -07:00
delete_scheduler.h SstFileManager: add bytes_max_delete_chunk 2018-03-22 15:58:37 -07:00
duplicate_detector.h WritePrepared Txn: Move DuplicateDetector to util 2018-03-05 23:57:12 -08:00
dynamic_bloom_test.cc fix gflags namespace 2017-12-01 10:42:05 -08:00
dynamic_bloom.cc Use nullptr instead of NULL / 0 more consistently. 2018-03-07 12:42:12 -08:00
dynamic_bloom.h Enable MSVC W4 with a few exceptions. Fix warnings and bugs 2017-10-19 10:57:12 -07:00
event_logger_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
event_logger.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
event_logger.h Change RocksDB License 2017-07-15 16:11:23 -07:00
fault_injection_test_env.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
fault_injection_test_env.h Fix FaultInjectionTestEnv to work with DirectIO 2018-03-14 00:57:24 -07:00
file_reader_writer_test.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
file_reader_writer.cc Align SST file data blocks to avoid spanning multiple pages 2018-03-26 20:26:10 -07:00
file_reader_writer.h Align SST file data blocks to avoid spanning multiple pages 2018-03-26 20:26:10 -07:00
file_util.cc support multiple db_paths in SstFileManager 2018-03-06 12:43:51 -08:00
file_util.h Change RocksDB License 2017-07-15 16:11:23 -07:00
filelock_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
filename.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
filename.h Change RocksDB License 2017-07-15 16:11:23 -07:00
filter_policy.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
gflags_compat.h fix gflags namespace 2017-12-01 10:42:05 -08:00
hash_map.h Change RocksDB License 2017-07-15 16:11:23 -07:00
hash_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
hash.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
hash.h Change RocksDB License 2017-07-15 16:11:23 -07:00
heap_test.cc fix gflags namespace 2017-12-01 10:42:05 -08:00
heap.h Change RocksDB License 2017-07-15 16:11:23 -07:00
kv_map.h Change RocksDB License 2017-07-15 16:11:23 -07:00
log_buffer.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
log_buffer.h Change RocksDB License 2017-07-15 16:11:23 -07:00
log_write_bench.cc fix gflags namespace 2017-12-01 10:42:05 -08:00
logging.h Change RocksDB License 2017-07-15 16:11:23 -07:00
memory_usage.h Change RocksDB License 2017-07-15 16:11:23 -07:00
murmurhash.cc Suppress UBSAN error in finer guanularity 2018-02-13 12:18:07 -08:00
murmurhash.h Change RocksDB License 2017-07-15 16:11:23 -07:00
mutexlock.h Change RocksDB License 2017-07-15 16:11:23 -07:00
ppc-opcode.h Updated CRC32 Power Optimization Changes 2017-08-31 14:16:30 -07:00
random.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
random.h Change RocksDB License 2017-07-15 16:11:23 -07:00
rate_limiter_test.cc rate limit auto-tuning 2017-10-04 19:15:01 -07:00
rate_limiter.cc rate limit auto-tuning 2017-10-04 19:15:01 -07:00
rate_limiter.h rate limit auto-tuning 2017-10-04 19:15:01 -07:00
set_comparator.h WritePrepared Txn: Move DuplicateDetector to util 2018-03-05 23:57:12 -08:00
slice_transform_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
slice.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
sst_file_manager_impl.cc Enable cancelling manual compactions if they hit the sfm size limit 2018-04-02 19:58:04 -07:00
sst_file_manager_impl.h Enable cancelling manual compactions if they hit the sfm size limit 2018-04-02 19:58:04 -07:00
status_message.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
status.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
stderr_logger.h Change RocksDB License 2017-07-15 16:11:23 -07:00
stop_watch.h Change RocksDB License 2017-07-15 16:11:23 -07:00
string_util.cc Several small "fixes" 2018-02-15 16:57:37 -08:00
string_util.h Change RocksDB License 2017-07-15 16:11:23 -07:00
sync_point_impl.cc Refactor sync_point to make implementation either customizable or replaceable 2018-03-23 12:56:52 -07:00
sync_point_impl.h Refactor sync_point to make implementation either customizable or replaceable 2018-03-23 12:56:52 -07:00
sync_point.cc Refactor sync_point to make implementation either customizable or replaceable 2018-03-23 12:56:52 -07:00
sync_point.h Refactor sync_point to make implementation either customizable or replaceable 2018-03-23 12:56:52 -07:00
testharness.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
testharness.h Change RocksDB License 2017-07-15 16:11:23 -07:00
testutil.cc Level Compaction with TTL 2018-04-02 22:14:28 -07:00
testutil.h Comment out unused variables 2018-03-05 13:13:41 -08:00
thread_list_test.cc Use nullptr instead of NULL / 0 more consistently. 2018-03-07 12:42:12 -08:00
thread_local_test.cc Comment out unused variables 2018-03-05 13:13:41 -08:00
thread_local.cc util: Fix coverity issues 2017-11-03 14:42:08 -07:00
thread_local.h Fix deadlock in ColumnFamilyData::InstallSuperVersion() 2018-02-16 08:13:34 -08:00
thread_operation.h Change RocksDB License 2017-07-15 16:11:23 -07:00
threadpool_imp.cc fix ThreadStatus for bottom-pri compaction threads 2017-12-14 14:57:49 -08:00
threadpool_imp.h Change RocksDB License 2017-07-15 16:11:23 -07:00
timer_queue_test.cc Change RocksDB License 2017-07-15 16:11:23 -07:00
timer_queue.h Change RocksDB License 2017-07-15 16:11:23 -07:00
transaction_test_util.cc Windows cumulative patch 2018-03-06 11:57:43 -08:00
transaction_test_util.h WritePrepared Txn: stress test 2017-12-06 09:42:28 -08:00
xxhash.cc fixed typo 2017-06-05 11:27:34 -07:00
xxhash.h Prevent xxhash symbols from polluting global namespace 2015-03-12 12:07:10 -07:00