summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ba141222168..2b674ad220c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -21145,7 +21145,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
bool shortcut_for_distinct= join_tab->shortcut_for_distinct;
ha_rows found_records=join->found_records;
COND *select_cond= join_tab->select_cond;
- bool select_cond_result= TRUE;
+ bool select_cond_result= TRUE, unlock_rows= true;
DBUG_ENTER("evaluate_join_record");
DBUG_PRINT("enter",
@@ -21297,10 +21297,10 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (found)
{
+ unlock_rows= false;
enum enum_nested_loop_state rc;
/* A match from join_tab is found for the current partial join. */
rc= (*join_tab->next_select)(join, join_tab+1, 0);
- join->thd->get_stmt_da()->inc_current_row_for_warning();
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
DBUG_RETURN(rc);
if (return_tab < join->return_tab)
@@ -21320,11 +21320,6 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (shortcut_for_distinct && found_records != join->found_records)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
}
- else
- {
- join->thd->get_stmt_da()->inc_current_row_for_warning();
- join_tab->read_record.unlock_row(join_tab);
- }
}
else
{
@@ -21333,9 +21328,11 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
with the beginning coinciding with the current partial join.
*/
join->join_examined_rows++;
- join->thd->get_stmt_da()->inc_current_row_for_warning();
- join_tab->read_record.unlock_row(join_tab);
}
+ join->thd->get_stmt_da()->inc_current_row_for_warning();
+ if (unlock_rows)
+ join_tab->read_record.unlock_row(join_tab);
+
DBUG_RETURN(NESTED_LOOP_OK);
}
@@ -22587,6 +22584,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
join->unit->lim.set_unlimited();
}
}
+ join->thd->get_stmt_da()->inc_current_row_for_warning();
}
end:
if (unlikely(join->thd->check_killed()))
@@ -29504,6 +29502,7 @@ AGGR_OP::end_send()
table->reginfo.lock_type= TL_UNLOCK;
bool in_first_read= true;
+ join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning(1);
while (rc == NESTED_LOOP_OK)
{
int error;
@@ -29527,6 +29526,7 @@ AGGR_OP::end_send()
else
{
rc= evaluate_join_record(join, join_tab, 0);
+ join_tab->join->thd->get_stmt_da()->inc_current_row_for_warning();
}
}