mirror of
https://github.com/facebook/rocksdb.git
synced 2026-03-20 06:24:22 +00:00
Page:
Time to Live
Pages
A Tutorial of RocksDB SST formats
Administration and Data Access Tool
Allocating Some Indexes and Bloom Filters using Huge Page TLB
Approximate Size
Articles about Rocks
Asynchronous IO
Atomic flush
Background Error Handling
Basic Operations
Benchmarking tools
BlobDB
Block Cache
Block cache analysis and simulation tools
Building on Windows
Checkpoints
Choose Level Compaction Files
Column Families
Compaction Filter
Compaction Stats and DB Status
Compaction Trivial Move
Compaction
Compression
Creating and Ingesting SST files
CuckooTable Format
Daily Off‐peak Time Option
Data Block Hash Index
Delete A Range Of Keys
Delete Stale Files
DeleteRange Implementation
DeleteRange
Developing with an IDE
Dictionary Compression
Direct IO
EventListener
External Table (Experimental)
FIFO compaction style
Features Not in LevelDB
Full File Checksum and Checksum Handoff
Fuzz Test
Home
How to ask a performance related question
How to backup RocksDB
How to persist in memory RocksDB database
How we keep track of live SST files
IO Tracer and Parser
IO
Implement Queue Service Using RocksDB
Index Block Format
Indexing SST Files for Better Lookup Performance
Iterator Implementation
Iterator
JNI Debugging
Journal
Known Issues
Leveled Compaction
Logger
Logging in RocksJava
Low Priority Write
MANIFEST
Managing Disk Space Utilization
Manual Compaction
MemTable
Memory usage in RocksDB
Mempurge (Memtable Garbage Collection) [Experimental]
Merge Operator Implementation
Merge Operator
Multi Column Family Iterator
MultiGet Performance
Object Registry
Online Verification
Open Projects
Option String and Option Map
Partitioned Index Filters
Perf Context and IO Stats Context
Performance Benchmark 2014
Performance Benchmark 201807
Performance Benchmarks October 2022
Performance Benchmarks
Pipelined Write
PlainTable Format
Platform Requirements
Prefix Seek
Projects Being Developed
Proposal: Unifying Level and Universal Compactions
Proposals on Improving Rocksdb's Options
Publication
Rate Limiter
Read Modify Write Benchmarks
Read only and Secondary instances
Reducing memcpy overhead when using Iterators
Remote Compaction
Replication Helpers
RocksDB Bloom Filter
RocksDB Compatibility Between Different Releases
RocksDB Configurable Objects
RocksDB Contribution Guide
RocksDB Extensions
RocksDB FAQ
RocksDB In Memory Workload Performance Benchmarks
RocksDB Options File
RocksDB Overview
RocksDB Public Communication and Information Channels
RocksDB Release Methodology
RocksDB Repairer
RocksDB Trace, Replay, Analyzer, and Workload Generation
RocksDB Troubleshooting Guide
RocksDB Tuning Guide
RocksDB Users and Use Cases
RocksDB version macros
RocksJava API TODO
RocksJava Basics
RocksJava Performance on Flash Storage
Rocksdb Architecture Guide
Rocksdb BlockBasedTable Format
Rocksdb Table Format
SST File Manager
SST Partitioner
SecondaryCache (Experimental)
SeekForPrev
Setup Options and Basic Tuning
Simulation Cache
Single Delete
Slow Deletion
Snapshot
Space Tuning
Speed Up DB Open
Statistics
Stress test
Subcompaction
Tailing Iterator
Talks
Terminology
Tests
The Customizable Class
Third party language bindings
This is a test
Thread Pool
Tiered Storage (Experimental)
Tiered Storage Benchmarking
Time to Live
Track WAL in MANIFEST
Transactions
Tuning RocksDB from Java
Tuning RocksDB on Spinning Disks
Two Phase Commit Implementation
Universal Compaction
User defined Timestamp
WAL Compression
WAL Performance
WAL Recovery Modes
What's new in RocksDB2.7
Wide Columns
Write Ahead Log (WAL)
Write Ahead Log File Format
Write Batch With Index
Write Buffer Manager
Write Stalls
WritePrepared Transactions
WriteUnprepared Transactions
[To Be Deprecated] Persistent Read Cache
log_format.txt
poc test
poc.html
poc
testpoc.html
unordered_write
No results
6
Time to Live
n-bes edited this page 2021-06-15 10:09:11 +03:00
Rocksdb can be opened with Time to Live(TTL) support
USE-CASES
This API should be used to open the db when key-values inserted are meant to be removed from the db in a non-strict 'ttl' amount of time therefore, this guarantees that key-values inserted will remain in the db for at least ttl amount of time and the db will make efforts to remove the key-values as soon as possible after ttl seconds of their insertion.
BEHAVIOUR
- TTL is accepted in seconds
- (int32_t)Timestamp(creation) is suffixed to values in Put internally
- Expired TTL values are deleted in compaction only:(Timestamp+ttl<time_now)
- Get/Iterator may return expired entries(compaction not run on them yet)
- Different TTL may be used during different Opens
- Example: Open1 at t=0 with ttl=4 and insert k1,k2, close at t=2. Open2 at t=3 with ttl=5. Now k1,k2 should be deleted at t>=5
- read_only=true opens in the usual read-only mode. Compactions will not be triggered(neither manual nor automatic), so no expired entries removed
CONSTRAINTS
Not specifying/passing or non-positive TTL behaves like TTL = infinity
!!!WARNING!!!
- Calling DB::Open directly to re-open a db created by this API will get corrupt values(timestamp suffixed) and no ttl effect will be there during the second Open, so use this API consistently to open the db
- Be careful when passing ttl with a small positive value because the whole database may be deleted in a small amount of time
API
Defined in header <rocksdb/utilities/db_ttl.h>
static Status DBWithTTL::Open(const Options& options, const std::string& name, StackableDB** dbptr,
int32_t ttl = 0, bool read_only = false);