diff --git a/src/t_stream.c b/src/t_stream.c index 55d06dd75..7838b92b0 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -574,7 +574,7 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end while(streamIteratorGetID(&si,&id,&numfields)) { /* Emit a two elements array for each item. The first is * the ID, the second is an array of field-value pairs. */ - sds replyid = sdscatfmt(sdsempty(),"+%U.%U\r\n",id.ms,id.seq); + sds replyid = sdscatfmt(sdsempty(),"+%U-%U\r\n",id.ms,id.seq); addReplyMultiBulkLen(c,2); addReplySds(c,replyid); addReplyMultiBulkLen(c,numfields*2); @@ -660,7 +660,7 @@ int streamParseIDOrReply(client *c, robj *o, streamID *id, uint64_t missing_seq) } /* Parse . form. */ - char *dot = strchr(buf,'.'); + char *dot = strchr(buf,'-'); if (dot) *dot = '\0'; uint64_t ms, seq; if (string2ull(buf,&ms) == 0) goto invalid; @@ -740,7 +740,7 @@ void xaddCommand(client *c) { "target stream top item"); return; } - sds reply = sdscatfmt(sdsempty(),"+%U.%U\r\n",id.ms,id.seq); + sds reply = sdscatfmt(sdsempty(),"+%U-%U\r\n",id.ms,id.seq); addReplySds(c,reply); signalModifiedKey(c->db,c->argv[1]); @@ -764,7 +764,7 @@ void xaddCommand(client *c) { /* Let's rewrite the ID argument with the one actually generated for * AOF/replication propagation. */ robj *idarg = createObject(OBJ_STRING, - sdscatfmt(sdsempty(),"%U.%U",id.ms,id.seq)); + sdscatfmt(sdsempty(),"%U-%U",id.ms,id.seq)); rewriteClientCommandArgument(c,i,idarg); decrRefCount(idarg); diff --git a/tests/unit/type/stream.tcl b/tests/unit/type/stream.tcl index e9f187ae2..06f31e08c 100644 --- a/tests/unit/type/stream.tcl +++ b/tests/unit/type/stream.tcl @@ -1,8 +1,8 @@ # return value is like strcmp() and similar. proc streamCompareID {a b} { if {$a eq $b} {return 0} - lassign [split $a .] a_ms a_seq - lassign [split $b .] b_ms b_seq + lassign [split $a -] a_ms a_seq + lassign [split $b -] b_ms b_seq if {$a_ms > $b_ms} {return 1} if {$a_ms < $b_ms} {return -1} # Same ms case, compare seq. @@ -14,9 +14,9 @@ proc streamCompareID {a b} { # Note that this function does not care to handle 'seq' overflow # since it's a 64 bit value. proc streamNextID {id} { - lassign [split $id .] ms seq + lassign [split $id -] ms seq incr seq - join [list $ms $seq] . + join [list $ms $seq] - } # Generate a random stream entry ID with the ms part between min and max @@ -24,12 +24,12 @@ proc streamNextID {id} { # XRANGE against a Tcl implementation implementing the same concept # with Tcl-only code in a linear array. proc streamRandomID {min_id max_id} { - lassign [split $min_id .] min_ms min_seq - lassign [split $max_id .] max_ms max_seq + lassign [split $min_id -] min_ms min_seq + lassign [split $max_id -] max_ms max_seq set delta [expr {$max_ms-$min_ms+1}] set ms [expr {$min_ms+[randomInt $delta]}] set seq [randomInt 1000] - return $ms.$seq + return $ms-$seq } # Tcl-side implementation of XRANGE to perform fuzz testing in the Redis