[Tarantool-patches] [PATCH v2] Add new error injection constant ERRINJ_AUTO_UPGRADE

sergeyb at tarantool.org sergeyb at tarantool.org
Mon May 18 18:10:06 MSK 2020


From: Sergey Bronnikov <sergeyb at 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



More information about the Tarantool-patches mailing list