fix reroute check for single sql in trans
This commit is contained in:
@ -340,8 +340,10 @@ int ObMPQuery::process()
|
|||||||
// 但是目前的代码实现难以在不同的线程处理同一个请求的回包,
|
// 但是目前的代码实现难以在不同的线程处理同一个请求的回包,
|
||||||
// 因此这里只允许只有一个query的multi query请求异步回包。
|
// 因此这里只允许只有一个query的multi query请求异步回包。
|
||||||
force_sync_resp = queries.count() <= 1? false : true;
|
force_sync_resp = queries.count() <= 1? false : true;
|
||||||
bool is_single_stmt = queries.count() <= 1? true : false;
|
// is_part_of_multi 表示当前sql是 multi stmt 中的一条,
|
||||||
ret = process_single_stmt(ObMultiStmtItem(true, i, queries.at(i), is_single_stmt),
|
// 原来的值默认为true,会影响单条sql的二次路由,现在改为用 queries.count() 判断。
|
||||||
|
bool is_part_of_multi = queries.count() > 1 ? true : false;
|
||||||
|
ret = process_single_stmt(ObMultiStmtItem(is_part_of_multi, i, queries.at(i)),
|
||||||
session,
|
session,
|
||||||
has_more,
|
has_more,
|
||||||
force_sync_resp,
|
force_sync_resp,
|
||||||
|
|||||||
@ -5146,8 +5146,7 @@ int ObSql::check_need_reroute(ObPlanCacheCtx &pc_ctx, ObSQLSessionInfo &session,
|
|||||||
if (should_reroute && !session.is_inner() && session.is_in_transaction()) {
|
if (should_reroute && !session.is_inner() && session.is_in_transaction()) {
|
||||||
auto stmt_type = plan->get_stmt_type();
|
auto stmt_type = plan->get_stmt_type();
|
||||||
bool fixed_route = true;
|
bool fixed_route = true;
|
||||||
if (pc_ctx.sql_ctx_.multi_stmt_item_.is_part_of_multi_stmt()
|
if (pc_ctx.sql_ctx_.multi_stmt_item_.is_part_of_multi_stmt()) {
|
||||||
&& !pc_ctx.sql_ctx_.multi_stmt_item_.is_single_stmt()) {
|
|
||||||
// current is multi-stmt
|
// current is multi-stmt
|
||||||
} else if (!STMT_SUPPORT_BY_TXN_FREE_ROUTE(stmt_type, false)) {
|
} else if (!STMT_SUPPORT_BY_TXN_FREE_ROUTE(stmt_type, false)) {
|
||||||
// stmt is not DML
|
// stmt is not DML
|
||||||
|
|||||||
@ -163,19 +163,17 @@ public:
|
|||||||
batched_queries_(NULL),
|
batched_queries_(NULL),
|
||||||
is_ins_multi_val_opt_(false),
|
is_ins_multi_val_opt_(false),
|
||||||
is_ps_mode_(false),
|
is_ps_mode_(false),
|
||||||
ab_cnt_(0),
|
ab_cnt_(0)
|
||||||
is_single_stmt_(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ObMultiStmtItem(bool is_part_of_multi, int64_t seq_num, const common::ObString &sql, bool is_single_stmt=false)
|
ObMultiStmtItem(bool is_part_of_multi, int64_t seq_num, const common::ObString &sql)
|
||||||
: is_part_of_multi_stmt_(is_part_of_multi),
|
: is_part_of_multi_stmt_(is_part_of_multi),
|
||||||
seq_num_(seq_num),
|
seq_num_(seq_num),
|
||||||
sql_(sql),
|
sql_(sql),
|
||||||
batched_queries_(NULL),
|
batched_queries_(NULL),
|
||||||
is_ins_multi_val_opt_(false),
|
is_ins_multi_val_opt_(false),
|
||||||
is_ps_mode_(false),
|
is_ps_mode_(false),
|
||||||
ab_cnt_(0),
|
ab_cnt_(0)
|
||||||
is_single_stmt_(is_single_stmt)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,8 +188,7 @@ public:
|
|||||||
batched_queries_(queries),
|
batched_queries_(queries),
|
||||||
is_ins_multi_val_opt_(is_multi_vas_opt),
|
is_ins_multi_val_opt_(is_multi_vas_opt),
|
||||||
is_ps_mode_(false),
|
is_ps_mode_(false),
|
||||||
ab_cnt_(0),
|
ab_cnt_(0)
|
||||||
is_single_stmt_(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~ObMultiStmtItem() {}
|
virtual ~ObMultiStmtItem() {}
|
||||||
@ -203,7 +200,6 @@ public:
|
|||||||
sql_.reset();
|
sql_.reset();
|
||||||
batched_queries_ = NULL;
|
batched_queries_ = NULL;
|
||||||
is_ins_multi_val_opt_ = false;
|
is_ins_multi_val_opt_ = false;
|
||||||
is_single_stmt_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_part_of_multi_stmt() const { return is_part_of_multi_stmt_; }
|
inline bool is_part_of_multi_stmt() const { return is_part_of_multi_stmt_; }
|
||||||
@ -238,10 +234,9 @@ public:
|
|||||||
inline bool is_ps_mode() { return is_ps_mode_; }
|
inline bool is_ps_mode() { return is_ps_mode_; }
|
||||||
inline void set_ab_cnt(int64_t cnt) { ab_cnt_ = cnt; }
|
inline void set_ab_cnt(int64_t cnt) { ab_cnt_ = cnt; }
|
||||||
inline int64_t get_ab_cnt() { return ab_cnt_; }
|
inline int64_t get_ab_cnt() { return ab_cnt_; }
|
||||||
inline bool is_single_stmt() const { return is_single_stmt_; }
|
|
||||||
|
|
||||||
TO_STRING_KV(K_(is_part_of_multi_stmt), K_(seq_num), K_(sql), KPC_(batched_queries),
|
TO_STRING_KV(K_(is_part_of_multi_stmt), K_(seq_num), K_(sql),
|
||||||
K_(is_ins_multi_val_opt), K_(is_ps_mode), K_(ab_cnt), K_(is_single_stmt));
|
KPC_(batched_queries), K_(is_ins_multi_val_opt), K_(is_ps_mode), K_(ab_cnt));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_part_of_multi_stmt_; // 是否为multi stmt,非multi stmt也使用这个结构体,因此需要这个标记
|
bool is_part_of_multi_stmt_; // 是否为multi stmt,非multi stmt也使用这个结构体,因此需要这个标记
|
||||||
@ -252,7 +247,6 @@ private:
|
|||||||
bool is_ins_multi_val_opt_;
|
bool is_ins_multi_val_opt_;
|
||||||
bool is_ps_mode_;
|
bool is_ps_mode_;
|
||||||
int64_t ab_cnt_;
|
int64_t ab_cnt_;
|
||||||
bool is_single_stmt_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ObQueryRetryInfo
|
class ObQueryRetryInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user