From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp21.mail.ru (smtp21.mail.ru [94.100.179.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0C070469710 for ; Fri, 15 May 2020 20:14:21 +0300 (MSK) Date: Fri, 15 May 2020 20:14:00 +0300 From: Alexander Turenko Message-ID: <20200515171400.b6wrrp7bdqwq2y62@tkn_work_nb> References: <20200330101324.GA31497@pony.bronevichok.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200330101324.GA31497@pony.bronevichok.ru> Subject: Re: [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Bronnikov Cc: Oleg Piskunov , tarantool-patches@dev.tarantool.org On Mon, Mar 30, 2020 at 01:13:24PM +0300, Sergey Bronnikov wrote: > 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. Nit: It is over 72 symbols. See https://www.tarantool.io/en/doc/1.10/dev_guide/developer_guidelines/#how-to-write-a-commit-message > > Ticket: https://github.com/tarantool/tarantool/issues/4801 > GitHub branch: https://github.com/tarantool/tarantool/tree/ligurio/gh-4801-errinj_auto_upgrade Nit: Such metainfo usually placed under '---' marks to match `git am` patch format: text under '---' is not part of a commit message. A commit message should contain 'Part of #4801' or so. > > --- > src/box/lua/init.c | 2 ++ > src/box/lua/init.h | 2 ++ > src/box/lua/load_cfg.lua | 2 +- > src/lib/core/errinj.h | 1 + > test/box/errinj.result | 4 +++- > test/box/errinj.test.lua | 4 +++- > 6 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/src/box/lua/init.c b/src/box/lua/init.c > index 63e8b8216..fc26ad175 100644 > --- a/src/box/lua/init.c > +++ b/src/box/lua/init.c > @@ -34,6 +34,8 @@ > #include > #include > > +#include "errinj.h" > + Unneeded diff. > diff --git a/src/box/lua/init.h b/src/box/lua/init.h > index 66ef66063..65f9aea8f 100644 > --- a/src/box/lua/init.h > +++ b/src/box/lua/init.h > @@ -31,6 +31,8 @@ > * SUCH DAMAGE. > */ > > +#include > + Unneeded diff. > diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua > index b671eb7a2..394a00168 100644 > --- a/src/box/lua/load_cfg.lua > +++ b/src/box/lua/load_cfg.lua > @@ -571,7 +571,7 @@ local function load_cfg(cfg) > end > end > end > - if not box.cfg.read_only and not box.cfg.replication then > + if box.error.injection.get('ERRINJ_AUTO_UPGRADE') or (not box.cfg.read_only and not box.cfg.replication) then > box.schema.upgrade{auto = true} > end > end ERRINJ_AUTO_UPGRADE is false by default, so the default behaviour becomes "don't upgrade". I think you meant: | 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 Nit: Over 80 symbols. > diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua > index 5d8f4c635..a6d4eecd4 100644 > --- a/test/box/errinj.test.lua > +++ b/test/box/errinj.test.lua > @@ -15,7 +15,9 @@ index = space:create_index('primary', { type = 'hash' }) > ekeys = {} > evals = {} > for k, v in pairs(errinj.info()) do \ > - table.insert(ekeys, k) \ > + if not (k == "ERRINJ_AUTO_UPGRADE") then \ > + table.insert(ekeys, k) \ > + end \ ERRINJ_AUTO_UPGRADE is not different from other injections, let it be in `ekeys`. Just update the result file.