From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 082AA469710 for ; Tue, 12 May 2020 19:17:49 +0300 (MSK) Date: Tue, 12 May 2020 19:17:31 +0300 From: Alexander Turenko Message-ID: <20200512161731.tnramfar7q535f4a@tkn_work_nb> References: <20191114115020.21091-1-maria.khaydich@tarantool.org> <1579344991.266039392@f319.i.mail.ru> <20200220175124.pwj24lx3jz4w6zcm@tkn_work_nb> <1583942274.319390956@f377.i.mail.ru> <20200318222602.GF6392@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200318222602.GF6392@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH 1/2] box: make box.cfg idempotent function List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org I updated the patchset and placed it on the Totktonada/gh-4231-box-execute-idempotence branch. I'll send it soon. Aside of changes around Igor's review I made the following changes: * Rewrote w/o ffi call, using a module local variable. * Fixed to actually reconfigure box (reload_cfg(cfg) -> reload_cfg(box.cfg, cfg)). * Replace box.execute with lbox_execute at end of box loading. * Added a test for () and box.execute() at box loading (in parallel in separate fibers). * Polished tests: remove execute_is_immutable() function, splitted box.execute and box.cfg tests. * Clarified dynamic box option set functions contract. > > +local function box_is_configured() > > +    return ffi.C.box_is_configured() > > +end > > + > > Minor: Since box_is_configured is introduced within this patchset it > could be placed properly in the first patch of the series. Feel free to > ignore. Fixed. > > diff --git a/test/box-tap/gh-4231-immutable-box-execute.test.lua b/test/box-tap/gh-4231-immutable-box-execute.test.lua > > Minor: test chunk name is left unchanged since the previous version and > doesn't respect the commit message wording. Renamed to gh-4231-box-execute-idempotence.test.lua. > > --- gh-4231: box.execute should be an idempotent function > > --- meaning its effect should be the same if a user chooses > > --- to use it before explicit box.cfg invocation > > +-- gh-4231: box.execute should be an idempotent function meaning > > +-- its effect should be the same if the user chooses to save it > > +-- before explicit box.cfg{} invocation and use the saved version > > +-- afterwards. > > +-- Within the scope of the same issue box.cfg method should also > > +-- be kept idempotent for the same reasons. > >  -- > >   > > -local function execute_is_immutable(execute, cmd, msg) > > -    local status, err = pcall(execute, cmd) > > -    test:ok(status and type(err) == 'table', msg) > > -end > > - > >  local box_execute_stub = box.execute > > --- explicit call to load_cfg > > +local box_cfg_stub = box.cfg > > + > > +-- Explicit box configuration that used to change the behavior. > >  box.cfg{} > > + > >  local box_execute_actual = box.execute > > +local box_cfg_actual = box.cfg > >   > > -execute_is_immutable(box_execute_stub, > > +local function is_idempotent(method, cmd, msg) > > Minor: IMHO these changes are better to be moved to the first patch of > the series. Feel free to ignore. Fixed.