[FEAT MERGE]:develop pl feature of 4.2 version

Co-authored-by: LiuYoung00 <liuyanglo_ol@163.com>
Co-authored-by: 0xacc <heyongyi1998@gmail.com>
Co-authored-by: seuwebber <webber_code@163.com>
This commit is contained in:
obdev
2023-04-27 16:08:10 +08:00
committed by ob-robot
parent 8e9c9d0c5f
commit 57f1c6e7ee
92 changed files with 3534 additions and 1304 deletions

View File

@ -353,5 +353,27 @@ int ObPLPackageState::convert_changed_info_to_string_kvs(ObPLExecCtx &pl_ctx, Ob
return ret;
}
int ObPLPackageState::remove_user_variables_for_package_state(ObSQLSessionInfo &session)
{
int ret = OB_SUCCESS;
int64_t var_count = vars_.count();
ObArenaAllocator allocator(ObModIds::OB_PL_TEMP);
ObString key;
for (int64_t var_idx = 0; var_idx < var_count; var_idx++) {
// ignore error code, reset all variables
key.reset();
if (OB_FAIL(make_pkg_var_kv_key(allocator, var_idx, VARIABLE, key))) {
LOG_WARN("make package var name failed", K(ret), K(package_id_), K(var_idx));
} else if (session.user_variable_exists(key)) {
if (OB_FAIL(session.remove_user_variable(key))) {
LOG_WARN("fail to remove user var", K(ret), K(key), K(package_id_), K(var_idx));
} else if (OB_FAIL(session.remove_changed_user_var(key))) {
LOG_WARN("fail to remove change user var", K(ret), K(key), K(package_id_), K(var_idx));
}
}
}
return ret;
}
} // end namespace pl
} // end namespace oceanbase