mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-15405 Mixed replication fails with "Could not execute Delete_rows_v1 event" upon DELETE HISTORY
Allow slave thread to set time for system versioning Note that every binlog event stores now(0), while microseconds are only stored when they're actually used in the query. Meaning for unversioned->versioned replication, there will be no microseconds. Need to compensate for that.
This commit is contained in:
@ -3434,8 +3434,8 @@ public:
|
||||
ulong sec_part;
|
||||
} system_time;
|
||||
|
||||
ulong systime_sec_part() { return system_time.sec_part; }
|
||||
my_time_t systime() { return system_time.sec; }
|
||||
ulong systime_sec_part() { query_start_sec_part_used=1; return system_time.sec_part; }
|
||||
my_time_t systime() { query_start_used=1; return system_time.sec; }
|
||||
|
||||
private:
|
||||
void set_system_time()
|
||||
@ -3462,6 +3462,25 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void set_system_time_from_user_time(bool with_sec_part)
|
||||
{
|
||||
if (with_sec_part)
|
||||
{
|
||||
system_time.sec= start_time;
|
||||
system_time.sec_part= start_time_sec_part;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (system_time.sec == start_time)
|
||||
system_time.sec_part++;
|
||||
else
|
||||
{
|
||||
system_time.sec= start_time;
|
||||
system_time.sec_part= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
inline void set_start_time()
|
||||
{
|
||||
@ -3488,10 +3507,21 @@ public:
|
||||
user_time= t;
|
||||
set_time();
|
||||
}
|
||||
/*
|
||||
this is only used by replication and BINLOG command.
|
||||
usecs > TIME_MAX_SECOND_PART means "was not in binlog"
|
||||
*/
|
||||
inline void set_time(my_time_t t, ulong sec_part)
|
||||
{
|
||||
my_hrtime_t hrtime= { hrtime_from_time(t) + sec_part };
|
||||
set_time(hrtime);
|
||||
start_time= t;
|
||||
start_time_sec_part= sec_part > TIME_MAX_SECOND_PART ? 0 : sec_part;
|
||||
user_time.val= hrtime_from_time(start_time) + start_time_sec_part;
|
||||
if (slave_thread)
|
||||
set_system_time_from_user_time(sec_part <= TIME_MAX_SECOND_PART);
|
||||
else // BINLOG command
|
||||
set_system_time();
|
||||
PSI_CALL_set_thread_start_time(start_time);
|
||||
start_utime= utime_after_lock= microsecond_interval_timer();
|
||||
}
|
||||
void set_time_after_lock()
|
||||
{
|
||||
|
Reference in New Issue
Block a user