[CP] [to #48137245] fix package shrink core

This commit is contained in:
obdev
2023-04-11 12:50:49 +08:00
committed by ob-robot
parent d9e241f1d2
commit 6306b01265

View File

@ -1803,31 +1803,30 @@ bool ObSQLSessionInfo::get_changed_package_state_num() const
int ObSQLSessionInfo::add_changed_package_info(ObExecContext &exec_ctx) int ObSQLSessionInfo::add_changed_package_info(ObExecContext &exec_ctx)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObPLExecCtx pl_ctx(NULL, &exec_ctx, NULL, NULL, NULL, NULL); ObArenaAllocator allocator;
ObArray<ObString> key; ObPLExecCtx pl_ctx(&allocator, &exec_ctx, NULL, NULL, NULL, NULL);
ObArray<ObObj> value;
if (0 != package_state_map_.size()) { if (0 != package_state_map_.size()) {
FOREACH(it, package_state_map_) { FOREACH(it, package_state_map_) {
ObPLPackageState *package_state = it->second; ObPLPackageState *package_state = it->second;
if (package_state->is_package_info_changed()) { if (package_state->is_package_info_changed()) {
pl_ctx.allocator_ = &(package_state->get_pkg_allocator()); ObSEArray<ObString, 4> key;
ObSEArray<ObObj, 4> value;
if (OB_FAIL(package_state->convert_changed_info_to_string_kvs(pl_ctx, key, value))) { if (OB_FAIL(package_state->convert_changed_info_to_string_kvs(pl_ctx, key, value))) {
LOG_WARN("convert package state to string kv failed", LOG_WARN("convert package state to string kv failed", K(ret));
K(ret), KPC(package_state)); } else {
ObSessionVariable sess_var;
int tmp_ret = OB_SUCCESS;
for (int64_t i = 0; OB_SUCC(ret) && i < key.count(); i++) {
sess_var.value_ = value[i];
sess_var.meta_ = value[i].get_meta();
if (OB_FAIL(ObBasicSessionInfo::replace_user_variable(key[i], sess_var))) {
LOG_WARN("add user var failed", K(ret));
}
}
} }
} }
} }
} }
if (OB_SUCC(ret)) {
ObSessionVariable sess_var;
for (int64_t i = 0; i < key.count(); i++) {
sess_var.value_ = value[i];
sess_var.meta_ = value[i].get_meta();
if (OB_FAIL(ObBasicSessionInfo::replace_user_variable(key[i], sess_var))) {
LOG_WARN("add user var failed", K(ret));
}
}
}
return ret; return ret;
} }