to issue<51998150>:fix core when fetch cursor after this cursor has been closed

This commit is contained in:
obdev
2023-09-08 11:46:26 +08:00
committed by ob-robot
parent 83d8ccce23
commit 7085d97454
2 changed files with 23 additions and 4 deletions

View File

@ -1990,10 +1990,27 @@ int ObPLCursorInfo::deep_copy(ObPLCursorInfo &src, common::ObIAllocator *allocat
} else if (OB_ISNULL(row)) { } else if (OB_ISNULL(row)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("row is null", K(ret)); LOG_WARN("row is null", K(ret));
} else if (OB_FAIL(dest_cursor->row_store_.add_row(*row))) {
LOG_WARN("failed to add row to row store", K(ret));
} else { } else {
++cur; ObNewRow tmp_row = *row;
for (int64_t i = 0; OB_SUCC(ret) && i < tmp_row.get_count(); ++i) {
ObObj& obj = tmp_row.get_cell(i);
ObObj tmp;
if (obj.is_pl_extend()) {
if (OB_FAIL(pl::ObUserDefinedType::deep_copy_obj(*(dest_cursor->allocator_), obj, tmp))) {
LOG_WARN("failed to copy pl extend", K(ret));
} else {
obj = tmp;
dest_cursor->complex_objs_.push_back(tmp);
}
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(dest_cursor->row_store_.add_row(tmp_row))) {
LOG_WARN("failed to add row to row store", K(ret));
} else {
++cur;
}
}
} }
} }

View File

@ -7294,7 +7294,8 @@ int ObSPIService::convert_obj(ObPLExecCtx *ctx,
LOG_DEBUG("column convert", K(obj.get_meta()), K(result_types[i].get_meta_type()), LOG_DEBUG("column convert", K(obj.get_meta()), K(result_types[i].get_meta_type()),
K(current_type.at(i)), K(result_types[i].get_accuracy())); K(current_type.at(i)), K(result_types[i].get_accuracy()));
if (obj.is_pl_extend()/* && pl::PL_RECORD_TYPE == obj.get_meta().get_extend_type()*/ if (obj.is_pl_extend()/* && pl::PL_RECORD_TYPE == obj.get_meta().get_extend_type()*/
&& result_types[i].get_meta_type().is_ext()) { && result_types[i].get_meta_type().is_ext()
&& obj.get_meta().get_extend_type() != PL_CURSOR_TYPE) {
//record嵌object场景,object属性在resolver阶段要求强一致,无需强转 //record嵌object场景,object属性在resolver阶段要求强一致,无需强转
OZ (calc_array.push_back(obj)); OZ (calc_array.push_back(obj));
} else if (obj.get_meta() == result_types[i].get_meta_type() } else if (obj.get_meta() == result_types[i].get_meta_type()
@ -7435,6 +7436,7 @@ int ObSPIService::store_result(ObPLExecCtx *ctx,
1 == type_count && 1 == type_count &&
1 == obj_array.count() && 1 == obj_array.count() &&
obj_array.at(0).is_pl_extend() && obj_array.at(0).is_pl_extend() &&
obj_array.at(0).get_meta().get_extend_type() != PL_CURSOR_TYPE &&
obj_array.at(0).get_meta().get_extend_type() != PL_OPAQUE_TYPE); // xmltypes may need to do cast obj_array.at(0).get_meta().get_extend_type() != PL_OPAQUE_TYPE); // xmltypes may need to do cast
if (!is_schema_object) { if (!is_schema_object) {
if (OB_SUCC(ret) && type_count != obj_array.count()) { if (OB_SUCC(ret) && type_count != obj_array.count()) {