@@ -1517,7 +1517,9 @@ impl Options {
1517
1517
///
1518
1518
/// Leveled: files older than `periodic_compaction_seconds` will be picked up
1519
1519
/// for compaction and will be re-written to the same level as they were
1520
- /// before.
1520
+ /// before if level_compaction_dynamic_level_bytes is disabled. Otherwise,
1521
+ /// it will rewrite files to the next level except for the last level files
1522
+ /// to the same level.
1521
1523
///
1522
1524
/// FIFO: not supported. Setting this option has no effect for FIFO compaction.
1523
1525
///
@@ -1529,9 +1531,10 @@ impl Options {
1529
1531
/// UniversalCompactionBuilder::PickPeriodicCompaction().
1530
1532
/// For backward compatibility, the effective value of this option takes
1531
1533
/// into account the value of option `ttl`. The logic is as follows:
1532
- /// - both options are set to 30 days if they have the default value.
1533
- /// - if both options are zero, zero is picked. Otherwise, we take the min
1534
- /// value among non-zero options values (i.e. takes the stricter limit).
1534
+ ///
1535
+ /// - both options are set to 30 days if they have the default value.
1536
+ /// - if both options are zero, zero is picked. Otherwise, we take the min
1537
+ /// value among non-zero options values (i.e. takes the stricter limit).
1535
1538
///
1536
1539
/// One main use of the feature is to make sure a file goes through compaction
1537
1540
/// filters periodically. Users can also use the feature to clear up SST
@@ -1555,13 +1558,50 @@ impl Options {
1555
1558
/// Default: 30 days if using block based table format + compaction filter +
1556
1559
/// leveled compaction or block based table format + universal compaction.
1557
1560
/// 0 (disabled) otherwise.
1558
- ///
1559
1561
pub fn set_periodic_compaction_seconds ( & mut self , secs : u64 ) {
1560
1562
unsafe {
1561
1563
ffi:: rocksdb_options_set_periodic_compaction_seconds ( self . inner , secs) ;
1562
1564
}
1563
1565
}
1564
1566
1567
+ /// This option has different meanings for different compaction styles:
1568
+ ///
1569
+ /// Leveled: Non-bottom-level files with all keys older than TTL will go
1570
+ /// through the compaction process. This usually happens in a cascading
1571
+ /// way so that those entries will be compacted to bottommost level/file.
1572
+ /// The feature is used to remove stale entries that have been deleted or
1573
+ /// updated from the file system.
1574
+ ///
1575
+ /// FIFO: Files with all keys older than TTL will be deleted. TTL is only
1576
+ /// supported if option max_open_files is set to -1.
1577
+ ///
1578
+ /// Universal: users should only set the option `periodic_compaction_seconds`
1579
+ /// instead. For backward compatibility, this option has the same
1580
+ /// meaning as `periodic_compaction_seconds`. See more in comments for
1581
+ /// `periodic_compaction_seconds` on the interaction between these two
1582
+ /// options.
1583
+ ///
1584
+ /// This option only supports block based table format for any compaction
1585
+ /// style.
1586
+ ///
1587
+ /// unit: seconds. Ex: 1 day = 1 * 24 * 60 * 60
1588
+ /// 0 means disabling.
1589
+ /// UINT64_MAX - 1 (0xfffffffffffffffe) is special flag to allow RocksDB to
1590
+ /// pick default.
1591
+ ///
1592
+ /// Default: 30 days if using block based table. 0 (disable) otherwise.
1593
+ ///
1594
+ /// Dynamically changeable
1595
+ /// Note that dynamically changing this option only works for leveled and FIFO
1596
+ /// compaction. For universal compaction, dynamically changing this option has
1597
+ /// no effect, users should dynamically change `periodic_compaction_seconds`
1598
+ /// instead.
1599
+ pub fn set_ttl ( & mut self , secs : u64 ) {
1600
+ unsafe {
1601
+ ffi:: rocksdb_options_set_ttl ( self . inner , secs) ;
1602
+ }
1603
+ }
1604
+
1565
1605
pub fn set_merge_operator_associative < F : MergeFn + Clone > (
1566
1606
& mut self ,
1567
1607
name : impl CStrLike ,
0 commit comments