to issue<53586439>:support set ob_query_timeout in non-nested store routine
This commit is contained in:
@ -257,6 +257,23 @@ int ObSPIResultSet::is_set_global_var(ObSQLSessionInfo &session, const ObString
|
|||||||
} else if (T_VAR_VAL == set_node->type_ &&
|
} else if (T_VAR_VAL == set_node->type_ &&
|
||||||
1 == set_node->value_) { // global var
|
1 == set_node->value_) { // global var
|
||||||
has_global_variable = true;
|
has_global_variable = true;
|
||||||
|
} else if (set_node->num_child_ > 0 && OB_NOT_NULL(set_node->children_[0])) {
|
||||||
|
ParseNode *var = set_node->children_[0];
|
||||||
|
ObString name;
|
||||||
|
if (T_OBJ_ACCESS_REF == var->type_) { //Oracle mode
|
||||||
|
const ParseNode *name_node = NULL;
|
||||||
|
if (OB_ISNULL(name_node = var->children_[0])) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("get unexpected null", K(ret));
|
||||||
|
} else {
|
||||||
|
name.assign_ptr(name_node->str_value_, static_cast<int32_t>(name_node->str_len_));
|
||||||
|
}
|
||||||
|
} else if (T_SYSTEM_VARIABLE == var->type_) {
|
||||||
|
name.assign_ptr(var->str_value_, static_cast<int32_t>(var->str_len_));
|
||||||
|
}
|
||||||
|
if (OB_SUCC(ret) && 0 == name.case_compare("ob_query_timeout")) {
|
||||||
|
has_global_variable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1199,10 +1199,6 @@ ObSql::TimeoutGuard::TimeoutGuard(ObSQLSessionInfo &session)
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
worker_timeout_ = THIS_WORKER.get_timeout_ts();
|
worker_timeout_ = THIS_WORKER.get_timeout_ts();
|
||||||
if (OB_FAIL(session_.get_query_timeout(query_timeout_))
|
|
||||||
|| OB_FAIL(session_.get_tx_timeout(trx_timeout_))) {
|
|
||||||
LOG_ERROR("get timeout failed", KR(ret), K(query_timeout_), K(trx_timeout_));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ObSql::TimeoutGuard::~TimeoutGuard()
|
ObSql::TimeoutGuard::~TimeoutGuard()
|
||||||
@ -1211,24 +1207,6 @@ ObSql::TimeoutGuard::~TimeoutGuard()
|
|||||||
if (THIS_WORKER.get_timeout_ts() != worker_timeout_) {
|
if (THIS_WORKER.get_timeout_ts() != worker_timeout_) {
|
||||||
THIS_WORKER.set_timeout_ts(worker_timeout_);
|
THIS_WORKER.set_timeout_ts(worker_timeout_);
|
||||||
}
|
}
|
||||||
int64_t query_timeout = 0;
|
|
||||||
int64_t trx_timeout = 0;
|
|
||||||
if (OB_FAIL(session_.get_query_timeout(query_timeout))
|
|
||||||
|| OB_FAIL(session_.get_tx_timeout(trx_timeout))) {
|
|
||||||
LOG_ERROR("get timeout failed", KR(ret), K(query_timeout), K(trx_timeout));
|
|
||||||
} else {
|
|
||||||
if (query_timeout != query_timeout_ || trx_timeout != trx_timeout_) {
|
|
||||||
ObObj query_val, trx_val;
|
|
||||||
query_val.set_int(query_timeout_);
|
|
||||||
trx_val.set_int(trx_timeout_);
|
|
||||||
if (OB_FAIL(ret)) {
|
|
||||||
} else if (OB_FAIL(session_.update_sys_variable(SYS_VAR_OB_QUERY_TIMEOUT, query_val))) {
|
|
||||||
LOG_WARN("set sys variable failed", K(ret), K(OB_SV_QUERY_TIMEOUT), K(query_val));
|
|
||||||
} else if (OB_FAIL(session_.update_sys_variable(SYS_VAR_OB_TRX_TIMEOUT, trx_val))) {
|
|
||||||
LOG_WARN("set sys variable failed", K(ret), K(OB_SV_TRX_TIMEOUT), K(trx_val));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSql::set_timeout_for_pl(ObSQLSessionInfo &session_info, int64_t &abs_timeout_us)
|
int ObSql::set_timeout_for_pl(ObSQLSessionInfo &session_info, int64_t &abs_timeout_us)
|
||||||
|
|||||||
@ -245,8 +245,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
ObSQLSessionInfo &session_;
|
ObSQLSessionInfo &session_;
|
||||||
int64_t worker_timeout_;
|
int64_t worker_timeout_;
|
||||||
int64_t query_timeout_;
|
|
||||||
int64_t trx_timeout_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -484,7 +484,7 @@ select @@session.ob_trx_timeout;
|
|||||||
+--------------------------+
|
+--------------------------+
|
||||||
| @@session.ob_trx_timeout |
|
| @@session.ob_trx_timeout |
|
||||||
+--------------------------+
|
+--------------------------+
|
||||||
| 100000000 |
|
| 100000001 |
|
||||||
+--------------------------+
|
+--------------------------+
|
||||||
set @@session.ob_trx_timeout=100000000;
|
set @@session.ob_trx_timeout=100000000;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user