* [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE
@ 2020-03-30 10:13 Sergey Bronnikov
2020-03-30 13:11 ` Sergey Bronnikov
2020-05-15 17:14 ` Alexander Turenko
0 siblings, 2 replies; 4+ messages in thread
From: Sergey Bronnikov @ 2020-03-30 10:13 UTC (permalink / raw)
To: tarantool-patches; +Cc: Oleg Piskunov
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.
Ticket: https://github.com/tarantool/tarantool/issues/4801
GitHub branch: https://github.com/tarantool/tarantool/tree/ligurio/gh-4801-errinj_auto_upgrade
---
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 <lauxlib.h>
#include <lualib.h>
+#include "errinj.h"
+
#include "lua/utils.h" /* luaT_error() */
#include "lua/trigger.h"
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 <stdbool.h>
+
#if defined(__cplusplus)
extern "C" {
#endif /* defined(__cplusplus) */
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
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..d4584022a 100644
--- a/test/box/errinj.result
+++ b/test/box/errinj.result
@@ -29,7 +29,9 @@ 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 \
end
---
...
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 \
end
table.sort(ekeys)
for i, k in ipairs(ekeys) do \
--
2.23.0
--
sergeyb@
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE
2020-03-30 10:13 [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE Sergey Bronnikov
@ 2020-03-30 13:11 ` Sergey Bronnikov
2020-05-15 17:14 ` Alexander Turenko
1 sibling, 0 replies; 4+ messages in thread
From: Sergey Bronnikov @ 2020-03-30 13:11 UTC (permalink / raw)
To: tarantool-patches; +Cc: Oleg Piskunov
+ A.Tikhonov and A.Turenko
On 13:13 Mon 30 Mar , 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.
>
> Ticket: https://github.com/tarantool/tarantool/issues/4801
> GitHub branch: https://github.com/tarantool/tarantool/tree/ligurio/gh-4801-errinj_auto_upgrade
>
> ---
> 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 <lauxlib.h>
> #include <lualib.h>
>
> +#include "errinj.h"
> +
> #include "lua/utils.h" /* luaT_error() */
> #include "lua/trigger.h"
>
> 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 <stdbool.h>
> +
> #if defined(__cplusplus)
> extern "C" {
> #endif /* defined(__cplusplus) */
> 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
> 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..d4584022a 100644
> --- a/test/box/errinj.result
> +++ b/test/box/errinj.result
> @@ -29,7 +29,9 @@ 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 \
> end
> ---
> ...
> 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 \
> end
> table.sort(ekeys)
> for i, k in ipairs(ekeys) do \
> --
> 2.23.0
>
>
> --
> sergeyb@
--
sergeyb@
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE
2020-03-30 10:13 [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE Sergey Bronnikov
2020-03-30 13:11 ` Sergey Bronnikov
@ 2020-05-15 17:14 ` Alexander Turenko
2020-05-18 15:05 ` Sergey Bronnikov
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Turenko @ 2020-05-15 17:14 UTC (permalink / raw)
To: Sergey Bronnikov; +Cc: Oleg Piskunov, tarantool-patches
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 <lauxlib.h>
> #include <lualib.h>
>
> +#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 <stdbool.h>
> +
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE
2020-05-15 17:14 ` Alexander Turenko
@ 2020-05-18 15:05 ` Sergey Bronnikov
0 siblings, 0 replies; 4+ messages in thread
From: Sergey Bronnikov @ 2020-05-18 15:05 UTC (permalink / raw)
To: Alexander Turenko; +Cc: Oleg Piskunov, tarantool-patches
Hello,
many thanks for review! See my comments inline.
On 20:14 Fri 15 May , Alexander Turenko wrote:
> 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
Updated.
> > 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.
Updated.
> >
> > ---
> > 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 <lauxlib.h>
> > #include <lualib.h>
> >
> > +#include "errinj.h"
> > +
>
> Unneeded diff.
Removed.
> > 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 <stdbool.h>
> > +
>
> Unneeded diff.
Removed.
> > 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:
Agree, updated condition.
> | 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.
Updated result file.
--
sergeyb@
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-18 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 10:13 [Tarantool-patches] [PATCH] Add new error injection constant ERRINJ_AUTO_UPGRADE Sergey Bronnikov
2020-03-30 13:11 ` Sergey Bronnikov
2020-05-15 17:14 ` Alexander Turenko
2020-05-18 15:05 ` Sergey Bronnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox