修复obrowkey反序列化bug导致建多分区表内存膨胀的问题

This commit is contained in:
obdev
2023-07-26 09:12:47 +00:00
committed by ob-robot
parent f8af7ea99a
commit cd9798ae42
3 changed files with 16 additions and 7 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}