From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH] box: account index.pairs in box.stat.SELECT Date: Thu, 11 Apr 2019 22:44:25 +0300 Message-Id: <0f5fb28d436492ba232a23ae5972eae45078c2a9.1555011830.git.vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: box.stat.SELECT accounts index.get and index.select, but not index.pairs, which is confusing since pairs() may be used even more often than select() in a Lua application. --- https://github.com/tarantool/tarantool/commits/dv/account-pairs-in-stat-select src/box/index.cc | 1 + test/box/stat.result | 39 +++++++++++++++++++++++++++++++++++++++ test/box/stat.test.lua | 12 ++++++++++++ 3 files changed, 52 insertions(+) diff --git a/src/box/index.cc b/src/box/index.cc index 3c53ae81..2817d076 100644 --- a/src/box/index.cc +++ b/src/box/index.cc @@ -380,6 +380,7 @@ box_index_iterator(uint32_t space_id, uint32_t index_id, int type, return NULL; } txn_commit_ro_stmt(txn); + rmean_collect(rmean_box, IPROTO_SELECT, 1); return it; } diff --git a/test/box/stat.result b/test/box/stat.result index af1607db..757ec0bc 100644 --- a/test/box/stat.result +++ b/test/box/stat.result @@ -70,6 +70,45 @@ box.stat.ERROR.total --- - 1 ... +-- select, get, and pairs +space:get(1) +--- +- [1, 'tuple1'] +... +box.stat.SELECT.total +--- +- 5 +... +space:get(11) +--- +... +box.stat.SELECT.total +--- +- 6 +... +space:select(5) +--- +- - [5, 'tuple5'] +... +box.stat.SELECT.total +--- +- 7 +... +space:select(15) +--- +- [] +... +box.stat.SELECT.total +--- +- 8 +... +for _ in space:pairs() do end +--- +... +box.stat.SELECT.total +--- +- 9 +... -- reset box.stat.reset() --- diff --git a/test/box/stat.test.lua b/test/box/stat.test.lua index 65555127..6ee1ec44 100644 --- a/test/box/stat.test.lua +++ b/test/box/stat.test.lua @@ -26,6 +26,18 @@ box.stat.SELECT.total space:get('Impossible value') box.stat.ERROR.total +-- select, get, and pairs +space:get(1) +box.stat.SELECT.total +space:get(11) +box.stat.SELECT.total +space:select(5) +box.stat.SELECT.total +space:select(15) +box.stat.SELECT.total +for _ in space:pairs() do end +box.stat.SELECT.total + -- reset box.stat.reset() box.stat.INSERT.total -- 2.11.0