Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: georgy@tarantool.org, tarantool-patches@freelists.org
Subject: [PATCH 0/4] Abort vinyl transactions before switching to ro
Date: Mon,  4 Mar 2019 18:39:23 +0300	[thread overview]
Message-ID: <cover.1551713282.git.vdavydov.dev@gmail.com> (raw)

In contrast to memtx, vinyl transactions may yield, which opens a time
window for the instance to switch to read-only mode. Since we check ro
flag only before executing a dml request, nothing prevents a transaction
from committing in such a case. This breaks master-replica switching
logic implemented by one of our customers, which justifiably assumes
that no local writes are allowed on an instance once box.cfg{read_only}
returns.

Fix this by forcefully aborting all local rw transactions in vinyl
before switching to read-only mode.

https://github.com/tarantool/tarantool/issues/4016
https://github.com/tarantool/tarantool/commits/dv/gh-4016-vy-abort-writers-for-ro

This patch set is an alternative approach to the fix proposed by Georgy,
for more details see discussion started at:

https://www.freelists.org/post/tarantool-patches/PATCH-Do-not-enable-commit-if-read-only-true

Vladimir Davydov (4):
  vinyl: rename tx statement begin/rollback routines
  vinyl: add tx to writers list in begin_statement engine callback
  engine: add switch_to_ro callback
  vinyl: abort rw transactions when instance switches to ro

 src/box/blackhole.c        |  1 +
 src/box/box.cc             |  7 ++++
 src/box/engine.c           | 14 ++++++++
 src/box/engine.h           | 13 ++++++++
 src/box/memtx_engine.c     |  1 +
 src/box/sysview.c          |  1 +
 src/box/vinyl.c            | 18 +++++++----
 src/box/vy_tx.c            | 34 +++++++++++++++++---
 src/box/vy_tx.h            | 35 +++++++++++++-------
 test/vinyl/errinj.result   | 76 +++++++++++++++++++++++++++++++++++++++++++
 test/vinyl/errinj.test.lua | 30 +++++++++++++++++
 test/vinyl/misc.result     | 80 ++++++++++++++++++++++++++++++++++++++++++++++
 test/vinyl/misc.test.lua   | 39 ++++++++++++++++++++++
 13 files changed, 327 insertions(+), 22 deletions(-)

-- 
2.11.0

             reply	other threads:[~2019-03-04 15:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 15:39 Vladimir Davydov [this message]
2019-03-04 15:39 ` [PATCH 1/4] vinyl: rename tx statement begin/rollback routines Vladimir Davydov
2019-03-05  7:29   ` Konstantin Osipov
2019-03-04 15:39 ` [PATCH 2/4] vinyl: add tx to writers list in begin_statement engine callback Vladimir Davydov
2019-03-05  7:30   ` Konstantin Osipov
2019-03-04 15:39 ` [PATCH 3/4] engine: add switch_to_ro callback Vladimir Davydov
2019-03-05  7:31   ` Konstantin Osipov
2019-03-04 15:39 ` [PATCH 4/4] vinyl: abort rw transactions when instance switches to ro Vladimir Davydov
2019-03-05  7:43   ` Konstantin Osipov
2019-03-05  8:35     ` 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=cover.1551713282.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=georgy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 0/4] Abort vinyl transactions before switching to ro' \
    /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