Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH] tarantoolctl: remove metatable assumptions in start()
Date: Mon, 1 Apr 2019 08:43:05 +0300	[thread overview]
Message-ID: <20190401054304.kofvdg3uz6fzwl5d@tkn_work_nb> (raw)
In-Reply-To: <20190327134014.56676-1-roman.habibov@tarantool.org>

Commented in the issue, cited here:

> @opomuc @olegrok I don't know what are you trying to do here. It seems
> you just try to start an instance w/o box.cfg() call inside. I don't
> see a reason to support this case. However more meaningful error
> message from tarantoolctl start in the case would helpful.
>
> Re config module errors: I don't know whether you use it correctly. If
> so, file another issue to this module.
>
> https://github.com/tarantool/tarantool/issues/3953#issuecomment-478439448

I propose to consider this issue as a problem with an error message.

WBR, Alexander Turenko.

On Wed, Mar 27, 2019 at 04:40:14PM +0300, Roman Khabibov wrote:
> box.cfg{} metatables are uninitialized when start() called
> before box.cfg{}. It led to unexpected error.
> 
> Closes #3953
> ---
> Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3953-tctl
> Issue: https://github.com/tarantool/tarantool/issues/3953
> 
>  extra/dist/tarantoolctl.in         | 7 -------
>  test/app-tap/tarantoolctl.test.lua | 4 +++-
>  2 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
> index 47fcf895f..91747e3ba 100755
> --- a/extra/dist/tarantoolctl.in
> +++ b/extra/dist/tarantoolctl.in
> @@ -547,13 +547,6 @@ local function start()
>          end
>          os.exit(1)
>      end
> -    local old_call = getmetatable(box.cfg).__call
> -    getmetatable(box.cfg).__call = function(old_cfg, cfg)
> -        if old_cfg.pid_file ~= nil and cfg ~= nil and cfg.pid_file ~= nil then
> -            cfg.pid_file = old_cfg.pid_file

So if a user lean on that value (s)he now cannot?

> -        end
> -        old_call(old_cfg, cfg)

So if a user set a metatable on box.cfg() with __call method, it will
not more called?

> -    end
>      return 0
>  end
>  
> diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
> index db046e03f..1755fcc66 100755
> --- a/test/app-tap/tarantoolctl.test.lua
> +++ b/test/app-tap/tarantoolctl.test.lua
> @@ -165,10 +165,12 @@ do
>      local dir = fio.tempdir()
>      local code = [[ box.cfg{memtx_memory = 104857600} ]]
>      create_script(dir, 'script.lua', code)
> +    create_script(dir, 'init.lua', [[ print('Hi!') ]])
>  
>      local status, err = pcall(function()
>          test:test("basic test", function(test_i)
> -            test_i:plan(16)
> +            test_i:plan(18)
> +            check_ok(test_i, dir, 'start', 'init.lua', 0, nil, "Starting instance init...")

So we're 'successfully' started an instance, it executes a script and
then 'tarantoolctl status' and 'tarantoolctl enter' don't show it as
running. It does not look as a right behaviour.

>              check_ok(test_i, dir, 'start',  'script', 0, nil, "Starting instance")
>              tctl_wait_start(dir, 'script')
>              check_ok(test_i, dir, 'status', 'script', 0, nil, "is running")
> -- 
> 2.20.1 (Apple Git-117)
> 

  parent reply	other threads:[~2019-04-01  5:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 13:40 [tarantool-patches] " Roman Khabibov
2019-03-28  8:59 ` [tarantool-patches] " Konstantin Osipov
2019-04-01  5:43 ` Alexander Turenko [this message]
2019-04-05 23:26   ` Roman Khabibov
2019-04-11 14:57     ` Alexander Turenko
2019-04-12  9:29       ` Roman Khabibov
2019-04-14 22:41         ` Alexander Turenko
2019-04-15 10:59           ` Roman Khabibov
2019-04-15 12:55             ` Alexander Turenko
2019-04-16 12:01 ` 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=20190401054304.kofvdg3uz6fzwl5d@tkn_work_nb \
    --to=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH] tarantoolctl: remove metatable assumptions in start()' \
    /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