| 1223 | */ |
| 1224 | |
| 1225 | dispatch_command_return do_command(THD *thd, bool blocking) |
| 1226 | { |
| 1227 | dispatch_command_return return_value; |
| 1228 | char *packet= 0; |
| 1229 | ulong packet_length; |
| 1230 | NET *net= &thd->net; |
| 1231 | enum enum_server_command command; |
| 1232 | DBUG_ENTER("do_command"); |
| 1233 | |
| 1234 | #ifdef WITH_WSREP |
| 1235 | DBUG_ASSERT(!thd->async_state.pending_ops() || |
| 1236 | (WSREP(thd) && |
| 1237 | thd->wsrep_trx().state() == wsrep::transaction::s_aborted)); |
| 1238 | #else |
| 1239 | DBUG_ASSERT(!thd->async_state.pending_ops()); |
| 1240 | #endif |
| 1241 | |
| 1242 | if (thd->async_state.m_state == thd_async_state::enum_async_state::RESUMED) |
| 1243 | { |
| 1244 | /* |
| 1245 | Resuming previously suspended command. |
| 1246 | Restore the state |
| 1247 | */ |
| 1248 | command = thd->async_state.m_command; |
| 1249 | packet = thd->async_state.m_packet.str; |
| 1250 | packet_length = (ulong)thd->async_state.m_packet.length; |
| 1251 | goto resume; |
| 1252 | } |
| 1253 | |
| 1254 | /* |
| 1255 | indicator of uninitialized lex => normal flow of errors handling |
| 1256 | (see my_message_sql) |
| 1257 | */ |
| 1258 | thd->lex->current_select= 0; |
| 1259 | |
| 1260 | /* |
| 1261 | This thread will do a blocking read from the client which |
| 1262 | will be interrupted when the next command is received from |
| 1263 | the client, the connection is closed or "net_wait_timeout" |
| 1264 | number of seconds has passed. |
| 1265 | */ |
| 1266 | if (!thd->skip_wait_timeout) |
| 1267 | my_net_set_read_timeout(net, thd->get_net_wait_timeout()); |
| 1268 | |
| 1269 | /* Errors and diagnostics are cleared once here before query */ |
| 1270 | thd->clear_error(1); |
| 1271 | |
| 1272 | net_new_transaction(net); |
| 1273 | |
| 1274 | /* Save for user statistics */ |
| 1275 | thd->start_bytes_received= thd->status_var.bytes_received; |
| 1276 | |
| 1277 | /* |
| 1278 | Synchronization point for testing of KILL_CONNECTION. |
| 1279 | This sync point can wait here, to simulate slow code execution |
| 1280 | between the last test of thd->killed and blocking in read(). |
| 1281 | |
| 1282 | The goal of this test is to verify that a connection does not |
no test coverage detected