Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>,
	tml <tarantool-patches@dev.tarantool.org>
Subject: Re: [Tarantool-patches] [PATCH v4 1/3] gc/xlog: delay xlog cleanup until relays are subscribed
Date: Wed, 24 Mar 2021 23:10:11 +0100	[thread overview]
Message-ID: <8faa2e1e-c198-832d-d527-1acf2280720d@tarantool.org> (raw)
In-Reply-To: <20210324163759.1900553-2-gorcunov@gmail.com>

Hi! Thanks for the patch!

All the CI jobs are red. Please, try to fix it.

See 2 comments below.

> diff --git a/src/box/box.cc b/src/box/box.cc
> index cc59564e1..a269f7357 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -1465,6 +1480,23 @@ box_set_wal_queue_max_size(void)
>  	return 0;
>  }
>  
> +int
> +box_set_wal_cleanup_delay(void)
> +{
> +	double delay = box_check_wal_cleanup_delay();
> +	if (delay < 0)
> +		return -1;
> +	/*
> +	 * Anonymous replicas do not require
> +	 * delay the cleanup procedure since they
> +	 * are read only.

1. It is not related to being read-only. Besides, they can write
to local spaces at least.

I think it is because anyway they can't be a source of replication.
There is no anybody to keep the files for.

> +	 */
> +	if (replication_anon)
> +		delay = 0;
> +	gc_set_wal_cleanup_delay(delay);
> +	return 0;
> +}
> diff --git a/src/box/gc.c b/src/box/gc.c
> index 9af4ef958..8dbcbcede 100644
> --- a/src/box/gc.c
> +++ b/src/box/gc.c> @@ -238,6 +243,41 @@ static int
>  gc_cleanup_fiber_f(va_list ap)
>  {
>  	(void)ap;
> +
> +	/*
> +	 * Stage 1 (optional): in case if we're booting
> +	 * up with cleanup disabled lets do wait in a
> +	 * separate cycle to minimize branching on stage 2.
> +	 */
> +	if (gc.is_paused) {
> +		double start_time = fiber_clock();
> +		while (!fiber_is_cancelled()) {
> +			double deadline = start_time + gc.wal_cleanup_delay;
> +			double timeout = gc.wal_cleanup_delay;

2. You didn't fix it really. Just that now the timeout is taken
fresh from the config still making it possible to go beyond the
deadline.

The fact that fiber_clock() < deadline does not mean that
fiber_clock() + timeout is also < deadline. You need to calculate
the timeout properly and try to cover it with a test.

> +
> +			if (fiber_clock() >= deadline ||
> +			    fiber_yield_timeout(timeout)) {
> +				say_info("wal/engine cleanup is resumed "
> +					 "due to timeout expiration");
> +				gc.is_paused = false;
> +				gc.delay_ref = 0;
> +				break;
> +			}
> +
> +			/*
> +			 * If a last reference is dropped
> +			 * we can exit out early.
> +			 */
> +			if (!gc.is_paused) {
> +				say_info("wal/engine cleanup is resumed");
> +				break;
> +			}
> +		}
> +	}

  reply	other threads:[~2021-03-24 22:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 16:37 [Tarantool-patches] [PATCH v4 0/3] " Cyrill Gorcunov via Tarantool-patches
2021-03-24 16:37 ` [Tarantool-patches] [PATCH v4 1/3] " Cyrill Gorcunov via Tarantool-patches
2021-03-24 22:10   ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-03-25 11:25     ` Cyrill Gorcunov via Tarantool-patches
2021-03-25 19:59       ` Vladislav Shpilevoy via Tarantool-patches
2021-03-25 21:02         ` Cyrill Gorcunov via Tarantool-patches
2021-03-25 21:29           ` Cyrill Gorcunov via Tarantool-patches
2021-03-25 23:50             ` Vladislav Shpilevoy via Tarantool-patches
2021-03-26  7:04               ` Cyrill Gorcunov via Tarantool-patches
2021-03-25 23:51           ` Vladislav Shpilevoy via Tarantool-patches
2021-03-26  7:04             ` Cyrill Gorcunov via Tarantool-patches
2021-03-24 16:37 ` [Tarantool-patches] [PATCH v4 2/3] test: add a test for wal_cleanup_delay option Cyrill Gorcunov via Tarantool-patches
2021-03-24 22:10   ` Vladislav Shpilevoy via Tarantool-patches
2021-03-25 12:07     ` Cyrill Gorcunov via Tarantool-patches
2021-03-25 19:56       ` Vladislav Shpilevoy via Tarantool-patches
2021-03-25 20:19         ` Cyrill Gorcunov via Tarantool-patches
2021-03-24 16:37 ` [Tarantool-patches] [PATCH v4 3/3] test: box-tap/gc -- add test for is_paused field 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=8faa2e1e-c198-832d-d527-1acf2280720d@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 1/3] gc/xlog: delay xlog cleanup until relays are subscribed' \
    /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