From f683905fcd720f28165bb25036de3fdfed2346e5 Mon Sep 17 00:00:00 2001 From: wxhwang Date: Wed, 8 Nov 2023 15:43:29 +0000 Subject: [PATCH] handle io limit --- .../src/lib/restore/ob_storage_oss_base.cpp | 26 ++++++++++++++----- .../src/lib/restore/ob_storage_oss_base.h | 1 + src/storage/restore/ob_ls_restore_handler.cpp | 3 ++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/deps/oblib/src/lib/restore/ob_storage_oss_base.cpp b/deps/oblib/src/lib/restore/ob_storage_oss_base.cpp index c2e8a8fb5..cdcd1636b 100644 --- a/deps/oblib/src/lib/restore/ob_storage_oss_base.cpp +++ b/deps/oblib/src/lib/restore/ob_storage_oss_base.cpp @@ -222,6 +222,11 @@ static void convert_io_error(aos_status_t *aos_ret, int &ob_errcode) break; } + case OSS_LIMIT_EXCEEDED: { + ob_errcode = OB_IO_LIMIT; + break; + } + default: { ob_errcode = OB_OSS_ERROR; } @@ -1924,11 +1929,16 @@ int ObStorageOssAppendWriter::do_write(const char *buf, const int64_t size, cons OB_LOG(WARN, "oss object must be appendable", K(ret), KCSTRING(object_type)); } else { char *next_append_position = (char*)(apr_table_get(resp_headers, OSS_NEXT_APPEND_POSITION)); - position = aos_atoi64(next_append_position); - if (0 > position) { - ObString tmp_position_string(next_append_position); + if (OB_ISNULL(next_append_position)) { ret = OB_OSS_ERROR; - OB_LOG(WARN, "invalid append position", K(ret), K(position), K(tmp_position_string)); + OB_LOG(WARN, "next_append_position is not found", K(ret), K_(bucket), K_(object)); + } else { + position = aos_atoi64(next_append_position); + if (0 > position) { + ObString tmp_position_string(next_append_position); + ret = OB_OSS_ERROR; + OB_LOG(WARN, "invalid append position", K(ret), K(position), K(tmp_position_string)); + } } } } @@ -1962,8 +1972,12 @@ int ObStorageOssAppendWriter::do_write(const char *buf, const int64_t size, cons if(OB_NOT_NULL(aos_ret = oss_head_object(oss_option_, &bucket, &object, headers3, &resp_headers))) { if ((0 != aos_status_is_ok(aos_ret))) { char *append_pos_str = (char*)(apr_table_get(resp_headers, OSS_NEXT_APPEND_POSITION)); - int64_t cur_pos = aos_atoi64(append_pos_str); - OB_LOG(WARN, "after append fail, we got the object meta", K(cur_pos)); + if (OB_ISNULL(append_pos_str)) { + OB_LOG(WARN, "after append fail, current append pos is not found"); + } else { + int64_t cur_pos = aos_atoi64(append_pos_str); + OB_LOG(WARN, "after append fail, we got the object meta", K(cur_pos)); + } } } } diff --git a/deps/oblib/src/lib/restore/ob_storage_oss_base.h b/deps/oblib/src/lib/restore/ob_storage_oss_base.h index 2d5b7d10a..eb3efc3a2 100644 --- a/deps/oblib/src/lib/restore/ob_storage_oss_base.h +++ b/deps/oblib/src/lib/restore/ob_storage_oss_base.h @@ -40,6 +40,7 @@ namespace common static const int OSS_OBJECT_NOT_EXIST = 404; static const int OSS_PERMISSION_DENIED = 403; static const int OSS_OBJECT_PWRITE_OFFSET_NOT_MATH = 409; +static const int OSS_LIMIT_EXCEEDED = 503; static const int MD5_STR_LENGTH = 32;//md5 buffer length static const char OSS_META_MD5[] = "x-oss-meta-md5"; const static int64_t AOS_TABLE_INIT_SIZE = 1; diff --git a/src/storage/restore/ob_ls_restore_handler.cpp b/src/storage/restore/ob_ls_restore_handler.cpp index 714d8007e..ed7587203 100644 --- a/src/storage/restore/ob_ls_restore_handler.cpp +++ b/src/storage/restore/ob_ls_restore_handler.cpp @@ -2881,7 +2881,8 @@ void ObLSRestoreResultMgr::set_result(const int result, const share::ObTaskId &t // 1. result_ is OB_SUCCESS; // 2. result_ is retrieable err, but input result is non retrieable err. lib::ObMutexGuard guard(mtx_); - if (OB_EAGAIN == result) { + if (OB_EAGAIN == result + || OB_IO_LIMIT == result) { } else { if (retry_cnt_ >= OB_MAX_RESTORE_RETRY_TIMES) { // avoiding overwrite error code } else if ((!can_retrieable_err(result) && can_retrieable_err(result_))