only setup user group id in MPConnect

This commit is contained in:
zhjc1124 2024-12-12 18:45:27 +00:00 committed by ob-robot
parent d5d74f213e
commit 639bf91b1d
2 changed files with 41 additions and 32 deletions

View File

@ -377,19 +377,23 @@ int ObMPQuery::process()
}
}
if (is_conn_valid()) {
int tmp_ret = OB_SUCCESS;
// Call setup_user_resource_group no matter OB_SUCC or OB_FAIL
// because we have to reset conn.group_id_ according to user_name.
// Otherwise, suppose we execute a query with a mapping rule on the column in the query at first,
// we switch to the defined consumer group, batch_group for example,
// and after that, the next query will also be executed with batch_group.
if (OB_UNLIKELY(OB_SUCCESS !=
(tmp_ret = setup_user_resource_group(*conn, sess->get_effective_tenant_id(), sess)))) {
LOG_WARN("fail setup user resource group", K(tmp_ret), K(ret));
ret = OB_SUCC(ret) ? tmp_ret : ret;
}
}
/* Function setup_user_resource_group cause performance regression.
No need to setup group_id here,
Only setup group_id in MPConnect
*/
// if (is_conn_valid()) {
// int tmp_ret = OB_SUCCESS;
// // Call setup_user_resource_group no matter OB_SUCC or OB_FAIL
// // because we have to reset conn.group_id_ according to user_name.
// // Otherwise, suppose we execute a query with a mapping rule on the column in the query at first,
// // we switch to the defined consumer group, batch_group for example,
// // and after that, the next query will also be executed with batch_group.
// if (OB_UNLIKELY(OB_SUCCESS !=
// (tmp_ret = setup_user_resource_group(*conn, sess->get_effective_tenant_id(), sess)))) {
// LOG_WARN("fail setup user resource group", K(tmp_ret), K(ret));
// ret = OB_SUCC(ret) ? tmp_ret : ret;
// }
// }
if (OB_FAIL(ret) && need_response_error && is_conn_valid()) {
send_error_packet(ret, NULL);

View File

@ -1860,25 +1860,30 @@ int ObMPStmtExecute::process_execute_stmt(const ObMultiStmtItem &multi_stmt_item
if (OB_FAIL(do_process_single(session, params_, has_more_result, force_sync_resp, async_resp_used))) {
LOG_WARN("fail to do process", K(ret), K(ctx_.cur_sql_));
}
if (is_conn_valid()) {
int bak_ret = ret;
ObSQLSessionInfo *sess = NULL;
if (OB_FAIL(get_session(sess))) {
LOG_WARN("get session fail", K(ret));
} else if (OB_ISNULL(sess)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is NULL or invalid", K(ret));
} else {
// Call setup_user_resource_group no matter OB_SUCC or OB_FAIL
if (OB_FAIL(setup_user_resource_group(*conn, sess->get_effective_tenant_id(), sess))) {
LOG_WARN("fail setup user resource group", K(ret));
}
}
if (sess != NULL) {
revert_session(sess);
}
ret = OB_SUCC(bak_ret) ? ret : bak_ret;
}
/* Function setup_user_resource_group cause performance regression.
No need to setup group_id here,
Only setup group_id in MPConnect
*/
// if (is_conn_valid()) {
// int bak_ret = ret;
// ObSQLSessionInfo *sess = NULL;
// if (OB_FAIL(get_session(sess))) {
// LOG_WARN("get session fail", K(ret));
// } else if (OB_ISNULL(sess)) {
// ret = OB_ERR_UNEXPECTED;
// LOG_WARN("session is NULL or invalid", K(ret));
// } else {
// // Call setup_user_resource_group no matter OB_SUCC or OB_FAIL
// if (OB_FAIL(setup_user_resource_group(*conn, sess->get_effective_tenant_id(), sess))) {
// LOG_WARN("fail setup user resource group", K(ret));
// }
// }
// if (sess != NULL) {
// revert_session(sess);
// }
// ret = OB_SUCC(bak_ret) ? ret : bak_ret;
// }
}
ObThreadLogLevelUtils::clear();
const int64_t debug_sync_timeout = GCONF.debug_sync_timeout;