diff --git a/deps/oblib/src/common/rowkey/ob_rowkey.cpp b/deps/oblib/src/common/rowkey/ob_rowkey.cpp index ae0a84dbd5..ddfcedafc2 100644 --- a/deps/oblib/src/common/rowkey/ob_rowkey.cpp +++ b/deps/oblib/src/common/rowkey/ob_rowkey.cpp @@ -294,7 +294,7 @@ int ObRowkey::serialize(char *buf, const int64_t buf_len, int64_t &pos) const return ret; } -int ObRowkey::deserialize(const char *buf, const int64_t buf_len, int64_t &pos) +int ObRowkey::deserialize(const char *buf, const int64_t buf_len, int64_t &pos, bool check_zero /*= false*/) { int ret = OB_SUCCESS; int64_t obj_cnt = 0; @@ -332,6 +332,9 @@ int ObRowkey::deserialize(const char *buf, const int64_t buf_len, int64_t &pos) KP(buf), K(buf_len), K(pos), K(obj_cnt), K(ret)); } } + } else if (check_zero && obj_cnt == 0) { + // Prevent the reserved obj array not aware the obj is empty when obj_cnt = 0 + obj_cnt_ = obj_cnt; } return ret; } diff --git a/deps/oblib/src/common/rowkey/ob_rowkey.h b/deps/oblib/src/common/rowkey/ob_rowkey.h index e841d3e06e..177a308783 100644 --- a/deps/oblib/src/common/rowkey/ob_rowkey.h +++ b/deps/oblib/src/common/rowkey/ob_rowkey.h @@ -101,7 +101,7 @@ public: int serialize(char *buf, const int64_t buf_len, int64_t &pos) const; int64_t get_serialize_size(void) const; - int deserialize(const char *buf, const int64_t buf_len, int64_t &pos); + int deserialize(const char *buf, const int64_t buf_len, int64_t &pos, bool check_zero = false); int serialize_objs(char *buf, const int64_t buf_len, int64_t &pos) const; int64_t get_serialize_objs_size(void) const; diff --git a/src/share/schema/ob_schema_struct.cpp b/src/share/schema/ob_schema_struct.cpp index d2aece07a3..7a22e43065 100644 --- a/src/share/schema/ob_schema_struct.cpp +++ b/src/share/schema/ob_schema_struct.cpp @@ -5550,7 +5550,11 @@ OB_DEF_DESERIALIZE(ObBasePartition) } LST_DO_CODE(OB_UNIS_DECODE, tenant_id_, table_id_, part_id_, - schema_version_, name, high_bound_val, status_); + schema_version_, name); + if (FAILEDx(high_bound_val.deserialize(buf, data_len, pos, true))) { + LOG_WARN("fail to deserialize high_bound_val", KR(ret)); + } + LST_DO_CODE(OB_UNIS_DECODE, status_); if (OB_FAIL(ret)) { LOG_WARN("Fail to deserialize data, ", K(ret)); } else if (OB_FAIL(deep_copy_str(name, name_))) { @@ -5594,11 +5598,13 @@ OB_DEF_DESERIALIZE(ObBasePartition) part_idx_, is_empty_partition_name_, tablespace_id_, - partition_type_, - low_bound_val, - tablet_id_); + partition_type_); + if (FAILEDx(low_bound_val.deserialize(buf, data_len, pos, true))) { + LOG_WARN("fail to deserialze low_bound_val", KR(ret)); + } + LST_DO_CODE(OB_UNIS_DECODE, tablet_id_); if (OB_SUCC(ret) && OB_FAIL(set_low_bound_val(low_bound_val))) { - LOG_WARN("Fail to deep copy high_bound_val", K(ret), K(low_bound_val)); + LOG_WARN("Fail to deep copy low_bound_val", K(ret), K(low_bound_val)); } return ret; }