Merge pull request #6574 from guybe7/fix_xadd_empty_id

XADD with ID 0-0 stores an empty key
This commit is contained in:
Salvatore Sanfilippo
2019-11-19 10:50:45 +01:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -1220,6 +1220,14 @@ void xaddCommand(client *c) {
return;
}
/* Return ASAP if minimal ID (0-0) was given so we avoid possibly creating
* a new stream and have streamAppendItem fail, leaving an empty key in the
* database. */
if (id_given && id.ms == 0 && id.seq == 0) {
addReplyError(c,"The ID specified in XADD must be greater than 0-0");
return;
}
/* Lookup the stream at key. */
robj *o;
stream *s;