diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 9343f0a56..a3f29fecd 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -1124,11 +1124,13 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { return_proxysql_internal(pkt); return true; } - if (handler_SetAutocommit(pkt) == true) { - return true; - } - if (handler_CommitRollback(pkt) == true) { - return true; + if (locked_on_hostgroup == -1) { + if (handler_SetAutocommit(pkt) == true) { + return true; + } + if (handler_CommitRollback(pkt) == true) { + return true; + } } if (session_type != PROXYSQL_SESSION_CLICKHOUSE) { @@ -1177,7 +1179,7 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { l_free(pkt->size,pkt->ptr); return true; } - if ( (pkt->size < 60) && (pkt->size > 38) && (strncasecmp((char *)"SET SESSION character_set_server",(char *)pkt->ptr+5,32)==0) ) { // issue #601 + if ((locked_on_hostgroup == -1) && (pkt->size < 60) && (pkt->size > 38) && (strncasecmp((char *)"SET SESSION character_set_server",(char *)pkt->ptr+5,32)==0) ) { // issue #601 char *idx=NULL; char *p=(char *)pkt->ptr+37; idx=(char *)memchr(p,'=',pkt->size-37); @@ -1197,7 +1199,7 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { pkt->ptr=pkt_2.ptr; } } - if ( (pkt->size < 60) && (pkt->size > 39) && (strncasecmp((char *)"SET SESSION character_set_results",(char *)pkt->ptr+5,33)==0) ) { // like the above + if ((locked_on_hostgroup == -1) && (pkt->size < 60) && (pkt->size > 39) && (strncasecmp((char *)"SET SESSION character_set_results",(char *)pkt->ptr+5,33)==0) ) { // like the above char *idx=NULL; char *p=(char *)pkt->ptr+38; idx=(char *)memchr(p,'=',pkt->size-38); @@ -1218,7 +1220,7 @@ bool MySQL_Session::handler_special_queries(PtrSize_t *pkt) { } } if ( - (pkt->size < 100) && (pkt->size > 15) && (strncasecmp((char *)"SET NAMES ",(char *)pkt->ptr+5,10)==0) + (locked_on_hostgroup == -1) && (pkt->size < 100) && (pkt->size > 15) && (strncasecmp((char *)"SET NAMES ",(char *)pkt->ptr+5,10)==0) && (memchr((const void *)((char *)pkt->ptr+5),',',pkt->size-15)==NULL) // there is no comma ) {