Finish BackupEngine migration to IOStatus (#8940)

Summary:
Updates a few remaining functions that should have been updated
from Status -> IOStatus, and adds to HISTORY for the overall change
including https://github.com/facebook/rocksdb/issues/8820.

This change is for inclusion in version 6.25.

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

Test Plan: CI

Reviewed By: zhichao-cao

Differential Revision: D31085029

Pulled By: pdillinger

fbshipit-source-id: 91557c6a39ef1d90357d4f4dcd79af0645d87c7b
This commit is contained in:
Peter Dillinger 2021-09-21 11:12:19 -07:00
parent d497cdfbb2
commit e74dfee7fc
3 changed files with 23 additions and 21 deletions

View File

@ -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

View File

@ -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<BackupInfo>* backup_info,
virtual void GetBackupInfo(std::vector<BackupInfo>* 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<void()> 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);
}
};

View File

@ -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<BackupEngineImplThreadSafe> 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<BackupEngineImplThreadSafe> 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(