[tarantool-patches] Re: [PATCH v2] replication: fix assertion with duplicated connect to same master

  • From: Vladimir Davydov <vdavydov.dev@xxxxxxxxx>
  • To: Olga Arkhangelskaia <arkholga@xxxxxxxxxxxxx>
  • Date: Sat, 22 Sep 2018 19:21:43 +0300

[Please don't drop the mailing list from Cc]

On Sat, Sep 22, 2018 at 10:04:57AM +0300, Olga Arkhangelskaia wrote:

*

Hi! Thanks for the review. I will fix most of the comments and observations.

However, I guess I need to know that we are on the same page.

When we do box.cfg{replication={44441, 44441}}

we have two replicas, each one has its onw applier, etc. In
replicaset_update()we are able to

identify  that the replicas are same. At this point we raise exceptions.
Problem occurs when we try to delete the second one. For proper deletion we
need to stop applier, clear it and than delete replica. As I understand we
need to:

applier_stop(replica->applier);

replica_clear_applier(replica);replica_delete(replica);

If you change the call sequence to

  replica_clear_applier(replica);
  replica_delete(replica);
  applier_stop(replica->applier);

you won't be facing this problem.


The reason I added replica_on_applier_off(replica) is because when an
applier enters stopped state, it state marks as APPLIER_OFF. Trigger on
change states reacts on this change with

replica_on_applier_state_f. That leads us to on_applier_sync. Instead we
should react on APPLIER_DISCONNECTED. And the only way we react on this
state  - is to try to load applier again.

So replica_on_applier_off is used in case when we want to stop applier
forever, before replica deletion. I think we do need this function. May be
in some other form that I did.

Other related posts: