Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v3 0/3] Fix DML vs DDL race
Date: Thu, 28 Mar 2019 19:17:47 +0300	[thread overview]
Message-ID: <cover.1553789818.git.vdavydov.dev@gmail.com> (raw)

In Vinyl a DML request may yield on disk read while still having a
pointer to the target space saved on stack. If the space is altered
during this time window, the DML request will most certainly crash
while trying to dereference the stale pointer when it resumes. The
solution is simple: abort all affected transactions whenever we delete
a space from the cache.

https://github.com/tarantool/tarantool/issues/3420
https://github.com/tarantool/tarantool/commits/dv/gh-3420-vy-abort-tx-in-ddl

Changes in v3:
 - Keep track of the *space* affected by the last prepared statement
   rather than the LSM tree.

v2: https://www.freelists.org/post/tarantool-patches/PATCH-v2-03-Fix-DML-vs-DDL-race

Changes in v2:
 - Instead of introducing a per transaction space hash, simply remember
   the pointer to the last prepared index. Thanks to Kostja for the tip.
 - Drop the patch allowing transactions affecting only replica local
   spaces outlast a switch to read-only mode, as we can't easily
   implement it without a per transaction space hash. Anyway, it was out
   of the scope of this issue.

v1: https://www.freelists.org/post/tarantool-patches/PATCH-04-Fix-DML-vs-DDL-race

Vladimir Davydov (3):
  vinyl: make tx_manager_abort_writers_for_ddl more thorough
  vinyl: abort affected transactions when space is removed from cache
  Revert "test: skip ddl test for vinyl on travis"

 rpm/tarantool.spec             |   2 -
 src/box/blackhole.c            |   1 +
 src/box/memtx_space.c          |   1 +
 src/box/schema.cc              |   3 ++
 src/box/space.c                |   6 +++
 src/box/space.h                |  15 ++++++
 src/box/sysview.c              |   1 +
 src/box/vinyl.c                |  33 ++++++++++---
 src/box/vy_point_lookup.c      |  14 ++++++
 src/box/vy_read_iterator.c     |  13 +++++
 src/box/vy_tx.c                |  14 ++++--
 src/box/vy_tx.h                |  15 ++++--
 test/vinyl/ddl.skipcond        |   6 ---
 test/vinyl/errinj_ddl.result   | 110 +++++++++++++++++++++++++++++++++++++++++
 test/vinyl/errinj_ddl.test.lua |  51 +++++++++++++++++++
 15 files changed, 265 insertions(+), 20 deletions(-)
 delete mode 100644 test/vinyl/ddl.skipcond

-- 
2.11.0

             reply	other threads:[~2019-03-28 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 16:17 Vladimir Davydov [this message]
2019-03-28 16:17 ` [PATCH v3 1/3] vinyl: make tx_manager_abort_writers_for_ddl more thorough Vladimir Davydov
2019-03-28 16:17 ` [PATCH v3 2/3] vinyl: abort affected transactions when space is removed from cache Vladimir Davydov
2019-03-28 16:17 ` [PATCH v3 3/3] Revert "test: skip ddl test for vinyl on travis" Vladimir Davydov
2019-03-28 17:53 ` [PATCH v3 0/3] Fix DML vs DDL race 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.1553789818.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v3 0/3] Fix DML vs DDL race' \
    /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