1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

cleanup: log_current_statement and OPTION_KEEP_LOG

rename OPTION_KEEP_LOG -> OPTION_BINLOG_THIS_TRX.
    Meaning: transaction cache will be written to binlog even on rollback.

    convert log_current_statement to OPTION_BINLOG_THIS_STMT.
    Meaning: the statement will be written to binlog (or trx binlog cache)
    even if it normally wouldn't be.

    setting OPTION_BINLOG_THIS_STMT must always set OPTION_BINLOG_THIS_TRX,
    otherwise the statement won't be logged if the transaction is rolled back.
    Use OPTION_BINLOG_THIS to set both.
This commit is contained in:
Sergei Golubchik
2022-05-06 10:45:17 +03:00
committed by Aleksey Midenkov
parent c8bcb6e809
commit 93e64d1f58
10 changed files with 43 additions and 40 deletions

View File

@ -4931,7 +4931,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
status_var_increment(thd->status_var.com_drop_tmp_table);
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd->variables.option_bits|= OPTION_KEEP_LOG;
thd->variables.option_bits|= OPTION_BINLOG_THIS_TRX;
}
/*
If we are a slave, we should add IF EXISTS if the query executed
@ -7586,7 +7586,7 @@ void THD::reset_for_next_command(bool do_clear_error)
#endif /* WITH_WSREP */
query_start_sec_part_used= 0;
is_fatal_error= time_zone_used= 0;
log_current_statement= 0;
variables.option_bits&= ~OPTION_BINLOG_THIS_STMT;
/*
Clear the status flag that are expected to be cleared at the
@ -7595,12 +7595,12 @@ void THD::reset_for_next_command(bool do_clear_error)
server_status&= ~SERVER_STATUS_CLEAR_SET;
/*
If in autocommit mode and not in a transaction, reset
OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG to not get warnings
OPTION_STATUS_NO_TRANS_UPDATE | OPTION_BINLOG_THIS_TRX to not get warnings
in ha_rollback_trans() about some tables couldn't be rolled back.
*/
if (!in_multi_stmt_transaction_mode())
{
variables.option_bits&= ~OPTION_KEEP_LOG;
variables.option_bits&= ~OPTION_BINLOG_THIS_TRX;
transaction->all.reset();
}
DBUG_ASSERT(security_ctx== &main_security_ctx);