Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v10 3/4] limbo: filter incoming synchro requests
Date: Mon, 9 Aug 2021 01:35:55 +0300	[thread overview]
Message-ID: <YRBcSxfh46sJsakO@grain> (raw)
In-Reply-To: <7e881b83-478c-6bc0-615d-ade811da8471@tarantool.org>

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

  reply	other threads:[~2021-08-08 22:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 19:07 [Tarantool-patches] [PATCH v10 0/4] limbo: implement packets filtering Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 1/4] latch: add latch_is_locked helper Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 2/4] limbo: order access to the limbo terms Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:29   ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06 15:20     ` Cyrill Gorcunov via Tarantool-patches
2021-08-08 14:34       ` Vladislav Shpilevoy via Tarantool-patches
2021-08-09 16:24         ` Cyrill Gorcunov via Tarantool-patches
2021-08-10 12:27           ` Vladislav Shpilevoy via Tarantool-patches
2021-08-10 12:57             ` Cyrill Gorcunov via Tarantool-patches
2021-08-23 11:32     ` Serge Petrenko via Tarantool-patches
2021-08-23 11:41       ` Cyrill Gorcunov via Tarantool-patches
2021-09-01 16:04         ` Cyrill Gorcunov via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 3/4] limbo: filter incoming synchro requests Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:33   ` Vladislav Shpilevoy via Tarantool-patches
2021-08-06 19:01     ` Cyrill Gorcunov via Tarantool-patches
2021-08-08 11:43       ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 22:35         ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-08-10 12:31           ` Vladislav Shpilevoy via Tarantool-patches
2021-08-10 14:36             ` Cyrill Gorcunov via Tarantool-patches
2021-08-12 16:59               ` Vladislav Shpilevoy via Tarantool-patches
2021-08-04 19:07 ` [Tarantool-patches] [PATCH v10 4/4] test: add replication/gh-6036-rollback-confirm Cyrill Gorcunov via Tarantool-patches
2021-08-05  9:38 ` [Tarantool-patches] [PATCH v10 0/4] limbo: implement packets filtering Cyrill Gorcunov via Tarantool-patches
2021-08-05 23:29 ` Vladislav Shpilevoy via Tarantool-patches
2021-08-08 22:03   ` Cyrill Gorcunov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRBcSxfh46sJsakO@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v10 3/4] limbo: filter incoming synchro requests' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox