[PATCH 10/13] gc: improve box.info.gc output

Vladimir Davydov vdavydov.dev at gmail.com
Thu Oct 4 20:20:12 MSK 2018


Report vclocks in addition to signatures. When box.info.gc was first
introduced we used signatures in gc. Now we use vclocks so there's no
reason not to report them. This is consistent with box.info output
(there's vclock and signature).

Report the vclock and signature of the oldest WAL row available on the
instance under box.info.gc().vclock. Without this information the user
would have to figure it out by looking at box.info.gc().consumers.
---
 src/box/lua/info.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/box/lua/info.c b/src/box/lua/info.c
index 97d5aba3..9e51b823 100644
--- a/src/box/lua/info.c
+++ b/src/box/lua/info.c
@@ -365,13 +365,25 @@ lbox_info_gc_call(struct lua_State *L)
 
 	lua_newtable(L);
 
+	lua_pushstring(L, "vclock");
+	lbox_pushvclock(L, &gc.vclock);
+	lua_settable(L, -3);
+
+	lua_pushstring(L, "signature");
+	luaL_pushint64(L, vclock_sum(&gc.vclock));
+	lua_settable(L, -3);
+
 	lua_pushstring(L, "checkpoints");
 	lua_newtable(L);
 
 	count = 0;
 	struct gc_checkpoint *checkpoint;
 	gc_foreach_checkpoint(checkpoint) {
-		lua_createtable(L, 0, 1);
+		lua_createtable(L, 0, 2);
+
+		lua_pushstring(L, "vclock");
+		lbox_pushvclock(L, &checkpoint->vclock);
+		lua_settable(L, -3);
 
 		lua_pushstring(L, "signature");
 		luaL_pushint64(L, vclock_sum(&checkpoint->vclock));
@@ -390,12 +402,16 @@ lbox_info_gc_call(struct lua_State *L)
 	count = 0;
 	struct gc_consumer *consumer;
 	while ((consumer = gc_consumer_iterator_next(&consumers)) != NULL) {
-		lua_createtable(L, 0, 2);
+		lua_createtable(L, 0, 3);
 
 		lua_pushstring(L, "name");
 		lua_pushstring(L, consumer->name);
 		lua_settable(L, -3);
 
+		lua_pushstring(L, "vclock");
+		lbox_pushvclock(L, &consumer->vclock);
+		lua_settable(L, -3);
+
 		lua_pushstring(L, "signature");
 		luaL_pushint64(L, vclock_sum(&consumer->vclock));
 		lua_settable(L, -3);
-- 
2.11.0




More information about the Tarantool-patches mailing list