From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (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 B104142EF5C for ; Thu, 2 Jul 2020 13:01:14 +0300 (MSK) References: <20200629121118.21596-1-arkholga@tarantool.org> <20200629121118.21596-2-arkholga@tarantool.org> <20200701213447.GE5559@tarantool.org> From: Olga Arkhangelskaia Message-ID: <16d471e3-d578-7b12-6a4f-08814a2f1b64@tarantool.org> Date: Thu, 2 Jul 2020 13:01:13 +0300 MIME-Version: 1.0 In-Reply-To: <20200701213447.GE5559@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [Tarantool-patches] [PATCH 1/1] box: fixed box.info:memory() List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org, alexander.turenko@tarantool.org Hi Igor! Thanks for the review! I am sorry for  the confusion with the subject. It is box: fix box.info:memory(). I have fixed issue number all over the patch and added the paragraph  about arguments to the commit messae/ Now it looks like: Fix the output of box.info:memory(). It used to return the same table as the box.info(). Any box.info.xxx() is the same as box.info[“xxx”](). E.g. box.info.memory() -> getmetatable(box.info.memory).__call(box.info.memory)[1] After __index and __call metamethods, the final function that fills xxx-table, has the only argument - empty table to fill. When box.info:xxx() is invoked it automatically passes one argument: box.info[“xxx”](box.info). So the resulting call has 2 arguments on the stack. box.info:xxx()->getmetatable(box.info.xxx).__call(box.info.xxx, box.info) When function tries to fill box.info table - __call metamethod of box.info is trigged. box.info.gc does not have this problem because of an extra table that is created in the beginning of the bottom function. box.info.memory follows the same way. [1] https://www.lua.org/manual/5.1/manual.html#2.8 Closes 4688 02.07.2020 0:34, Igor Munkin пишет: > Olya, > > Thanks for the patch! I see the patch subject differs from the > corresponding commit subject you've pushed to the upstream. What is the > final one? Please also consider several nits I left below. > > On 29.06.20, Olga Arkhangelskaia wrote: >> Fix box.info:memory() output. Now it has the same output as box.info.memory(). >> --- >> Closes 4668 >> src/box/lua/info.c | 1 + >> test/box-tap/gh-4668-box-info-memory.test.lua | 15 +++++++++++++++ > Typo: s/gh-4668/gh-4688/. > >> 2 files changed, 16 insertions(+) >> create mode 100755 test/box-tap/gh-4668-box-info-memory.test.lua >> > > >> diff --git a/test/box-tap/gh-4668-box-info-memory.test.lua b/test/box-tap/gh-4668-box-info-memory.test.lua >> new file mode 100755 >> index 000000000..1a13fa903 >> --- /dev/null >> +++ b/test/box-tap/gh-4668-box-info-memory.test.lua >> @@ -0,0 +1,15 @@ >> +#!/usr/bin/env tarantool >> +-- >> +-- gh-4668: box.info:memory() displayed full content of box.info > Ditto. > >> +-- >> +local tap = require('tap') >> +local test = tap.test("Tarantool 4668") > Ditto. > >> +test:plan(1) >> + >> +box.cfg() >> + >> +a = box.info.memory() >> +b = box.info:memory() >> + >> +test:is(table.concat(a), table.concat(b), "box.info:memory") >> +os.exit(0) >> -- >> 2.20.1 (Apple Git-117) >>