Refactor object storage multipart upload interface to distinguish close, complete and abort operations

This commit is contained in:
obdev
2024-02-10 04:27:55 +00:00
committed by ob-robot
parent bef3ebb26f
commit 7da0974a40
28 changed files with 506 additions and 144 deletions

View File

@ -402,6 +402,18 @@ int ObBackupDataCtx::close()
} else if (OB_FAIL(file_write_ctx_.close())) {
LOG_WARN("failed to close file writer", K(ret));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(dev_handle_->complete(io_fd_))) {
LOG_WARN("fail to complete multipart upload", K(ret), K_(dev_handle), K_(io_fd));
}
} else {
if (OB_TMP_FAIL(dev_handle_->abort(io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to abort multipart upload", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));
}
}
if (OB_TMP_FAIL(util.close_device_and_fd(dev_handle_, io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to close device or fd", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));

View File

@ -443,6 +443,17 @@ int ObExternTabletMetaWriter::close()
} else if (OB_FAIL(file_write_ctx_.close())) {
LOG_WARN("failed to close file writer", K(ret));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(dev_handle_->complete(io_fd_))) {
LOG_WARN("fail to complete multipart upload", K(ret), K_(dev_handle), K_(io_fd));
}
} else {
if (OB_TMP_FAIL(dev_handle_->abort(io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to abort multipart upload", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));
}
}
if (OB_TMP_FAIL(util.close_device_and_fd(dev_handle_, io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to close device or fd", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));

View File

@ -827,6 +827,16 @@ int ObBackupMacroBlockIndexMerger::merge_index()
if (OB_NOT_NULL(fuser)) {
ObLSBackupFactory::free(fuser);
}
if (OB_SUCC(ret)) {
if (OB_FAIL(dev_handle_->complete(io_fd_))) {
LOG_WARN("fail to complete multipart upload", K(ret), K_(dev_handle), K_(io_fd));
}
} else {
if (OB_TMP_FAIL(dev_handle_->abort(io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to abort multipart upload", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));
}
}
if (OB_TMP_FAIL(util.close_device_and_fd(dev_handle_, io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to close device or fd", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));
@ -1338,6 +1348,16 @@ int ObBackupMetaIndexMerger::merge_index()
}
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(dev_handle_->complete(io_fd_))) {
LOG_WARN("fail to complete multipart upload", K(ret), K_(dev_handle), K_(io_fd));
}
} else {
if (OB_TMP_FAIL(dev_handle_->abort(io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to abort multipart upload", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));
}
}
if (OB_TMP_FAIL(util.close_device_and_fd(dev_handle_, io_fd_))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to close device or fd", K(ret), K(tmp_ret), K_(dev_handle), K_(io_fd));

View File

@ -5559,7 +5559,16 @@ int ObLSBackupComplementLogTask::transfer_clog_file_(const ObBackupPath &src_pat
break;
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(device_handle->complete(fd))) {
LOG_WARN("fail to complete multipart upload", K(ret), K(device_handle), K(fd));
}
} else {
if (OB_TMP_FAIL(device_handle->abort(fd))) {
ret = COVER_SUCC(tmp_ret);
LOG_WARN("fail to abort multipart upload", K(ret), K(tmp_ret), K(device_handle), K(fd));
}
}
if (OB_SUCCESS != (tmp_ret = util.close_device_and_fd(device_handle, fd))) {
LOG_WARN("fail to close file", K(ret), K_(backup_dest), K(dst_path));
ret = OB_SUCCESS == ret ? tmp_ret : ret;