MCPcopy Create free account
hub / github.com/MariaDB/server / threadpool_process_request

Function threadpool_process_request

sql/threadpool_common.cc:400–466  ·  view source on GitHub ↗

Process a single client request or a single batch. */

Source from the content-addressed store, hash-verified

398 Process a single client request or a single batch.
399*/
400static dispatch_command_return threadpool_process_request(THD *thd)
401{
402 dispatch_command_return retval= DISPATCH_COMMAND_SUCCESS;
403
404 thread_attach(thd);
405 if(thd->async_state.m_state == thd_async_state::enum_async_state::RESUMED)
406 goto resume;
407
408 if (thd->killed >= KILL_CONNECTION)
409 {
410 /*
411 killed flag was set by timeout handler
412 or KILL command. Return error.
413 */
414 retval= DISPATCH_COMMAND_CLOSE_CONNECTION;
415 if(thd->killed == KILL_WAIT_TIMEOUT)
416 handle_wait_timeout(thd);
417 goto end;
418 }
419
420
421 /*
422 In the loop below, the flow is essentially the copy of
423 thread-per-connections
424 logic, see do_handle_one_connection() in sql_connect.c
425
426 The goal is to execute a single query, thus the loop is normally executed
427 only once. However for SSL connections, it can be executed multiple times
428 (SSL can preread and cache incoming data, and vio->has_data() checks if it
429 was the case).
430 */
431 for(;;)
432 {
433 thd->net.reading_or_writing= 0;
434 if (mysql_audit_release_required(thd))
435 mysql_audit_release(thd);
436
437resume:
438 retval= do_command(thd, false);
439 switch(retval)
440 {
441 case DISPATCH_COMMAND_WOULDBLOCK:
442 case DISPATCH_COMMAND_CLOSE_CONNECTION:
443 goto end;
444 case DISPATCH_COMMAND_SUCCESS:
445 break;
446 }
447
448 if (!thd_is_connection_alive(thd))
449 {
450 retval=DISPATCH_COMMAND_CLOSE_CONNECTION;
451 goto end;
452 }
453
454 set_thd_idle(thd);
455
456 if (!has_unread_data(thd))
457 {

Callers 1

tp_callbackFunction · 0.85

Calls 8

thread_attachFunction · 0.85
handle_wait_timeoutFunction · 0.85
mysql_audit_releaseFunction · 0.85
do_commandFunction · 0.85
thd_is_connection_aliveFunction · 0.85
set_thd_idleFunction · 0.85
has_unread_dataFunction · 0.85

Tested by

no test coverage detected