Hi, Oleksandr! On Jul 30, Oleksandr Byelkin wrote:
On Wed, Jul 29, 2020 at 7:47 PM Sergei Golubchik <serg@mariadb.org> wrote:
+ /* + Here second buffer for not optimized commands, + optimized commands do it inside thier internal loop. + */ + if (!(sql_command_flags[lex->sql_command] & CF_SP_BULK_OPTIMIZED) && + this->lex->has_returning()) + { + // Above check can be true for SELECT in future + DBUG_ASSERT(lex->sql_command != SQLCOM_SELECT); + if ((readbuff= + net_try_allocate_new_packet(&thd->net, thd, + MYF(MY_THREAD_SPECIFIC))) == NULL)
sorry, I'm confused. You allocate a buffer here, in Prepared_statement::execute_bulk_loop, and then again in mysql_insert() ?
there are 2 way to execute "bulk" operation: 1) optimized (it is only INSERT (REPLACE) for now) where all is done inside insert procedure (one table open, one transaction) 2) many calls of the procedure (DELETE/UPDATE) which as output make "picture" of one call (one OK/EOF and maybe result set) (as side effect many time tables opened and it is different transaction)
so it is in fact 2 independent ways and that is why it is in 2 places.
May be, then, add DBUG_ASSERT(lex->sql_command != SQLCOM_INSERT); ? Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org