DeleteRange interface
Summary: Expose DeleteRange() interface since we think the implementation is functionally correct now. Closes https://github.com/facebook/rocksdb/pull/1503 Differential Revision: D4171921 Pulled By: ajkr fbshipit-source-id: 5e21c98
This commit is contained in:
parent
eba99c28e4
commit
489d142808
@ -3,6 +3,7 @@
|
||||
### Public API Change
|
||||
* Options::max_bytes_for_level_multiplier is now a double along with all getters and setters.
|
||||
* Support dynamically change `delayed_write_rate` and `max_total_wal_size` options via SetDBOptions().
|
||||
* Introduce DB::DeleteRange for optimized deletion of large ranges of contiguous keys.
|
||||
|
||||
### New Features
|
||||
* Add avoid_flush_during_shutdown option, which speeds up DB shutdown by not flushing unpersisted data (i.e. with disableWAL = true). Unpersisted data will be lost. The options is dynamically changeable via SetDBOptions().
|
||||
|
@ -5845,6 +5845,14 @@ Status DB::SingleDelete(const WriteOptions& opt,
|
||||
return Write(opt, &batch);
|
||||
}
|
||||
|
||||
Status DB::DeleteRange(const WriteOptions& opt,
|
||||
ColumnFamilyHandle* column_family,
|
||||
const Slice& begin_key, const Slice& end_key) {
|
||||
WriteBatch batch;
|
||||
batch.DeleteRange(column_family, begin_key, end_key);
|
||||
return Write(opt, &batch);
|
||||
}
|
||||
|
||||
Status DB::Merge(const WriteOptions& opt, ColumnFamilyHandle* column_family,
|
||||
const Slice& key, const Slice& value) {
|
||||
WriteBatch batch;
|
||||
|
@ -235,6 +235,25 @@ class DB {
|
||||
return SingleDelete(options, DefaultColumnFamily(), key);
|
||||
}
|
||||
|
||||
// Removes the database entries in the range ["begin_key", "end_key"), i.e.,
|
||||
// including "begin_key" and excluding "end_key". Returns OK on success, and
|
||||
// a non-OK status on error. It is not an error if no keys exist in the range
|
||||
// ["begin_key", "end_key").
|
||||
//
|
||||
// This feature is currently an experimental performance optimization for
|
||||
// deleting very large ranges of contiguous keys. Invoking it many times or on
|
||||
// small ranges may severely degrade read performance; in particular, the
|
||||
// resulting performance can be worse than calling Delete() for each key in
|
||||
// the range. Note also the degraded read performance affects keys outside the
|
||||
// deleted ranges, and affects database operations involving scans, like flush
|
||||
// and compaction.
|
||||
//
|
||||
// Consider setting ReadOptions::ignore_range_deletions = true to speed
|
||||
// up reads for key(s) that are known to be unaffected by range deletions.
|
||||
virtual Status DeleteRange(const WriteOptions& options,
|
||||
ColumnFamilyHandle* column_family,
|
||||
const Slice& begin_key, const Slice& end_key);
|
||||
|
||||
// Merge the database entry for "key" with "value". Returns OK on success,
|
||||
// and a non-OK status on error. The semantics of this operation is
|
||||
// determined by the user provided merge_operator when opening DB.
|
||||
|
Loading…
Reference in New Issue
Block a user