@@ -632,8 +632,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
632632 thd->abort_on_warning= saved_abort_on_warning;
633633 thd->reset_killed();
634634 }
635- /* Disable LIMIT ROWS EXAMINED after query execution. */
636- thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX ;
635+ /* Deactivate LIMIT ROWS EXAMINED after query execution. */
636+ thd->lex->deactivate_limit_rows_examined() ;
637637
638638 MYSQL_SELECT_DONE((int) res, (ulong) thd->limit_found_rows);
639639 DBUG_RETURN(res);
@@ -4787,7 +4787,7 @@ void JOIN::exec_inner()
47874787 THD_STAGE_INFO(thd, stage_executing);
47884788
47894789 /*
4790- Enable LIMIT ROWS EXAMINED during query execution if:
4790+ Activate enforcement of LIMIT ROWS EXAMINED during query execution if:
47914791 (1) This JOIN is the outermost query (not a subquery or derived table)
47924792 This ensures that the limit is enabled when actual execution begins,
47934793 and not if a subquery is evaluated during optimization of the outer
@@ -4799,7 +4799,7 @@ void JOIN::exec_inner()
47994799
48004800 if (!select_lex->outer_select() && // (1)
48014801 select_lex != select_lex->master_unit()->fake_select_lex) // (2)
4802- thd->lex->set_limit_rows_examined ();
4802+ thd->lex->activate_limit_rows_examined ();
48034803
48044804 if (procedure)
48054805 {
@@ -26733,10 +26733,10 @@ JOIN_TAB::remove_duplicates()
2673326733 sort_field_keylength+= ptr->length + (ptr->item->maybe_null() ? 1 : 0);
2673426734
2673526735 /*
26736- Disable LIMIT ROWS EXAMINED in order to avoid interrupting prematurely
26736+ Deactivate LIMIT ROWS EXAMINED in order to avoid interrupting prematurely
2673726737 duplicate removal, and produce a possibly incomplete query result.
2673826738 */
26739- thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX ;
26739+ thd->lex->deactivate_limit_rows_examined() ;
2674026740 if (thd->killed == ABORT_QUERY)
2674126741 thd->reset_killed();
2674226742
@@ -26755,7 +26755,7 @@ JOIN_TAB::remove_duplicates()
2675526755 sort_field_keylength, having);
2675626756
2675726757 if (join->select_lex != join->select_lex->master_unit()->fake_select_lex)
26758- thd->lex->set_limit_rows_examined ();
26758+ thd->lex->activate_limit_rows_examined ();
2675926759 free_blobs(first_field);
2676026760 my_free(sortorder);
2676126761 DBUG_RETURN(error);
0 commit comments