Tarantool development patches archive
 help / color / mirror / Atom feed
From: sergeyb@tarantool.org
To: tarantool-patches@dev.tarantool.org
Cc: alexander.turenko@tarantool.org
Subject: [Tarantool-patches] [PATCH v2] Add new error injection constant ERRINJ_AUTO_UPGRADE
Date: Mon, 18 May 2020 18:10:06 +0300	[thread overview]
Message-ID: <1dde0d093dc53b6a7819780b11801ae1ceba04ca.1589814593.git.sergeyb@tarantool.org> (raw)

From: Sergey Bronnikov <sergeyb@tarantool.org>

In upgrade testing we need an ability to control running of upgrade.lua
script execution. When constant ERRINJ_AUTO_UPGRADE is set to true
tarantool will skip upgrade.lua script execution.

Part of: #4801
---
GH issue: https://github.com/tarantool/tarantool/issues/4801
GH branch: https://github.com/tarantool/tarantool/compare/ligurio/gh-4801-errinj_auto_upgrade

 src/box/lua/load_cfg.lua | 3 ++-
 src/lib/core/errinj.h    | 1 +
 test/box/errinj.result   | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index b671eb7a2..9feedaa40 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -571,7 +571,8 @@ local function load_cfg(cfg)
             end
         end
     end
-    if not box.cfg.read_only and not box.cfg.replication then
+    if not box.cfg.read_only and not box.cfg.replication and
+       not box.error.injection.get('ERRINJ_AUTO_UPGRADE') then
         box.schema.upgrade{auto = true}
     end
 end
diff --git a/src/lib/core/errinj.h b/src/lib/core/errinj.h
index ee6c57a0d..7eaa1ac48 100644
--- a/src/lib/core/errinj.h
+++ b/src/lib/core/errinj.h
@@ -139,6 +139,7 @@ struct errinj {
 	_(ERRINJ_FIBER_MPROTECT, ERRINJ_INT, {.iparam = -1}) \
 	_(ERRINJ_RELAY_FASTER_THAN_TX, ERRINJ_BOOL, {.bparam = false}) \
 	_(ERRINJ_INDEX_RESERVE, ERRINJ_BOOL, {.bparam = false})\
+	_(ERRINJ_AUTO_UPGRADE, ERRINJ_BOOL, {.bparam = false})\
 
 ENUM0(errinj_id, ERRINJ_LIST);
 extern struct errinj errinjs[];
diff --git a/test/box/errinj.result b/test/box/errinj.result
index 0d3fedeb3..9dfd8653d 100644
--- a/test/box/errinj.result
+++ b/test/box/errinj.result
@@ -43,7 +43,8 @@ end
 ...
 evals
 ---
-- - ERRINJ_BUILD_INDEX: -1
+- - ERRINJ_AUTO_UPGRADE: false
+  - ERRINJ_BUILD_INDEX: -1
   - ERRINJ_BUILD_INDEX_DELAY: false
   - ERRINJ_CHECK_FORMAT_DELAY: false
   - ERRINJ_COIO_SENDFILE_CHUNK: -1
-- 
2.23.0

             reply	other threads:[~2020-05-18 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 15:10 sergeyb [this message]
2020-06-02 11:56 ` Alexander Turenko
2020-06-04 11:35 ` Kirill Yukhin

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=1dde0d093dc53b6a7819780b11801ae1ceba04ca.1589814593.git.sergeyb@tarantool.org \
    --to=sergeyb@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2] Add new error injection constant ERRINJ_AUTO_UPGRADE' \
    /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