From aab74b7151c8ce646f24c65405f3fd5f58c03577 Mon Sep 17 00:00:00 2001 From: Guy Benoish Date: Tue, 28 Apr 2020 17:58:25 +0300 Subject: [PATCH] XINFO STREAM FULL should have a default COUNT of 10 --- src/t_stream.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/t_stream.c b/src/t_stream.c index d6a5e0009..5c1b9a523 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -2493,7 +2493,7 @@ void xtrimCommand(client *c) { * Handles the variants of XINFO STREAM */ void xinfoReplyWithStreamInfo(client *c, stream *s) { int full = 1; - long long count = 0; + long long count = 10; /* Default COUNT is 10 so we don't block the server */ robj **optv = c->argv + 3; /* Options start after XINFO STREAM */ int optc = c->argc - 3; @@ -2521,7 +2521,7 @@ void xinfoReplyWithStreamInfo(client *c, stream *s) { } if (getLongLongFromObjectOrReply(c,optv[2],&count,NULL) == C_ERR) return; - if (count < 0) count = 0; + if (count < 0) count = 10; } } @@ -2548,11 +2548,11 @@ void xinfoReplyWithStreamInfo(client *c, stream *s) { end.ms = end.seq = UINT64_MAX; addReplyBulkCString(c,"first-entry"); emitted = streamReplyWithRange(c,s,&start,&end,1,0,NULL,NULL, - STREAM_RWR_RAWENTRIES,NULL); + STREAM_RWR_RAWENTRIES,NULL); if (!emitted) addReplyNull(c); addReplyBulkCString(c,"last-entry"); emitted = streamReplyWithRange(c,s,&start,&end,1,1,NULL,NULL, - STREAM_RWR_RAWENTRIES,NULL); + STREAM_RWR_RAWENTRIES,NULL); if (!emitted) addReplyNull(c); } else { /* XINFO STREAM FULL [COUNT ] */ @@ -2682,6 +2682,10 @@ void xinfoCommand(client *c) { "CONSUMERS -- Show consumer groups of group .", "GROUPS -- Show the stream consumer groups.", "STREAM [FULL [COUNT ]] -- Show information about the stream.", +" FULL will return the full state of the stream,", +" including all entries, groups, consumers and PELs.", +" It's possible to show only the first stream/PEL entries", +" by using the COUNT modifier (Default is 10)", "HELP -- Print this help.", NULL };