Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v8 1/2] applier: send transaction's first row WAL time in the applier_writer_f
Date: Thu, 17 Jun 2021 12:16:35 +0300
Message-ID: <68c348fe-7029-db28-8457-a95d03e6923e@tarantool.org> (raw)
In-Reply-To: <YMn9dg8JNQm5Xl0p@grain>



16.06.2021 16:32, Cyrill Gorcunov пишет:
> On Tue, Jun 15, 2021 at 12:36:02PM +0300, Serge Petrenko wrote:
>>> @@ -193,6 +196,16 @@ applier_writer_f(va_list ap)
>>>    			applier->has_acks_to_send = false;
>>>    			struct xrow_header xrow;
>>>    			xrow_encode_vclock(&xrow, &replicaset.vclock);
>>> +			/*
>>> +			 * For relay lag statistics we report last
>>> +			 * written transaction timestamp in tm field.
>>> +			 *
>>> +			 * Replica might be dead already so we have to
>>> +			 * test on each iteration.
>>> +			 */
>>> +			struct replica *r = replica_by_id(replica_id);
>>> +			if (likely(r != NULL))
>>> +				xrow.tm = r->applier_txn_start_tm;
>> How could a replica be dead here?
>> AFAIR we delete a replica only when it's deleted from _cluster. Shouldn't
>> the applier writer be dead as well by that time?
> Before accessing replica_by_id we're sitting in event loop trying to
> fetch data from the network. Which means an admin may cleanup the
> entry manually before we get back to this code in result we will
> get a nil dereference (if only I'm not missing something).

I mean that this code you're referring to is executed in a
while (!fiber_is_cancelled()) {...} loop.

IIRC applier->writer gets cancelled as soon as replica is unregistered.
So even if someone deletes the entry manually the writer will exit the loop
before getting a nil dereference.

P.S. I couldn't find this anywhere in code so let's leave the check.

-- 
Serge Petrenko


  reply	other threads:[~2021-06-17  9:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 15:55 [Tarantool-patches] [PATCH v8 0/2] relay: provide downstream lag information Cyrill Gorcunov via Tarantool-patches
2021-06-07 15:55 ` [Tarantool-patches] [PATCH v8 1/2] applier: send transaction's first row WAL time in the applier_writer_f Cyrill Gorcunov via Tarantool-patches
2021-06-07 19:20   ` Vladislav Shpilevoy via Tarantool-patches
2021-06-15  9:36   ` Serge Petrenko via Tarantool-patches
2021-06-16 13:32     ` Cyrill Gorcunov via Tarantool-patches
2021-06-17  9:16       ` Serge Petrenko via Tarantool-patches [this message]
2021-06-07 15:55 ` [Tarantool-patches] [PATCH v8 2/2] relay: provide information about downstream lag Cyrill Gorcunov via Tarantool-patches
2021-06-07 19:21   ` Vladislav Shpilevoy via Tarantool-patches
2021-06-08  8:40     ` Cyrill Gorcunov via Tarantool-patches
2021-06-08  9:58       ` Cyrill Gorcunov via Tarantool-patches
2021-06-08 18:15       ` Vladislav Shpilevoy via Tarantool-patches
2021-06-15 10:03   ` Serge Petrenko via Tarantool-patches
2021-06-17  6:55     ` Cyrill Gorcunov via Tarantool-patches
2021-06-17  9:01       ` Serge Petrenko via Tarantool-patches
2021-06-17  9:58         ` Cyrill Gorcunov via Tarantool-patches
2021-06-07 19:20 ` [Tarantool-patches] [PATCH v8 0/2] relay: provide downstream lag information Vladislav Shpilevoy via Tarantool-patches
2021-06-07 20:00   ` 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=68c348fe-7029-db28-8457-a95d03e6923e@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergepetrenko@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    /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

Tarantool development patches archive

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lists.tarantool.org/tarantool-patches/0 tarantool-patches/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tarantool-patches tarantool-patches/ https://lists.tarantool.org/tarantool-patches \
		tarantool-patches@dev.tarantool.org.
	public-inbox-index tarantool-patches

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git