fix gather truncate longtext string bug and write opt stats gather history bug

This commit is contained in:
wangt1xiuyi
2023-12-19 05:47:51 +00:00
committed by ob-robot
parent 1dd95354cd
commit 60c6bbb06e
4 changed files with 38 additions and 32 deletions

View File

@ -813,7 +813,7 @@ int ObDbmsStatsUtils::truncate_string_for_opt_stats(const ObObj *old_obj,
} else if (OB_FAIL(sql::ObTextStringHelper::str_to_lob_storage_obj(alloc, str, *tmp_obj))) {
LOG_WARN("failed to convert str to lob", K(ret));
} else {
tmp_obj->set_type(old_obj->get_type());
tmp_obj->set_meta_type(old_obj->get_meta());
new_obj = tmp_obj;
is_truncated = true;
}
@ -854,7 +854,7 @@ int ObDbmsStatsUtils::truncate_string_for_opt_stats(ObObj &obj, ObIAllocator &al
int ret = OB_SUCCESS;
if (ObColumnStatParam::is_valid_opt_col_type(obj.get_type()) && obj.is_string_type()) {
if(obj.is_lob_storage()) {
ObObjType ori_type = obj.get_type();
ObObjMeta ori_meta = obj.get_meta();
ObString str = obj.get_string();
bool can_reuse = false;
if (OB_FAIL(check_text_can_reuse(obj, can_reuse))) {
@ -866,7 +866,7 @@ int ObDbmsStatsUtils::truncate_string_for_opt_stats(ObObj &obj, ObIAllocator &al
} else if (OB_FAIL(sql::ObTextStringHelper::str_to_lob_storage_obj(allocator, str, obj))) {
LOG_WARN("failed to convert str to lob", K(ret));
} else {
obj.set_type(ori_type);
obj.set_meta_type(ori_meta);
LOG_TRACE("Succeed to truncate text obj for opt stats", K(ret), K(obj), K(str));
}
} else {