【bugfix】修复bug_remote_execute
This commit is contained in:
@ -2733,7 +2733,7 @@ static void exec_simple_query(const char* query_string, MessageType messageType,
|
||||
}
|
||||
|
||||
if (libpqsw_get_redirect()) {
|
||||
if (libpqsw_process_query_message(commandTag, NULL, querystringForLibpqsw)) {
|
||||
if (libpqsw_process_query_message(commandTag, NULL, querystringForLibpqsw, is_multistmt, lnext(parsetree_item) == NULL)) {
|
||||
libpqsw_trace_q_msg(commandTag, querystringForLibpqsw);
|
||||
if (snapshot_set) {
|
||||
PopActiveSnapshot();
|
||||
@ -2854,7 +2854,8 @@ static void exec_simple_query(const char* query_string, MessageType messageType,
|
||||
break;
|
||||
}
|
||||
|
||||
if (libpqsw_process_query_message(commandTag, querytree_list, querystringForLibpqsw)) {
|
||||
// Mixed statement judgments
|
||||
if (libpqsw_process_query_message(commandTag, querytree_list, querystringForLibpqsw, is_multistmt, lnext(parsetree_item) == NULL)) {
|
||||
libpqsw_trace_q_msg(commandTag, querystringForLibpqsw);
|
||||
if (libpqsw_begin_command(commandTag) || libpqsw_end_command(commandTag)) {
|
||||
libpqsw_trace("libpq send sql at my side as well:%s", commandTag);
|
||||
|
@ -1034,7 +1034,7 @@ bool libpqsw_process_parse_message(const char* commandTag, List* query_list)
|
||||
}
|
||||
|
||||
/* process Q type msg, true if need in redirect mode*/
|
||||
bool libpqsw_process_query_message(const char* commandTag, List* query_list, const char* query_string)
|
||||
bool libpqsw_process_query_message(const char* commandTag, List* query_list, const char* query_string, bool is_multistmt, bool is_last)
|
||||
{
|
||||
if (IsAbortedTransactionBlockState()) {
|
||||
return false;
|
||||
@ -1048,6 +1048,10 @@ bool libpqsw_process_query_message(const char* commandTag, List* query_list, con
|
||||
appendStringInfoString(curMsg, query_string);
|
||||
appendStringInfoChar(curMsg, 0);
|
||||
RedirectType type = RT_NORMAL;
|
||||
// If the SQL statement is mixed and the current SQL statement is not the last statement in the mixed statement, the status is set to RT_MULTI*/
|
||||
if (is_multistmt && !is_last) {
|
||||
type = RT_MULTI;
|
||||
}
|
||||
if (libpqsw_begin_command(commandTag) || libpqsw_end_command(commandTag)) {
|
||||
type = RT_TXN_STATUS;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ bool libpqsw_process_message(int qtype, const StringInfo msg);
|
||||
/* process P type msg, true if need redirect*/
|
||||
bool libpqsw_process_parse_message(const char* commandTag, List* query_list);
|
||||
/* process Q type msg, true if need in redirect mode*/
|
||||
bool libpqsw_process_query_message(const char* commandTag, List* query_list, const char* query_string);
|
||||
bool libpqsw_process_query_message(const char* commandTag, List* query_list, const char* query_string, bool is_multistmt, bool is_last);
|
||||
/* is need send ready_for_query messge to front, if in redirect then false*/
|
||||
bool libpqsw_need_end();
|
||||
/* udpate if need ready_for_query messge flag */
|
||||
@ -136,6 +136,7 @@ typedef struct {
|
||||
enum RedirectType {
|
||||
RT_NORMAL, //transfer to standby
|
||||
RT_TXN_STATUS,
|
||||
RT_MULTI, // multi stmt
|
||||
RT_SET //not transfer to standby,set props=xxx or 'C' close msg
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user