Hi, Monty,
On Jan 12, Michael Widenius wrote:
> revision-id: 8ef0c105783 (mariadb-12.1.1-51-g8ef0c105783)
> parent(s): 6efa1cf2c56
> author: Michael Widenius
> committer: Michael Widenius
> timestamp: 2026-01-08 16:08:21 +0200
> message:
>
> MDEV-38019 Send ok packet to client earlier
>
> --- a/sql/sql_class.cc
> +++ b/sql/sql_class.cc
> @@ -2350,6 +2351,32 @@ void THD::reset_killed()
> DBUG_VOID_RETURN;
> }
>
> +
> +/*
> + Mark query killed for exceeding limit rows
> +
> + The current select will be aborted, but the incomplete result set will
> + be sent to the user
> + */
> +
> +void THD::killed_for_exceeding_limit_rows()
> +{
> + set_killed(ABORT_QUERY);
> + if (!no_errors && !killed_for_exceeding_limit_rows_warning_given)
> + {
> + killed_for_exceeding_limit_rows_warning_given= 1;
why do you need killed_for_exceeding_limit_rows_warning_given?
Just check if !killed
> + bool saved_abort_on_warning= abort_on_warning;
> + abort_on_warning= false;
> + push_warning_printf(this, Sql_condition::WARN_LEVEL_WARN,
> + ER_QUERY_RESULT_INCOMPLETE,
> + ER_THD(this, ER_QUERY_RESULT_INCOMPLETE),
> + "LIMIT ROWS EXAMINED",
> + lex->limit_rows_examined->val_uint());
> + abort_on_warning= saved_abort_on_warning;
> + }
> +}
> +
> +
> /*
> Remember the location of thread info, the structure needed for
> the structure for the net buffer
> @@ -3363,13 +3390,36 @@ int select_send::send_data(List<Item> &items)
>
> bool select_send::send_eof()
> {
> + Ha_trx_info *ha_info;
> +
> /*
> Don't send EOF if we're in error condition (which implies we've already
> sent or are sending an error)
> */
> if (unlikely(thd->is_error()))
> + {
> + reset_for_next_ps_execution();
> return TRUE;
> + }
> +
> ::my_eof(thd);
> +
> + if (unlikely(thd->lex->sql_command != SQLCOM_SELECT))
> + goto end; // For DELETE RETURNING
> +
> + for (ha_info= thd->transaction->stmt.ha_list ;
> + ha_info; ha_info= ha_info->next())
> + {
> + if (unlikely(ha_info->is_trx_read_write()))
> + goto end;
> + }
> +
> + /* Send result to client as we are exceuting a read only statement */
> + thd->push_final_warnings();
> + thd->update_server_status(); // Needed for slow query
> status
> + thd->protocol->end_statement();
> +
> +end:
this could be
if (!thd->transaction->stmt.is_trx_read_write())
{
/* Send result to client as we are exceuting a read only statement */
thd->push_final_warnings();
thd->update_server_status(); // Needed for slow query
status
thd->protocol->end_statement();
}
without explicit for() and without goto.
> reset_for_next_ps_execution();
> return FALSE;
> }
Regards,
Sergei
Chief Architect, MariaDB Server
and [email protected]
_______________________________________________
developers mailing list -- [email protected]
To unsubscribe send an email to [email protected]