From 3c2425daf53eb764e114cb0b52d967bca26301f5 Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Mon, 16 Jul 2018 13:24:54 +0800 Subject: [PATCH] Streams: show last id for streams and groups --- src/t_stream.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/t_stream.c b/src/t_stream.c index 54d6b0d1f18a..c152bd6786aa 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -2279,18 +2279,20 @@ NULL raxSeek(&ri,"^",NULL,0); while(raxNext(&ri)) { streamCG *cg = ri.data; - addReplyMultiBulkLen(c,6); + addReplyMultiBulkLen(c,8); addReplyStatus(c,"name"); addReplyBulkCBuffer(c,ri.key,ri.key_len); addReplyStatus(c,"consumers"); addReplyLongLong(c,raxSize(cg->consumers)); addReplyStatus(c,"pending"); addReplyLongLong(c,raxSize(cg->pel)); + addReplyStatus(c,"last-delivered-id"); + addReplyStreamID(c,&cg->last_id); } raxStop(&ri); } else if (!strcasecmp(opt,"STREAM") && c->argc == 3) { /* XINFO STREAM (or the alias XINFO ). */ - addReplyMultiBulkLen(c,12); + addReplyMultiBulkLen(c,14); addReplyStatus(c,"length"); addReplyLongLong(c,s->length); addReplyStatus(c,"radix-tree-keys"); @@ -2299,6 +2301,8 @@ NULL addReplyLongLong(c,s->rax->numnodes); addReplyStatus(c,"groups"); addReplyLongLong(c,s->cgroups ? raxSize(s->cgroups) : 0); + addReplyStatus(c,"last-id"); + addReplyStreamID(c,&s->last_id); /* To emit the first/last entry we us the streamReplyWithRange() * API. */