add warning on DeleteFile() API (#7337)

Summary:
Since we can't land https://github.com/facebook/rocksdb/issues/7336 until the next major release, added a strong warning against the `DeleteFile()` API in the meantime.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7337

Reviewed By: pdillinger

Differential Revision: D23459728

Pulled By: ajkr

fbshipit-source-id: 326cb9b18190386080c35c761a8736d8a877dafb
This commit is contained in:
Andrew Kryczka 2020-09-03 16:40:20 -07:00 committed by Facebook GitHub Bot
parent af54c4092a
commit 40e97b02be
3 changed files with 16 additions and 0 deletions

View File

@ -22,6 +22,7 @@
### Public API Change
* Expose kTypeDeleteWithTimestamp in EntryType and update GetEntryType() accordingly.
* Added file_checksum and file_checksum_func_name to TableFileCreationInfo, which can pass the table file checksum information through the OnTableFileCreated callback during flush and compaction.
* A warning is added to `DB::DeleteFile()` API describing its known problems and deprecation plan.
### Behavior Changes
* File abstraction `FSRandomAccessFile.Prefetch()` default return status is changed from `OK` to `NotSupported`. If the user inherited file doesn't implement prefetch, RocksDB will create internal prefetch buffer to improve read performance.

View File

@ -1344,6 +1344,14 @@ class DB {
// Windows API macro interference
#undef DeleteFile
// WARNING: This API is planned for removal in RocksDB 7.0 since it does not
// operate at the proper level of abstraction for a key-value store, and its
// contract/restrictions are poorly documented. For example, it returns non-OK
// `Status` for non-bottommost files and files undergoing compaction. Since we
// do not plan to maintain it, the contract will likely remain underspecified
// until its removal. Any user is encouraged to read the implementation
// carefully and migrate away from it when possible.
//
// Delete the file name from the db directory and update the internal state to
// reflect that. Supports deletion of sst and log files only. 'name' must be
// path relative to the db directory. eg. 000001.sst, /archive/000003.log

View File

@ -397,6 +397,13 @@ class StackableDB : public DB {
return db_->GetCreationTimeOfOldestFile(creation_time);
}
// WARNING: This API is planned for removal in RocksDB 7.0 since it does not
// operate at the proper level of abstraction for a key-value store, and its
// contract/restrictions are poorly documented. For example, it returns non-OK
// `Status` for non-bottommost files and files undergoing compaction. Since we
// do not plan to maintain it, the contract will likely remain underspecified
// until its removal. Any user is encouraged to read the implementation
// carefully and migrate away from it when possible.
virtual Status DeleteFile(std::string name) override {
return db_->DeleteFile(name);
}