maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #13093
Re: 880e92a48ba: MDEV-27760 event may non stop replicate in circular semisync setup
Hi, Andrei,
On Mar 01, Andrei Elkin wrote:
> > On Feb 28, Andrei wrote:
> >> revision-id: 880e92a48ba (mariadb-10.6.6-16-g880e92a48ba)
> >> parent(s): 4030a9fb2eb
> >> author: Andrei
> >> committer: Andrei
> >> timestamp: 2022-02-21 14:58:13 +0200
> >> message:
> >>
> >> MDEV-27760 event may non stop replicate in circular semisync setup
> >>
> >> diff --git a/sql/slave.cc b/sql/slave.cc
> >> index c0eef02ca7a..a1f4f4f0081 100644
> >> --- a/sql/slave.cc
> >> +++ b/sql/slave.cc
> >> @@ -6186,13 +6186,13 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len)
> >> bool is_rows_event= false;
> >> /*
> >> The flag has replicate_same_server_id semantics and is raised to accept
> >> - a same-server-id event on the semisync slave, for both the gtid and legacy
> >> - connection modes.
> >> - Such events can appear as result of this server recovery so the event
> >> - was created there and replicated elsewhere right before the crash. At recovery
> >> - it could be evicted from the server's binlog.
> >> - */
> >> - bool do_accept_own_server_id= false;
> >> + a same-server-id event group by the gtid strict mode semisync slave.
> >> + Own server-id events can appear as result of this server crash-recovery:
> >> + the transaction was created on this server then being master, got replicated
> >> + elsewhere right before the crash before commit;
> >> + finally at recovery the transaction gets evicted from the server's binlog.
> >> + */
> >> + static bool do_accept_own_server_id= false;
> >
> > No, sorry, it cannot be static. If you need to preserve it between
> > events, you can keep it, for example, in Master_info.
>
> The var is set by Gtid events to serve as a marker of the whole current Gtid-headed
> group of event.
> Only next Gtid event may change the current value.
>
> Why can't it?
Why it cannot be static? Because it's not a property of the server, it's
a property of a specific replication stream. Technically one can have a
multi-source and do_accept_own_server_id could have different values for
different masters.
> > So, the question now is, why do you need to preserve the value of
> > do_accept_own_server_id between queue_event invocations?
>
> The flag as said above applies to the whole group of events, so it's
> preserved at least through so many
> queue_event() calls as many event in the group (I count Gtid itself in).
As far as I can see, you can calculate it for every event just the same.
> >> @@ -6281,6 +6281,8 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len)
> >> dbug_rows_event_count = 0;
> >> };);
> >> #endif
> >> + s_id= uint4korr(buf + SERVER_ID_OFFSET);
> >> +
> >> mysql_mutex_lock(&mi->data_lock);
> >>
> >> switch (buf[EVENT_TYPE_OFFSET]) {
> >> @@ -6722,6 +6724,11 @@ static int queue_event(Master_info* mi, const uchar *buf, ulong event_len)
> >>
> >> ++mi->events_queued_since_last_gtid;
> >> inc_pos= event_len;
> >> +
> >> + do_accept_own_server_id=
> >> + (s_id == global_system_variables.server_id && rpl_semi_sync_slave_enabled
> >> + && mi->using_gtid != Master_info::USE_GTID_NO && opt_gtid_strict_mode) ?
> >> + true : false;
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx
References