Skip to content

Commit 7fee664

Browse files
committed
Add yields to Item_func::fix_fields
Summary: When resolving an expression with many arguments (e.g. a long `IN (...)` list) we may not yield the scheduler in a timely fashion. This should resolve stalls like ``` W0127 03:04:04.517819 2608142 TpScheduler::checkStall: Conn state: acExitLevel=0 isGoverned=1 readmissionMode=0 admitCount=1 waitEvents=0xa7 acFilter=0x0 W0127 03:04:04.517819 2608142 TpScheduler::checkStall: Collect time 748751 nsec, symbolize time 6554425 nsec, digest dc6129f5efe09474cfacb020cdc3521b W0127 03:04:04.517819 2608142 TpScheduler::checkStall: Stack trace for 1 thread(s) [2608144 tp_conn-0]: W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002c134bd Item_func_in::resolve_type(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002839275 Item_func::fix_fields(THD*, Item**) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002eca7d5 Item_func_in::fix_fields(THD*, Item**) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000295fd80 Query_block::setup_conds(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002ca4b77 Sql_cmd_delete::prepare_inner(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000282d295 Sql_cmd_dml::prepare(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002827053 Sql_cmd_dml::execute(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000282177d mysql_execute_command(THD*, bool, unsigned long long*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 0000000002807d26 dispatch_sql_command(THD*, Parser_state*, unsigned long long*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 00000000027f8238 dispatch_command(THD*, COM_DATA const*, enum_server_command) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 00000000027f6d20 do_command(THD*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 00000000062dedd7 mysql::thread_pool::TpConnHandler::processEvent(void*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 00000000062f01f6 mysql::thread_pool::TpWorkerPool::processWorker(void*) W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000475447a pfs_spawn_thread(void*) [clone .__uniq.73903348312165179054628174044725776814] [clone .llvm.15823314186845019609] W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000009abae start_thread W0127 03:04:04.517819 2608142 TpScheduler::checkStall: @ 000000000012d17b __clone3 ``` Test Plan: mtr Reviewers: sunxiayi, greynya, #mysql_eng, #dms Reviewed By: greynya Subscribers: avandever Differential Revision: https://phabricator.intern.facebook.com/D53241252 Tasks: T175421977
1 parent ed9c6db commit 7fee664

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎sql/item_func.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ bool Item_func::fix_fields(THD *thd, Item **) {
416416
if (arg_count) { // Print purify happy
417417
for (arg = args, arg_end = args + arg_count; arg != arg_end; arg++) {
418418
if (fix_func_arg(thd, arg)) return true;
419+
420+
// In case there are many arguments to resolve, yield periodically.
421+
thd->check_yield();
419422
}
420423
}
421424

0 commit comments

Comments
 (0)