Skip to content
Snippets Groups Projects
Commit 96758992 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

box.slab.stats(): return a correct tuple, not a multi-return

Make box.slab.stats() output CALL compatible.
parent bc912acb
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,8 @@ small_stats_lua_cb(const struct mempool_stats *stats, void *cb_ctx) ...@@ -63,6 +63,8 @@ small_stats_lua_cb(const struct mempool_stats *stats, void *cb_ctx)
* Create a Lua table for every slab class. A class is * Create a Lua table for every slab class. A class is
* defined by its item size. * defined by its item size.
*/ */
/** Assign next slab size to the next member of an array. */
lua_pushnumber(L, lua_objlen(L, -1) + 1);
lua_newtable(L); lua_newtable(L);
/** /**
* This is in fact only to force YaML flow "compact" for this * This is in fact only to force YaML flow "compact" for this
...@@ -94,6 +96,7 @@ small_stats_lua_cb(const struct mempool_stats *stats, void *cb_ctx) ...@@ -94,6 +96,7 @@ small_stats_lua_cb(const struct mempool_stats *stats, void *cb_ctx)
luaL_pushuint64(L, stats->objcount); luaL_pushuint64(L, stats->objcount);
lua_settable(L, -3); lua_settable(L, -3);
lua_settable(L, -3);
return 0; return 0;
} }
...@@ -103,7 +106,7 @@ static int ...@@ -103,7 +106,7 @@ static int
lbox_slab_stats(struct lua_State *L) lbox_slab_stats(struct lua_State *L)
{ {
struct small_stats totals; struct small_stats totals;
int top = lua_gettop(L); lua_newtable(L);
/* /*
* List all slabs used for tuples and slabs used for * List all slabs used for tuples and slabs used for
* indexes, with their stats. * indexes, with their stats.
...@@ -113,7 +116,7 @@ lbox_slab_stats(struct lua_State *L) ...@@ -113,7 +116,7 @@ lbox_slab_stats(struct lua_State *L)
mempool_stats(&memtx_index_extent_pool, &index_stats); mempool_stats(&memtx_index_extent_pool, &index_stats);
small_stats_lua_cb(&index_stats, L); small_stats_lua_cb(&index_stats, L);
return lua_gettop(L) - top; return 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment