diff --git a/HISTORY.md b/HISTORY.md index 16a64832b..4e8cf1680 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -39,6 +39,7 @@ * Made Statistics extend the Customizable class and added a CreateFromString method. Implementations of Statistics need to be registered with the ObjectRegistry and to implement a Name() method in order to be created via this method. * Extended `FlushJobInfo` and `CompactionJobInfo` in listener.h to provide information about the blob files generated by a flush/compaction and garbage collected during compaction in Integrated BlobDB. Added struct members `blob_file_addition_infos` and `blob_file_garbage_infos` that contain this information. * Extended parameter `output_file_names` of `CompactFiles` API to also include paths of the blob files generated by the compaction in Integrated BlobDB. +* Most `BackupEngine` functions now return `IOStatus` instead of `Status`. Most existing code should be compatible with this change but some calls might need to be updated. ## 6.24.0 (2021-08-20) ### Bug Fixes diff --git a/include/rocksdb/utilities/backup_engine.h b/include/rocksdb/utilities/backup_engine.h index c8ad84107..43999c8d0 100644 --- a/include/rocksdb/utilities/backup_engine.h +++ b/include/rocksdb/utilities/backup_engine.h @@ -392,10 +392,10 @@ class BackupEngineReadOnlyBase { virtual Status GetBackupInfo(BackupID backup_id, BackupInfo* backup_info, bool include_file_details = false) const = 0; - // Returns info about backups in backup_info + // Returns info about non-corrupt backups in backup_infos. // Setting include_file_details=true provides information about each // backed-up file in BackupInfo::file_details and more. - virtual void GetBackupInfo(std::vector* backup_info, + virtual void GetBackupInfo(std::vector* backup_infos, bool include_file_details = false) const = 0; // Returns info about corrupt backups in corrupt_backups. @@ -475,13 +475,13 @@ class BackupEngineAppendOnlyBase { // Captures the state of the database by creating a new (latest) backup. // On success (OK status), the BackupID of the new backup is saved to // *new_backup_id when not nullptr. - virtual Status CreateNewBackup(const CreateBackupOptions& options, DB* db, - BackupID* new_backup_id = nullptr) { + virtual IOStatus CreateNewBackup(const CreateBackupOptions& options, DB* db, + BackupID* new_backup_id = nullptr) { return CreateNewBackupWithMetadata(options, db, "", new_backup_id); } // keep here for backward compatibility. - virtual Status CreateNewBackup( + virtual IOStatus CreateNewBackup( DB* db, bool flush_before_backup = false, std::function progress_callback = []() {}) { CreateBackupOptions options; @@ -575,12 +575,12 @@ class BackupEngine : public BackupEngineReadOnlyBase, // BackupEngineOptions have to be the same as the ones used in previous // BackupEngines for the same backup directory. - static Status Open(const BackupEngineOptions& options, Env* db_env, - BackupEngine** backup_engine_ptr); + static IOStatus Open(const BackupEngineOptions& options, Env* db_env, + BackupEngine** backup_engine_ptr); // keep for backward compatibility. - static Status Open(Env* db_env, const BackupEngineOptions& options, - BackupEngine** backup_engine_ptr) { + static IOStatus Open(Env* db_env, const BackupEngineOptions& options, + BackupEngine** backup_engine_ptr) { return BackupEngine::Open(options, db_env, backup_engine_ptr); } @@ -601,11 +601,11 @@ class BackupEngineReadOnly : public BackupEngineReadOnlyBase { public: virtual ~BackupEngineReadOnly() {} - static Status Open(const BackupEngineOptions& options, Env* db_env, - BackupEngineReadOnly** backup_engine_ptr); + static IOStatus Open(const BackupEngineOptions& options, Env* db_env, + BackupEngineReadOnly** backup_engine_ptr); // keep for backward compatibility. - static Status Open(Env* db_env, const BackupEngineOptions& options, - BackupEngineReadOnly** backup_engine_ptr) { + static IOStatus Open(Env* db_env, const BackupEngineOptions& options, + BackupEngineReadOnly** backup_engine_ptr) { return BackupEngineReadOnly::Open(options, db_env, backup_engine_ptr); } }; diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index d1f8fd85e..cc9aa31e0 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -895,7 +895,7 @@ class BackupEngineImplThreadSafe : public BackupEngine, } // Not public API but needed - Status Initialize() { + IOStatus Initialize() { // No locking needed return impl_.Initialize(); } @@ -912,8 +912,8 @@ class BackupEngineImplThreadSafe : public BackupEngine, BackupEngineImpl impl_; }; -Status BackupEngine::Open(const BackupEngineOptions& options, Env* env, - BackupEngine** backup_engine_ptr) { +IOStatus BackupEngine::Open(const BackupEngineOptions& options, Env* env, + BackupEngine** backup_engine_ptr) { std::unique_ptr backup_engine( new BackupEngineImplThreadSafe(options, env)); auto s = backup_engine->Initialize(); @@ -922,7 +922,7 @@ Status BackupEngine::Open(const BackupEngineOptions& options, Env* env, return s; } *backup_engine_ptr = backup_engine.release(); - return Status::OK(); + return IOStatus::OK(); } BackupEngineImpl::BackupEngineImpl(const BackupEngineOptions& options, @@ -2986,10 +2986,11 @@ IOStatus BackupEngineImpl::BackupMeta::StoreToFile( return io_s; } -Status BackupEngineReadOnly::Open(const BackupEngineOptions& options, Env* env, - BackupEngineReadOnly** backup_engine_ptr) { +IOStatus BackupEngineReadOnly::Open(const BackupEngineOptions& options, + Env* env, + BackupEngineReadOnly** backup_engine_ptr) { if (options.destroy_old_data) { - return Status::InvalidArgument( + return IOStatus::InvalidArgument( "Can't destroy old data with ReadOnly BackupEngine"); } std::unique_ptr backup_engine( @@ -3000,7 +3001,7 @@ Status BackupEngineReadOnly::Open(const BackupEngineOptions& options, Env* env, return s; } *backup_engine_ptr = backup_engine.release(); - return Status::OK(); + return IOStatus::OK(); } void TEST_EnableWriteFutureSchemaVersion2(