[FEAT MERGE] implement mysql dblink and read consistency

Co-authored-by: xianyu-w <707512433@qq.com>
Co-authored-by: sdc <njucssdc@gmail.com>
Co-authored-by: seuwebber <webber_code@163.com>
This commit is contained in:
cqliang1995
2023-05-09 18:32:03 +00:00
committed by ob-robot
parent 38b78ad442
commit 4108e781d4
132 changed files with 2726 additions and 818 deletions

View File

@ -206,6 +206,7 @@ int ObLogLink::set_link_stmt(const ObDMLStmt* stmt)
ObString sql;
ObObjPrintParams print_param;
print_param.for_dblink_ = 1;
// only link scan need print flashback query for dblink table
ObOptimizerContext *opt_ctx = NULL;
ObQueryCtx *query_ctx = NULL;
ObSQLSessionInfo *session = NULL;
@ -213,7 +214,8 @@ int ObLogLink::set_link_stmt(const ObDMLStmt* stmt)
int64_t hint_query_timeout_us = 0;
if (OB_ISNULL(stmt) || OB_ISNULL(plan) ||
OB_ISNULL(opt_ctx = &get_plan()->get_optimizer_context()) ||
OB_ISNULL(session = opt_ctx->get_session_info())) {
OB_ISNULL(session = opt_ctx->get_session_info()) ||
OB_ISNULL(print_param.exec_ctx_ = opt_ctx->get_exec_ctx())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", KP(opt_ctx), KP(stmt), KP(session), KP(plan), K(ret));
} else if (NULL == (query_ctx = stmt->get_query_ctx())) {
@ -225,6 +227,7 @@ int ObLogLink::set_link_stmt(const ObDMLStmt* stmt)
} else if (-1 == hint_query_timeout_us &&
FALSE_IT(query_ctx->get_query_hint_for_update().get_global_hint().merge_query_timeout_hint(session_query_timeout_us))) {
// do nothing
} else if (FALSE_IT(query_ctx->get_query_hint_for_update().get_global_hint().set_flashback_read_tx_uncommitted(true))) {
} else if (OB_FAIL(mark_exec_params(const_cast<ObDMLStmt*>(stmt)))) {
LOG_WARN("failed to mark exec params", K(ret));
} else if (OB_FAIL(ObSQLUtils::reconstruct_sql(plan->get_allocator(), stmt, sql, opt_ctx->get_schema_guard(), print_param))) {
@ -237,6 +240,7 @@ int ObLogLink::set_link_stmt(const ObDMLStmt* stmt)
if (-1 == hint_query_timeout_us) { // restore query_timeout_hint
query_ctx->get_query_hint_for_update().get_global_hint().reset_query_timeout_hint();
}
query_ctx->get_query_hint_for_update().get_global_hint().set_flashback_read_tx_uncommitted(false);
return ret;
}