[Tarantool-patches] [PATCH v10 3/4] limbo: filter incoming synchro requests

Cyrill Gorcunov gorcunov at gmail.com
Mon Aug 9 01:35:55 MSK 2021


On Sun, Aug 08, 2021 at 02:43:14PM +0300, Vladislav Shpilevoy wrote:
> >>> +	txn_limbo_filter_disable(&txn_limbo);
> >>> +	auto filter_guard = make_scoped_guard([&]{
> >>> +		txn_limbo_filter_enable(&txn_limbo);
> >>> +	});
> >>
> >> 3. Why do you need to enable/disabled the filter here? Shouldn't snapshot
> >> contain only valid data? Moreover, AFAIU it can't contain any limbo
> >> rows at all. The limbo snapshot is sent separately, but the data flow
> >> does not have anything except pure data. The same for the
> >> join.
> > 
> > The idea is that snapshot/recovery has valid data which forms the initial
> > limbo state versus which we will be apply filtering.
> 
> You didn't answer the question really. Why do you need the filtering
> here if all the data is correct anyway? Will it all work if I just
> drop this filter disable from here?

Vlad, I answered to this but a bit later in the reply

  | Actually this is a good question. I've to recheck this moment because in
  | previous series when I ran join/recovery with filtering enabled sometime
  | I've an issues where filter didnt pass. Gimme some time, maybe we will
  | all this and manage to keep filtering all the time.

I saw errors in test (not in our new test but in rpelication/ tests). And
I need to figure out with more attention about the stages where I must
disable the filtering and where I can leave filtering turned on. In all
stages (local recovery, initial and final joins). Once I recheck everything
again I'll come back with precise reply.

> >> And how is it related to applier_register below? It does not download
> >> any data at all, does it?
> > 
> > After register stage is complete we catch up with lates not yet downloaded
> > data (final join stage) where we still assume that the data received is
> > valid and do not verify it.
> 
> Register just makes the master give you a unique ID. It does not send
> any data like joins do, AFAIR. Does it work if you drop the filter disable
> from here?

I suspect I overdid in paranoia, will recheck.

> > Actually this is a good question. I've to recheck this moment because in
> > previous series when I ran join/recovery with filtering enabled sometime
> > I've an issues where filter didnt pass. Gimme some time, maybe we will
> > all this and manage to keep filtering all the time.
> > 
> >>> +
> >>> +/**
> >>> + * Common chain for any incoming packet.
> >>> + */
> >>> +static int
> >>> +filter_in(struct txn_limbo *limbo, const struct synchro_request *req)
> >>> +{
> >>> +	(void)limbo;
> >>
> >> 6. So you have the filtering enabled dynamically in the limbo, but
> >> you do not use the limbo here? Why? Maybe at least add an assertion
> >> that the filter is enabled?
> > 
> > All chains are having same interface it is just happen that for common
> > filter I don't need to use limbo. I could add some operations here
> > but not sure if it worth it. As far as I see leave unused args is
> > pretty fine in our code base.
> 
> You didn't answer the second question:
> 
> 	Maybe at least add an assertion that the filter is enabled?

I did

  | I could add some operations here but not sure if it worth it.

Letme state it clear then - I could add this assert() if you insist
but I think we aready spread too many assertions all over the code,
and if it is possible I would be glad not to add new ones. After all
either we should add this assert() to each filter chain or not add
at all, otherwise there will be kind of code imbalance.

> >>> +/**
> >>> + * Filter CONFIRM and ROLLBACK packets.
> >>> + */
> >>> +static int
> >>> +filter_confirm_rollback(struct txn_limbo *limbo,
> >>> +			const struct synchro_request *req)
> >>> +{
> >>> +	/*
> >>> +	 * When limbo is empty we have nothing to
> >>> +	 * confirm/commit and if this request comes
> >>> +	 * in it means the split brain has happened.
> >>> +	 */
> >>> +	if (!txn_limbo_is_empty(limbo))
> >>> +		return 0;
> >>
> >> 9. What if rollback is for LSN > limbo's last LSN? It
> >> also means nothing to do. The same for confirm LSN < limbo's
> >> first LSN.
> > 
> > static void
> > txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn)
> > {
> > -->	assert(limbo->owner_id != REPLICA_ID_NIL || txn_limbo_is_empty(limbo));
> > 
> > txn_limbo_read_confirm(struct txn_limbo *limbo, int64_t lsn)
> > {
> > -->	assert(limbo->owner_id != REPLICA_ID_NIL || txn_limbo_is_empty(limbo));
> > 
> > Currently we're allowed to process empty limbo if only owner is not nil,
> > I think I should add this case here.
> 
> My question is not about the owner ID. I asked what if rollback/confirm
> try to cover a range not present in the limbo while it is not empty. If
> it is not empty, it has an owner obviously. But it does not matter.
> What if it has an owner, has transactions, but you got ROLLBACK/CONFIRM
> for data out of the LSN range present in the limbo?

Since the terms are matching I think such scenarion should be fine, right?
IOW, some old replica has been stopped for some reason and been living out
of quorum for some time thus such requests should be considered as OK to
pass and when filter accepts them the will reach txn_limbo_read_confirm
or txn_limbo_read_rollback where they will be simply ignored as far as I
unrestand. IOW, such requests are valid, no?

> > 
> > Good catch, typo. Actually I've updated this hunk locally
> > but didn't pushed out. We need "first <= promote <= last"
> 
> Is it covered with a test?

Not yet, to test _each_ filter condition we've a separate ticket
which I didn't implement yet (split-brain common bug which all
about tests).

...

> > 
> > Kind of this?
> 
> Yes! It is much simpler and still easy to extend. Please,
> just try and you will see how much simpler it is.

OK


More information about the Tarantool-patches mailing list