From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <alexander.turenko@tarantool.org>
Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149])
 (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 8D0BE46970E
 for <tarantool-patches@dev.tarantool.org>;
 Thu, 26 Dec 2019 17:08:36 +0300 (MSK)
Date: Thu, 26 Dec 2019 17:08:35 +0300
From: Alexander Turenko <alexander.turenko@tarantool.org>
Message-ID: <20191226140834.urhg7ude4b5zkep4@tkn_work_nb>
References: <20191114115020.21091-1-maria.khaydich@tarantool.org>
 <20191217143940.GQ1214@tarantool.org>
 <1577201550.829136486@f483.i.mail.ru>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <1577201550.829136486@f483.i.mail.ru>
Subject: Re: [Tarantool-patches] [PATCH] box: make box.execute() immutable
List-Id: Tarantool development patches <tarantool-patches.dev.tarantool.org>
List-Unsubscribe: <https://lists.tarantool.org/mailman/options/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=unsubscribe>
List-Archive: <https://lists.tarantool.org/pipermail/tarantool-patches/>
List-Post: <mailto:tarantool-patches@dev.tarantool.org>
List-Help: <mailto:tarantool-patches-request@dev.tarantool.org?subject=help>
List-Subscribe: <https://lists.tarantool.org/mailman/listinfo/tarantool-patches>, 
 <mailto:tarantool-patches-request@dev.tarantool.org?subject=subscribe>
To: Maria Khaydich <maria.khaydich@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy <v.shpilevoy@tarantool.org>

>  function box.execute(...)
> -    load_cfg()
> +    --
> +    -- Calling box.execute before explicitly configuring box led to
> +    -- automatic box.cfg invocation nonetheless. Following explicit
> +    -- attempts to configure box led to its reconfiguratin and as a 
> +    -- result - to an error when trying to use execute method again. 
> +    -- The check makes sure box.execute is an immutable function.
> +    --

I would describe all this hell with registering lbox_execute as
box.execute, moving it to box_cfg_guard_whitelist, adding this
box.execute function, then replacing back with lbox_execute at
load_cfg().

This description would make clear why everything is fine if we just call
box.execute(), but extra flag is necessary if a user saved box.execute
before first box.execute() or box.cfg() call.