Rename kRemoveWithSingleDelete to kPurge (#9951)
Summary: PR 9929 adds a new CompactionFilter::Decision, i.e. kRemoveWithSingleDelete so that CompactionFilter can indicate to CompactionIterator that a PUT can only be removed with SD. However, how CompactionIterator handles such a key is implementation detail which should not be implied in the public API. In fact, such a PUT can just be dropped. This is an optimization which we will apply in the near future. Discussion thread: https://github.com/facebook/rocksdb/pull/9929#discussion_r863198964 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9951 Test Plan: make check Reviewed By: ajkr Differential Revision: D36156590 Pulled By: riversand963 fbshipit-source-id: 7b7d01f47bba4cad7d9cca6ca52984f27f88b372
This commit is contained in:
parent
68ac507f96
commit
9d634dd5b6
@ -14,6 +14,7 @@
|
|||||||
* Add rollback_deletion_type_callback to TransactionDBOptions so that write-prepared transactions know whether to issue a Delete or SingleDelete to cancel a previous key written during prior prepare phase. The PR aims to prevent mixing SingleDeletes and Deletes for the same key that can lead to undefined behaviors for write-prepared transactions.
|
* Add rollback_deletion_type_callback to TransactionDBOptions so that write-prepared transactions know whether to issue a Delete or SingleDelete to cancel a previous key written during prior prepare phase. The PR aims to prevent mixing SingleDeletes and Deletes for the same key that can lead to undefined behaviors for write-prepared transactions.
|
||||||
* EXPERIMENTAL: Add new API AbortIO in file_system to abort the read requests submitted asynchronously.
|
* EXPERIMENTAL: Add new API AbortIO in file_system to abort the read requests submitted asynchronously.
|
||||||
* CompactionFilter::Decision has a new value: kRemoveWithSingleDelete. If CompactionFilter returns this decision, then CompactionIterator will use `SingleDelete` to mark a key as removed.
|
* CompactionFilter::Decision has a new value: kRemoveWithSingleDelete. If CompactionFilter returns this decision, then CompactionIterator will use `SingleDelete` to mark a key as removed.
|
||||||
|
* Renamed CompactionFilter::Decision::kRemoveWithSingleDelete to kPurge since the latter sounds more general and hides the implementation details of how compaction iterator handles keys.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
* RocksDB calls FileSystem::Poll API during FilePrefetchBuffer destruction which impacts performance as it waits for read requets completion which is not needed anymore. Calling FileSystem::AbortIO to abort those requests instead fixes that performance issue.
|
* RocksDB calls FileSystem::Poll API during FilePrefetchBuffer destruction which impacts performance as it waits for read requets completion which is not needed anymore. Calling FileSystem::AbortIO to abort those requests instead fixes that performance issue.
|
||||||
|
@ -307,7 +307,7 @@ bool CompactionIterator::InvokeFilterIfNeeded(bool* need_skip,
|
|||||||
// no value associated with delete
|
// no value associated with delete
|
||||||
value_.clear();
|
value_.clear();
|
||||||
iter_stats_.num_record_drop_user++;
|
iter_stats_.num_record_drop_user++;
|
||||||
} else if (filter == CompactionFilter::Decision::kRemoveWithSingleDelete) {
|
} else if (filter == CompactionFilter::Decision::kPurge) {
|
||||||
// convert the current key to a single delete; key_ is pointing into
|
// convert the current key to a single delete; key_ is pointing into
|
||||||
// current_key_ at this point, so updating current_key_ updates key()
|
// current_key_ at this point, so updating current_key_ updates key()
|
||||||
ikey_.type = kTypeSingleDeletion;
|
ikey_.type = kTypeSingleDeletion;
|
||||||
|
@ -998,7 +998,7 @@ TEST_F(DBTestCompactionFilter, DropKeyWithSingleDelete) {
|
|||||||
std::string* /*new_value*/,
|
std::string* /*new_value*/,
|
||||||
std::string* /*skip_until*/) const override {
|
std::string* /*skip_until*/) const override {
|
||||||
if (key.starts_with("b")) {
|
if (key.starts_with("b")) {
|
||||||
return Decision::kRemoveWithSingleDelete;
|
return Decision::kPurge;
|
||||||
}
|
}
|
||||||
return Decision::kRemove;
|
return Decision::kRemove;
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,7 @@ class DbStressCompactionFilter : public CompactionFilter {
|
|||||||
key_mutex->Unlock();
|
key_mutex->Unlock();
|
||||||
|
|
||||||
if (!key_exists) {
|
if (!key_exists) {
|
||||||
return allow_overwrite ? Decision::kRemove
|
return allow_overwrite ? Decision::kRemove : Decision::kPurge;
|
||||||
: Decision::kRemoveWithSingleDelete;
|
|
||||||
}
|
}
|
||||||
return Decision::kKeep;
|
return Decision::kKeep;
|
||||||
}
|
}
|
||||||
|
@ -39,11 +39,11 @@ class CompactionFilter : public Customizable {
|
|||||||
enum class Decision {
|
enum class Decision {
|
||||||
kKeep,
|
kKeep,
|
||||||
kRemove,
|
kRemove,
|
||||||
kRemoveWithSingleDelete,
|
|
||||||
kChangeValue,
|
kChangeValue,
|
||||||
kRemoveAndSkipUntil,
|
kRemoveAndSkipUntil,
|
||||||
kChangeBlobIndex, // used internally by BlobDB.
|
kChangeBlobIndex, // used internally by BlobDB.
|
||||||
kIOError, // used internally by BlobDB.
|
kIOError, // used internally by BlobDB.
|
||||||
|
kPurge, // used for keys that can only be SingleDelete'ed
|
||||||
kUndetermined,
|
kUndetermined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user