BackupEngine: we can return immediately if GetFileSize failed (#10176)

Summary:
In some case, GetFileSize would be failure in copy_file_cb.
If failure, we can return immediately, the subsequent code
is meaningless, and add a log info let user know that problem
happen here.

Singed-off-by: Yite Gu <ess_gyt@qq.com>

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

Reviewed By: cbi42

Differential Revision: D37510888

Pulled By: ajkr

fbshipit-source-id: 044ad8c45852fd19b8cd564b11f65d40c39e296f
main
yite.gu 3 years ago committed by Facebook GitHub Bot
parent 54f678cd86
commit a9117a3490
  1. 11
      utilities/backup/backup_engine.cc

@ -1453,6 +1453,11 @@ IOStatus BackupEngineImpl::CreateNewBackupWithMetadata(
if (type == kTableFile || type == kBlobFile) { if (type == kTableFile || type == kBlobFile) {
io_st = db_fs_->GetFileSize(src_dirname + "/" + fname, io_options_, io_st = db_fs_->GetFileSize(src_dirname + "/" + fname, io_options_,
&size_bytes, nullptr); &size_bytes, nullptr);
if (!io_st.ok()) {
Log(options_.info_log, "GetFileSize is failed: %s",
io_st.ToString().c_str());
return io_st;
}
} }
EnvOptions src_env_options; EnvOptions src_env_options;
switch (type) { switch (type) {
@ -1479,7 +1484,6 @@ IOStatus BackupEngineImpl::CreateNewBackupWithMetadata(
src_env_options = src_raw_env_options; src_env_options = src_raw_env_options;
break; break;
} }
if (io_st.ok()) {
io_st = AddBackupFileWorkItem( io_st = AddBackupFileWorkItem(
live_dst_paths, backup_items_to_finish, new_backup_id, live_dst_paths, backup_items_to_finish, new_backup_id,
options_.share_table_files && options_.share_table_files &&
@ -1488,9 +1492,8 @@ IOStatus BackupEngineImpl::CreateNewBackupWithMetadata(
size_bytes, db_options.statistics.get(), size_limit_bytes, size_bytes, db_options.statistics.get(), size_limit_bytes,
options_.share_files_with_checksum && options_.share_files_with_checksum &&
(type == kTableFile || type == kBlobFile), (type == kTableFile || type == kBlobFile),
options.progress_callback, "" /* contents */, options.progress_callback, "" /* contents */, checksum_func_name,
checksum_func_name, checksum_val, src_temperature); checksum_val, src_temperature);
}
return io_st; return io_st;
} /* copy_file_cb */, } /* copy_file_cb */,
[&](const std::string& fname, const std::string& contents, [&](const std::string& fname, const std::string& contents,

Loading…
Cancel
Save