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
main
Andrew Kryczka 4 years ago committed by Facebook GitHub Bot
parent af54c4092a
commit 40e97b02be
  1. 1
      HISTORY.md
  2. 8
      include/rocksdb/db.h
  3. 7
      include/rocksdb/utilities/stackable_db.h

@ -22,6 +22,7 @@
### Public API Change ### Public API Change
* Expose kTypeDeleteWithTimestamp in EntryType and update GetEntryType() accordingly. * 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. * 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 ### 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. * 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.

@ -1344,6 +1344,14 @@ class DB {
// Windows API macro interference // Windows API macro interference
#undef DeleteFile #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 // 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 // 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 // path relative to the db directory. eg. 000001.sst, /archive/000003.log

@ -397,6 +397,13 @@ class StackableDB : public DB {
return db_->GetCreationTimeOfOldestFile(creation_time); 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 { virtual Status DeleteFile(std::string name) override {
return db_->DeleteFile(name); return db_->DeleteFile(name);
} }

Loading…
Cancel
Save