|
|
|
|
@ -1343,6 +1343,24 @@ bool MySQL_Session::handler_again___verify_backend_autocommit() {
|
|
|
|
|
}
|
|
|
|
|
NEXT_IMMEDIATE_NEW(CHANGING_AUTOCOMMIT);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (autocommit == false) { // also IsAutoCommit==false
|
|
|
|
|
if (mysql_thread___enforce_autocommit_on_reads == false) {
|
|
|
|
|
if (mybe->server_myds->myconn->IsActiveTransaction() == false) {
|
|
|
|
|
if (CurrentQuery.is_select_NOT_for_update()==true) {
|
|
|
|
|
// client wants autocommit=0
|
|
|
|
|
// enforce_autocommit_on_reads=false
|
|
|
|
|
// there is no transaction
|
|
|
|
|
// this seems to be the first query, and a SELECT not FOR UPDATE
|
|
|
|
|
// we will switch back to autcommit=1
|
|
|
|
|
if (status == PROCESSING_QUERY) {
|
|
|
|
|
previous_status.push(PROCESSING_QUERY);
|
|
|
|
|
NEXT_IMMEDIATE_NEW(CHANGING_AUTOCOMMIT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@ -1404,6 +1422,7 @@ bool MySQL_Session::handler_again___status_SETTING_INIT_CONNECT(int *_rc) {
|
|
|
|
|
int rc=myconn->async_send_simple_command(myds->revents,myconn->options.init_connect,strlen(myconn->options.init_connect));
|
|
|
|
|
if (rc==0) {
|
|
|
|
|
myds->revents|=POLLOUT; // we also set again POLLOUT to send a query immediately!
|
|
|
|
|
myds->free_mysql_real_query();
|
|
|
|
|
st=previous_status.top();
|
|
|
|
|
previous_status.pop();
|
|
|
|
|
NEXT_IMMEDIATE_NEW(st);
|
|
|
|
|
@ -2019,7 +2038,28 @@ bool MySQL_Session::handler_again___status_CHANGING_AUTOCOMMIT(int *_rc) {
|
|
|
|
|
if (myds->mypolls==NULL) {
|
|
|
|
|
thread->mypolls.add(POLLIN|POLLOUT, mybe->server_myds->fd, mybe->server_myds, thread->curtime);
|
|
|
|
|
}
|
|
|
|
|
int rc=myconn->async_set_autocommit(myds->revents, autocommit);
|
|
|
|
|
bool ac = autocommit;
|
|
|
|
|
if (autocommit == false) { // also IsAutoCommit==false
|
|
|
|
|
if (mysql_thread___enforce_autocommit_on_reads == false) {
|
|
|
|
|
if (mybe->server_myds->myconn->IsAutoCommit() == false) {
|
|
|
|
|
if (mybe->server_myds->myconn->IsActiveTransaction() == false) {
|
|
|
|
|
if (CurrentQuery.is_select_NOT_for_update()==true) {
|
|
|
|
|
// client wants autocommit=0
|
|
|
|
|
// enforce_autocommit_on_reads=false
|
|
|
|
|
// there is no transaction
|
|
|
|
|
// this seems to be the first query, and a SELECT not FOR UPDATE
|
|
|
|
|
// we will switch back to autcommit=1
|
|
|
|
|
ac = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
st=previous_status.top();
|
|
|
|
|
previous_status.pop();
|
|
|
|
|
NEXT_IMMEDIATE_NEW(st);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int rc=myconn->async_set_autocommit(myds->revents, ac);
|
|
|
|
|
if (rc==0) {
|
|
|
|
|
st=previous_status.top();
|
|
|
|
|
previous_status.pop();
|
|
|
|
|
|