From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 0/4] Abort vinyl transactions before switching to ro Date: Mon, 4 Mar 2019 18:39:23 +0300 Message-Id: To: kostja@tarantool.org Cc: georgy@tarantool.org, tarantool-patches@freelists.org List-ID: 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