Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH] vinyl: don't yield in on_commit and on_rollback triggers
Date: Thu, 20 Jun 2019 14:18:00 +0300	[thread overview]
Message-ID: <20190620111800.xryhvwdyls627cr2@esperanza> (raw)
In-Reply-To: <20190619182329.GC6260@atlas>

On Wed, Jun 19, 2019 at 09:23:29PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/06/16 16:11]:
> 
> Basically the patch is LGTM but I would not use a mempool
> vy_log_tx but more strongly  a a region for vy_log records - these
> are rare events (less than a handful a second per instance) and
> using a malloc for such is entirely justified.
> 
> On the other hand I don't see any harm from using these (memory is
> not pinned for along period of time, for example), so please feel
> free to not bother with the comment.
> 
> > +vy_log_flusher_func(va_list va)
> 
> The convention is that we simply write _f for fiber functions at the
> end.
> 
> I also did not find the place where you cancel or kill the fiber -
> you assume it runs forever - please document it, since otherwise
> the infinite fiber loop looks confusing.

Pushed to master with the following changes:

diff --git a/src/box/vy_log.c b/src/box/vy_log.c
index ae1d6234..098a0141 100644
--- a/src/box/vy_log.c
+++ b/src/box/vy_log.c
@@ -159,7 +159,13 @@ struct vy_log {
 	 * log rotation.
 	 */
 	struct latch latch;
-	/** Background fiber flushing pending transactions. */
+	/**
+	 * Background fiber flushing pending transactions.
+	 * Lives throughout the vinyl engine lifetime. Note,
+	 * we don't stop it in destructor, because the event
+	 * loop is dead at that time so we can't properly
+	 * join it.
+	 */
 	struct fiber *flusher;
 	/** Condition variable used for signalling the flusher. */
 	struct fiber_cond flusher_cond;
@@ -196,7 +202,7 @@ struct vy_log {
 static struct vy_log vy_log;
 
 static int
-vy_log_flusher_func(va_list va);
+vy_log_flusher_f(va_list va);
 
 static struct vy_recovery *
 vy_recovery_new_locked(int64_t signature, int flags);
@@ -761,7 +767,7 @@ vy_log_init(const char *dir)
 	wal_init_vy_log();
 	fiber_cond_create(&vy_log.flusher_cond);
 	vy_log.flusher = fiber_new("vinyl.vylog_flusher",
-				   vy_log_flusher_func);
+				   vy_log_flusher_f);
 	if (vy_log.flusher == NULL)
 		panic("failed to allocate vylog flusher fiber");
 	fiber_wakeup(vy_log.flusher);
@@ -887,7 +893,7 @@ vy_log_flush(void)
 }
 
 static int
-vy_log_flusher_func(va_list va)
+vy_log_flusher_f(va_list va)
 {
 	(void)va;
 	while (!fiber_is_cancelled()) {

      reply	other threads:[~2019-06-20 11:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 18:00 Vladimir Davydov
2019-06-19 18:23 ` [tarantool-patches] " Konstantin Osipov
2019-06-20 11:18   ` Vladimir Davydov [this message]

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=20190620111800.xryhvwdyls627cr2@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH] vinyl: don'\''t yield in on_commit and on_rollback triggers' \
    /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