Remove XINFO <key> special form.

As observed by Michael Grunder this usage while practical is
inconsistent because for instance it does not work against a key called
HELP. Removed.
This commit is contained in:
antirez 2018-06-05 16:34:31 +02:00
parent 2f123ea6a3
commit 9e25f3e1de

View File

@ -2131,14 +2131,12 @@ void xtrimCommand(client *c) {
/* XINFO CONSUMERS key group /* XINFO CONSUMERS key group
* XINFO GROUPS <key> * XINFO GROUPS <key>
* XINFO STREAM <key> * XINFO STREAM <key>
* XINFO <key> (alias of XINFO STREAM key)
* XINFO HELP. */ * XINFO HELP. */
void xinfoCommand(client *c) { void xinfoCommand(client *c) {
const char *help[] = { const char *help[] = {
"CONSUMERS <key> <groupname> -- Show consumer groups of group <groupname>.", "CONSUMERS <key> <groupname> -- Show consumer groups of group <groupname>.",
"GROUPS <key> -- Show the stream consumer groups.", "GROUPS <key> -- Show the stream consumer groups.",
"STREAM <key> -- Show information about the stream.", "STREAM <key> -- Show information about the stream.",
"<key> -- Alias for STREAM <key>.",
"HELP -- Print this help.", "HELP -- Print this help.",
NULL NULL
}; };
@ -2150,16 +2148,15 @@ NULL
if (!strcasecmp(c->argv[1]->ptr,"HELP")) { if (!strcasecmp(c->argv[1]->ptr,"HELP")) {
addReplyHelp(c, help); addReplyHelp(c, help);
return; return;
} else if (c->argc < 3) {
addReplyError(c,"syntax error, try 'XINFO HELP'");
return;
} }
/* Handle the fact that no subcommand means "STREAM". */ /* With the exception of HELP handled before any other sub commands, all
if (c->argc == 2) { * the ones are in the form of "<subcommand> <key>". */
opt = "STREAM";
key = c->argv[1];
} else {
opt = c->argv[1]->ptr; opt = c->argv[1]->ptr;
key = c->argv[2]; key = c->argv[2];
}
/* Lookup the key now, this is common for all the subcommands but HELP. */ /* Lookup the key now, this is common for all the subcommands but HELP. */
robj *o = lookupKeyWriteOrReply(c,key,shared.nokeyerr); robj *o = lookupKeyWriteOrReply(c,key,shared.nokeyerr);
@ -2218,9 +2215,7 @@ NULL
addReplyLongLong(c,raxSize(cg->pel)); addReplyLongLong(c,raxSize(cg->pel));
} }
raxStop(&ri); raxStop(&ri);
} else if (c->argc == 2 || } else if (!strcasecmp(opt,"STREAM") && c->argc == 3) {
(!strcasecmp(opt,"STREAM") && c->argc == 3))
{
/* XINFO STREAM <key> (or the alias XINFO <key>). */ /* XINFO STREAM <key> (or the alias XINFO <key>). */
addReplyMultiBulkLen(c,12); addReplyMultiBulkLen(c,12);
addReplyStatus(c,"length"); addReplyStatus(c,"length");