[master][tx-route] fix implicit-start tx push extra-state version

This commit is contained in:
chinaxing
2023-02-15 04:44:37 +00:00
committed by ob-robot
parent 6597151e89
commit 17bea01cde
4 changed files with 14 additions and 9 deletions

View File

@ -908,16 +908,15 @@ int ObVariableSetExecutor::process_session_autocommit_hook(ObExecContext &exec_c
{
int ret = OB_SUCCESS;
ObSQLSessionInfo *my_session = GET_MY_SESSION(exec_ctx);
bool orig_ac = true;
int64_t autocommit = 0;
if (OB_ISNULL(my_session)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("session is NULL", K(ret));
} else {
int64_t autocommit = 0;
auto tx_desc = my_session->get_tx_desc();
bool in_trans = OB_NOT_NULL(tx_desc) && tx_desc->in_tx_or_has_state();
bool ac = true;
if (OB_FAIL(my_session->get_autocommit(ac))) {
if (OB_FAIL(my_session->get_autocommit(orig_ac))) {
LOG_WARN("fail to get autocommit", K(ret));
} else if (OB_FAIL(val.get_int(autocommit))) {
LOG_WARN("fail get commit val", K(val), K(ret));
@ -928,7 +927,7 @@ int ObVariableSetExecutor::process_session_autocommit_hook(ObExecContext &exec_c
(int)strlen(autocommit_str), autocommit_str);
} else {
// skip commit txn if this is txn free route temporary node
if (false == ac && true == in_trans && 1 == autocommit && !my_session->is_txn_free_route_temp()) {
if (false == orig_ac && true == in_trans && 1 == autocommit && !my_session->is_txn_free_route_temp()) {
if (OB_FAIL(ObSqlTransControl::implicit_end_trans(exec_ctx, false))) {
LOG_WARN("fail implicit commit trans", K(ret));
}
@ -937,6 +936,7 @@ int ObVariableSetExecutor::process_session_autocommit_hook(ObExecContext &exec_c
}
}
}
LOG_INFO("set var: autocommit", K(ret), K(orig_ac), "to", autocommit);
return ret;
}

View File

@ -1088,6 +1088,11 @@ int ObSqlTransControl::check_ls_readable(const uint64_t tenant_id,
session.reset_tx_variable(); \
} \
LOG_DEBUG("update-txn-state", K(ret), K(session), K(prev_tx_id), KPC(tx_desc)); \
if (OB_FAIL(ret)) { \
LOG_WARN("update txn state fail", K(ret), "state", #name, \
K(session.get_txn_free_route_ctx()), \
K(session), K(prev_tx_id), KPC(tx_desc)); \
} \
return ret; \
} \
int ObSqlTransControl::serialize_txn_##name##_state(ObSQLSessionInfo &session, char* buf, const int64_t len, int64_t &pos) \