Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] box: account index.pairs in box.stat.SELECT
@ 2019-04-11 19:44 Vladimir Davydov
  2019-04-11 20:04 ` Konstantin Osipov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Davydov @ 2019-04-11 19:44 UTC (permalink / raw)
  To: kostja; +Cc: tarantool-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-11 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 19:44 [PATCH] box: account index.pairs in box.stat.SELECT Vladimir Davydov
2019-04-11 20:04 ` Konstantin Osipov
2019-04-11 20:30   ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox