Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH 3/5] vinyl: encapsulate reader thread selection logic in a helper function
Date: Wed, 29 May 2019 21:24:40 +0300	[thread overview]
Message-ID: <20190529182440.GC6799@atlas> (raw)
In-Reply-To: <82705410db4b7fa6c31be8c20366bbd3d99a83e1.1559142561.git.vdavydov.dev@gmail.com>

* Vladimir Davydov <vdavydov.dev@gmail.com> [19/05/29 21:03]:
> Page reading code is intermixed with the reader thread selection in the
> same function, which makes it difficult to extend the former. So let's
> introduce a helper function encapsulating a call on behalf of a reader
> thread.
>  /**
> + * Execute a task on behalf of a reader thread.
> + * Calls free_cb on failure.
> + */
> +static int
> +vy_run_env_coio_call(struct vy_run_env *env, struct cbus_call_msg *msg,
> +		     cbus_call_f func, cbus_call_f free_cb, double timeout)
> +{
> +	/* Optimization: use blocking I/O during WAL recovery. */
> +	if (env->reader_pool == NULL) {
> +		if (func(msg) != 0)
> +			goto fail;
> +		return 0;
> +	}

this would be a great api if not for this optimization. Today not
involving free_cb on cbus_msg is harmless, but tomorrow may break
some logic. 

Please consider designing an API in a way that would work with
resources in the same way whether or not it is boot time or a coio
call.

The comment could also be extended, not reduced - e.g. explain why
we consider this an optimization, when exactly we perform reads
during recovery (for what statements, for example).


-- 
Konstantin Osipov, Moscow, Russia

  reply	other threads:[~2019-05-29 18:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 15:12 [PATCH 0/5] Hand over key lookup in a page to vinyl reader thread Vladimir Davydov
2019-05-29 15:12 ` [PATCH 1/5] vinyl: factor out function to lookup key in page Vladimir Davydov
2019-05-29 18:16   ` [tarantool-patches] " Konstantin Osipov
2019-05-29 15:12 ` [PATCH 2/5] vinyl: pass page info by reference to reader thread Vladimir Davydov
2019-05-29 18:16   ` [tarantool-patches] " Konstantin Osipov
2019-05-29 15:12 ` [PATCH 3/5] vinyl: encapsulate reader thread selection logic in a helper function Vladimir Davydov
2019-05-29 18:24   ` Konstantin Osipov [this message]
2019-05-29 15:12 ` [PATCH 4/5] vinyl: do not allow to cancel a fiber reading a page Vladimir Davydov
2019-05-29 18:35   ` [tarantool-patches] " Konstantin Osipov
2019-05-29 15:12 ` [PATCH 5/5] vinyl: lookup key in reader thread Vladimir Davydov
2019-05-29 18:41   ` [tarantool-patches] " Konstantin Osipov
2019-05-30  8:42 ` [PATCH 0/5] Hand over key lookup in a page to vinyl " Vladimir Davydov
2019-05-30 14:20   ` Vladimir Davydov

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=20190529182440.GC6799@atlas \
    --to=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH 3/5] vinyl: encapsulate reader thread selection logic in a helper function' \
    /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