Tarantool development patches archive
 help / color / mirror / Atom feed
From: Georgy Kirichenko <georgy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Georgy Kirichenko <georgy@tarantool.org>
Subject: [tarantool-patches] [PATCH 1/3] Abort vinyl index creation in case of truncation rollback
Date: Wed, 20 Mar 2019 23:31:33 +0300	[thread overview]
Message-ID: <9e71736be4cc6add4fc856ae8756fcc24b04f4e6.1553112720.git.georgy@tarantool.org> (raw)
In-Reply-To: <cover.1553112720.git.georgy@tarantool.org>

Abort index create if truncate couldn't be finished because of rollback
or error. Without this vinyl will fail because of internal scheduler
assertion.

Needed for: 2798
---
 src/box/alter.cc            |  8 ++++++++
 test/engine/errinj.result   | 34 ++++++++++++++++++++++++++++++++++
 test/engine/errinj.test.lua | 12 ++++++++++++
 test/engine/suite.ini       |  1 +
 4 files changed, 55 insertions(+)
 create mode 100644 test/engine/errinj.result
 create mode 100644 test/engine/errinj.test.lua

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 431da12da..84e74ee89 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -1312,6 +1312,7 @@ public:
 	uint32_t iid;
 	virtual void prepare(struct alter_space *alter);
 	virtual void commit(struct alter_space *alter, int64_t signature);
+	virtual void rollback(struct alter_space *alter);
 };
 
 void
@@ -1349,6 +1350,13 @@ TruncateIndex::commit(struct alter_space *alter, int64_t signature)
 	index_commit_create(new_index, signature);
 }
 
+void
+TruncateIndex::rollback(struct alter_space *alter)
+{
+	struct index *new_index = space_index(alter->new_space, iid);
+	index_abort_create(new_index);
+}
+
 /**
  * UpdateSchemaVersion - increment schema_version. Used on
  * in alter_space_do(), i.e. when creating or dropping
diff --git a/test/engine/errinj.result b/test/engine/errinj.result
new file mode 100644
index 000000000..37fc280b9
--- /dev/null
+++ b/test/engine/errinj.result
@@ -0,0 +1,34 @@
+test_run = require('test_run')
+---
+...
+inspector = test_run.new()
+---
+...
+engine = inspector:get_cfg('engine')
+---
+...
+errinj = box.error.injection
+---
+...
+-- test truncate rollback does not abort
+s = box.schema.space.create('truncate_rollback', {engine = engine})
+---
+...
+_ = s:create_index('pk')
+---
+...
+errinj.set('ERRINJ_WAL_IO', true)
+---
+- ok
+...
+s:truncate()
+---
+- error: Failed to write to disk
+...
+errinj.set('ERRINJ_WAL_IO', false)
+---
+- ok
+...
+s:drop()
+---
+...
diff --git a/test/engine/errinj.test.lua b/test/engine/errinj.test.lua
new file mode 100644
index 000000000..ee5e36361
--- /dev/null
+++ b/test/engine/errinj.test.lua
@@ -0,0 +1,12 @@
+test_run = require('test_run')
+inspector = test_run.new()
+engine = inspector:get_cfg('engine')
+errinj = box.error.injection
+
+-- test truncate rollback does not abort
+s = box.schema.space.create('truncate_rollback', {engine = engine})
+_ = s:create_index('pk')
+errinj.set('ERRINJ_WAL_IO', true)
+s:truncate()
+errinj.set('ERRINJ_WAL_IO', false)
+s:drop()
diff --git a/test/engine/suite.ini b/test/engine/suite.ini
index 3f82a1325..3db02ab6f 100644
--- a/test/engine/suite.ini
+++ b/test/engine/suite.ini
@@ -3,6 +3,7 @@ core = tarantool
 description = tarantool multiengine tests
 script = box.lua
 use_unix_sockets = True
+release_disabled = errinj.test.lua
 config = engine.cfg
 #disabled = replica_join.test.lua
 lua_libs = conflict.lua ../box/lua/utils.lua ../box/lua/push.lua
-- 
2.21.0

  reply	other threads:[~2019-03-20 20:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 20:31 [tarantool-patches] [PATCH 0/3] Enable ddl between begin and commit statements Georgy Kirichenko
2019-03-20 20:31 ` Georgy Kirichenko [this message]
2019-03-21 20:16   ` [tarantool-patches] [PATCH 1/3] Abort vinyl index creation in case of truncation rollback Vladimir Davydov
2019-03-20 20:31 ` [tarantool-patches] [PATCH 2/3] Synchronize lua schema update with space cache Georgy Kirichenko
2019-03-20 20:31 ` [tarantool-patches] [PATCH 3/3] Require for single statement not autocommit in case of ddl Georgy Kirichenko

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=9e71736be4cc6add4fc856ae8756fcc24b04f4e6.1553112720.git.georgy@tarantool.org \
    --to=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/3] Abort vinyl index creation in case of truncation rollback' \
    /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