From 793f30a8284ec90aaba94c62dbace26b5c4a1c8c Mon Sep 17 00:00:00 2001 From: zhjc1124 Date: Fri, 8 Dec 2023 11:47:27 +0000 Subject: [PATCH] [CP] remove unsafe macro OB_UNIS_DECODEx --- deps/oblib/src/lib/utility/ob_unify_serialize.h | 12 ++---------- src/share/ob_rpc_struct.cpp | 4 ++-- src/share/ob_tablet_autoincrement_param.cpp | 4 ++-- src/sql/session/ob_basic_session_info.cpp | 8 ++++---- src/storage/ob_super_block_struct.cpp | 4 ++-- src/storage/tx/ob_tx_serialization.h | 7 ------- 6 files changed, 12 insertions(+), 27 deletions(-) diff --git a/deps/oblib/src/lib/utility/ob_unify_serialize.h b/deps/oblib/src/lib/utility/ob_unify_serialize.h index e10fafbed..f00aa20fc 100644 --- a/deps/oblib/src/lib/utility/ob_unify_serialize.h +++ b/deps/oblib/src/lib/utility/ob_unify_serialize.h @@ -69,14 +69,6 @@ void finish_check_serialization(); } \ } -#define OB_UNIS_DECODEx(obj) \ - if (OB_SUCC(ret)) { \ - if (OB_FAIL(NS_::decode(buf, data_len, pos, obj))) { \ - RPC_WARN("decode object fail", \ - "name", MSTR(obj), K(data_len), K(pos), K(ret)); \ - } \ - } - #define OB_UNIS_DECODE(obj) \ if (OB_SUCC(ret) && pos < data_len) { \ if (OB_FAIL(NS_::decode(buf, data_len, pos, obj))) { \ @@ -219,8 +211,8 @@ struct EmptyUnisStruct int64_t version = 0; \ int64_t len = 0; \ if (OB_SUCC(ret)) { \ - OB_UNIS_DECODEx(version); \ - OB_UNIS_DECODEx(len); \ + OB_UNIS_DECODE(version); \ + OB_UNIS_DECODE(len); \ CHECK_VERSION_LENGTH(CLS, version, len); \ } \ if (OB_SUCC(ret)) { \ diff --git a/src/share/ob_rpc_struct.cpp b/src/share/ob_rpc_struct.cpp index f16ef592c..e0079ec1e 100755 --- a/src/share/ob_rpc_struct.cpp +++ b/src/share/ob_rpc_struct.cpp @@ -8289,8 +8289,8 @@ int ObBatchCreateTabletArg::skip_unis_array_len(const char *buf, for (int64_t i = 0; OB_SUCC(ret) && i < count; i++) { int64_t version = 0; int64_t len = 0; - OB_UNIS_DECODEx(version); - OB_UNIS_DECODEx(len); + OB_UNIS_DECODE(version); + OB_UNIS_DECODE(len); CHECK_VERSION_LENGTH(1, version, len); pos += len; } diff --git a/src/share/ob_tablet_autoincrement_param.cpp b/src/share/ob_tablet_autoincrement_param.cpp index a59e55f79..a0a4f0bbf 100644 --- a/src/share/ob_tablet_autoincrement_param.cpp +++ b/src/share/ob_tablet_autoincrement_param.cpp @@ -282,8 +282,8 @@ int ObTabletAutoincSeq::deserialize( { int ret = OB_SUCCESS; int64_t len = 0; - OB_UNIS_DECODEx(version_); - OB_UNIS_DECODEx(len); + OB_UNIS_DECODE(version_); + OB_UNIS_DECODE(len); if (OB_SUCC(ret)) { int64_t tmp_pos = 0; if (OB_FAIL(deserialize_(allocator, buf + pos, len, tmp_pos))) { diff --git a/src/sql/session/ob_basic_session_info.cpp b/src/sql/session/ob_basic_session_info.cpp index 7d258719d..51c40d012 100644 --- a/src/sql/session/ob_basic_session_info.cpp +++ b/src/sql/session/ob_basic_session_info.cpp @@ -3974,8 +3974,8 @@ int ObBasicSessionInfo::deserialize_sync_sys_vars(int64_t &deserialize_sys_var_c ret = OB_SUCCESS; int64_t sys_var_version = 0; int64_t sys_var_len = 0; - OB_UNIS_DECODEx(sys_var_version); - OB_UNIS_DECODEx(sys_var_len); + OB_UNIS_DECODE(sys_var_version); + OB_UNIS_DECODE(sys_var_len); if (OB_SUCC(ret)) { pos += sys_var_len; // skip LOG_WARN("invalid sys var id, maybe version is different, skip it", K(sys_var_id)); @@ -4503,8 +4503,8 @@ OB_DEF_DESERIALIZE(ObBasicSessionInfo) ret = OB_SUCCESS; int64_t sys_var_version = 0; int64_t sys_var_len = 0; - OB_UNIS_DECODEx(sys_var_version); - OB_UNIS_DECODEx(sys_var_len); + OB_UNIS_DECODE(sys_var_version); + OB_UNIS_DECODE(sys_var_len); if (OB_SUCC(ret)) { pos += sys_var_len; // 跳过这段数据 LOG_WARN("invalid sys var id, maybe version is different, skip it", K(sys_var_id)); diff --git a/src/storage/ob_super_block_struct.cpp b/src/storage/ob_super_block_struct.cpp index a14f3ff86..df691c490 100644 --- a/src/storage/ob_super_block_struct.cpp +++ b/src/storage/ob_super_block_struct.cpp @@ -318,8 +318,8 @@ int ObTenantSuperBlock::deserialize(const char *buf, const int64_t data_len, int { int ret = OB_SUCCESS; int64_t len = 0; - OB_UNIS_DECODEx(version_); - OB_UNIS_DECODEx(len); + OB_UNIS_DECODE(version_); + OB_UNIS_DECODE(len); if (OB_SUCC(ret)) { if (UNIS_VERSION < version_) { ret = ::oceanbase::common::OB_NOT_SUPPORTED; diff --git a/src/storage/tx/ob_tx_serialization.h b/src/storage/tx/ob_tx_serialization.h index 1a0100fd1..f5fc28801 100644 --- a/src/storage/tx/ob_tx_serialization.h +++ b/src/storage/tx/ob_tx_serialization.h @@ -212,13 +212,6 @@ private: } \ } -#define OB_TX_UNIS_DECODEx(obj, IDX, arg) \ - if (OB_SUCC(ret) && TX_IS_NEED_SER_OR_DE(arg, IDX)) { \ - if (OB_FAIL(NS_::decode(buf, data_len, pos, obj))) { \ - RPC_WARN("decode object fail", "name", MSTR(obj), K(data_len), K(pos), K(ret)); \ - } \ - } - #define OB_TX_UNIS_DECODE(obj, IDX, arg) \ if (OB_SUCC(ret) && TX_IS_NEED_SER_OR_DE(arg, IDX) && pos < data_len) { \ if (OB_FAIL(NS_::decode(buf, data_len, pos, obj))) { \