mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
BUG#11754117 incorrect logging of INSERT into auto-increment
BUG#11761686 insert_id event is not filtered. Two issues are covered. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe by autoincrement logging design. The case is specific to MyISAM engine because Innodb does not allow such table definition. However no warnings and row-format logging in the MIXED mode was done, and that is fixed. Int-, Rand-, User-var log-events were not filtered along with their parent query that made possible them to screw up execution context of the following query. Fixed with deferring their execution until the parent query. ****** Bug#11754117 Post review fixes.
This commit is contained in:
@@ -5257,11 +5257,12 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
||||
|
||||
/*
|
||||
Intvar_log_event::do_apply_event()
|
||||
*/
|
||||
|
||||
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
||||
int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
{
|
||||
/*
|
||||
@@ -5270,6 +5271,9 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
*/
|
||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
switch (type) {
|
||||
case LAST_INSERT_ID_EVENT:
|
||||
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
|
||||
@@ -5375,6 +5379,9 @@ int Rand_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
*/
|
||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
thd->rand.seed1= (ulong) seed1;
|
||||
thd->rand.seed2= (ulong) seed2;
|
||||
return 0;
|
||||
@@ -5401,6 +5408,29 @@ Rand_log_event::do_shall_skip(Relay_log_info *rli)
|
||||
return continue_group(rli);
|
||||
}
|
||||
|
||||
/**
|
||||
Exec deferred Int-, Rand- and User- var events prefixing
|
||||
a Query-log-event event.
|
||||
|
||||
@param thd THD handle
|
||||
|
||||
@return false on success, true if a failure in an event applying occurred.
|
||||
*/
|
||||
bool slave_execute_deferred_events(THD *thd)
|
||||
{
|
||||
bool res= false;
|
||||
Relay_log_info *rli= thd->rli_slave;
|
||||
|
||||
DBUG_ASSERT(rli && (!rli->deferred_events_collecting || rli->deferred_events));
|
||||
|
||||
if (!rli->deferred_events_collecting || rli->deferred_events->is_empty())
|
||||
return res;
|
||||
|
||||
res= rli->deferred_events->execute(rli);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif /* !MYSQL_CLIENT */
|
||||
|
||||
|
||||
@@ -5785,6 +5815,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||
{
|
||||
Item *it= 0;
|
||||
CHARSET_INFO *charset;
|
||||
|
||||
if (rli->deferred_events_collecting)
|
||||
return rli->deferred_events->add(this);
|
||||
|
||||
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
|
||||
return 1;
|
||||
LEX_STRING user_var_name;
|
||||
|
Reference in New Issue
Block a user