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: [PATCH 6/6] Replace schema lock with fine-grained locking
Date: Mon, 8 Jul 2019 11:41:18 +0300	[thread overview]
Message-ID: <20190708084118.4nqq6zko2ypmstc4@esperanza> (raw)
In-Reply-To: <20190708074053.GA3352@atlas>

On Mon, Jul 08, 2019 at 10:40:53AM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/07/04 20:10]:
> 
> Come to think about this commit, it still raises a lot of
> questions.
> 
> What is it taken for entire alter_space_do while it protects alter_space_prepare
> only?

Simply because it's easier to write the code that way. Since we only
care about yields, the lock has no effect if no operation yields.
OTOH taking the lock early makes alter_space_do fail early in case the
space happens to be busy.

> 
> Why is it necessary to protect the yields from prepare, but not
> from WAL?

Once we submitted a request to WAL, we don't really care about
concurrent DDL modifying the space as we are done working with it.
We only care that the space doesn't go away until we run the commit
or rollback trigger. And it can't go away, because other DDL operations
will wait for WAL as well, which orders them to happen after us.

> 
> Why is not not taken when a new space is created? What happens
> when box.schema.space:create() is run concurrently from two
> fibers, would that work without a lock? Why?

We don't need to take the lock when a space is created or dropped,
because those operations never yield.

Concurrent requests are ordered by the WAL just like any other
concurrent DDL.

> 
> These questions should at least be addressed in the comments to
> the lock class. 

Urgh... Isn't it obvious?

> 
> And since the lock is wrapped around long yielding operations,
> perhaps it should be taken by objects which do these operations,
> like CheckSpaceFormat and CreateIndex (it is easy to grant the
> lock to a fiber which already owns it, so each object could be
> taken its own lock)?

I think of locks as protecting objects, not pieces of code. This
particular lock protects the space struct from getting modified by
a concurrent request. I don't see any benefit resulting from taking
it deeper in the call stack - it would only spread the logic between
different functions.

  reply	other threads:[~2019-07-08  8:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-30 19:40 [PATCH 0/6] Get rid of the schema lock Vladimir Davydov
2019-06-30 19:40 ` [PATCH 1/6] Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers Vladimir Davydov
2019-07-03 19:12   ` Konstantin Osipov
2019-07-04 15:50     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY Vladimir Davydov
2019-07-03 19:13   ` Konstantin Osipov
2019-07-04 15:51     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 3/6] Don't take schema lock for checkpointing Vladimir Davydov
2019-07-03 19:21   ` Konstantin Osipov
2019-07-03 20:05     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 4/6] test: make vinyl/replica_rejoin more stable Vladimir Davydov
2019-07-03 19:23   ` Konstantin Osipov
2019-07-04 15:51     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 5/6] vinyl: don't yield while logging index creation Vladimir Davydov
2019-06-30 19:40 ` [PATCH 6/6] Replace schema lock with fine-grained locking Vladimir Davydov
2019-07-03 19:35   ` Konstantin Osipov
2019-07-03 19:56     ` Vladimir Davydov
2019-07-04  8:09       ` Konstantin Osipov
2019-07-04 17:06         ` Vladimir Davydov
2019-07-08  7:40           ` Konstantin Osipov
2019-07-08  8:41             ` Vladimir Davydov [this message]
2019-07-05  8:53 ` [PATCH 0/6] Get rid of the schema lock 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=20190708084118.4nqq6zko2ypmstc4@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 6/6] Replace schema lock with fine-grained locking' \
    /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