ZSets double to string serialization fixed
This commit is contained in:
parent
9155ea9c71
commit
eaa256ad25
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
|
00-RELEASENOTES
|
||||||
*.o
|
*.o
|
||||||
*.rdb
|
*.rdb
|
||||||
|
*.log
|
||||||
redis-cli
|
redis-cli
|
||||||
redis-server
|
redis-server
|
||||||
redis-benchmark
|
redis-benchmark
|
||||||
@ -7,3 +9,4 @@ doc-tools
|
|||||||
mkrelease.sh
|
mkrelease.sh
|
||||||
release
|
release
|
||||||
myredis.conf
|
myredis.conf
|
||||||
|
misc/*
|
||||||
|
4
TODO
4
TODO
@ -6,8 +6,8 @@ VERSION 1.1 TODO
|
|||||||
* Add all the missing symbols for the static functions into the table. Crete a Tcl script to check this. This backtrace on segfault is indeed *very* useful.
|
* Add all the missing symbols for the static functions into the table. Crete a Tcl script to check this. This backtrace on segfault is indeed *very* useful.
|
||||||
* Use strcoll() to compare objects in sorted sets, like it already happens for SORT.
|
* Use strcoll() to compare objects in sorted sets, like it already happens for SORT.
|
||||||
* LMOVE, as discussed in the Redis group.
|
* LMOVE, as discussed in the Redis group.
|
||||||
* EXPIRE and EXPIREAT tests.
|
* EXPIRE, EXPIREAT, ZSCORE tests.
|
||||||
* Write docs for the "STORE" operaiton of SORT.
|
* Write docs for the "STORE" operaiton of SORT, and GET "#" option.
|
||||||
* Append only mode: testing and a command to rebuild the log from scratch.
|
* Append only mode: testing and a command to rebuild the log from scratch.
|
||||||
|
|
||||||
VERSION 1.2 TODO
|
VERSION 1.2 TODO
|
||||||
|
4
redis.c
4
redis.c
@ -2331,7 +2331,7 @@ static int rdbSaveDoubleValue(FILE *fp, double val) {
|
|||||||
len = 1;
|
len = 1;
|
||||||
buf[0] = (val < 0) ? 255 : 254;
|
buf[0] = (val < 0) ? 255 : 254;
|
||||||
} else {
|
} else {
|
||||||
snprintf((char*)buf+1,sizeof(buf)-1,"%.16g",val);
|
snprintf((char*)buf+1,sizeof(buf)-1,"%.17g",val);
|
||||||
buf[0] = strlen((char*)buf);
|
buf[0] = strlen((char*)buf);
|
||||||
len = buf[0]+1;
|
len = buf[0]+1;
|
||||||
}
|
}
|
||||||
@ -4307,7 +4307,7 @@ static void zscoreCommand(redisClient *c) {
|
|||||||
char buf[128];
|
char buf[128];
|
||||||
double *score = dictGetEntryVal(de);
|
double *score = dictGetEntryVal(de);
|
||||||
|
|
||||||
snprintf(buf,sizeof(buf),"%.16g",*score);
|
snprintf(buf,sizeof(buf),"%.17g",*score);
|
||||||
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n%s\r\n",
|
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n%s\r\n",
|
||||||
strlen(buf),buf));
|
strlen(buf),buf));
|
||||||
}
|
}
|
||||||
|
@ -789,8 +789,21 @@ proc main {server port} {
|
|||||||
} {{x y z} {y x z}}
|
} {{x y z} {y x z}}
|
||||||
|
|
||||||
test {ZSCORE} {
|
test {ZSCORE} {
|
||||||
list [$r zscore ztmp x] [$r zscore ztmp y] [$r zscore ztmp z]
|
set aux {}
|
||||||
} {10 1 30}
|
set err {}
|
||||||
|
for {set i 0} {$i < 1000} {incr i} {
|
||||||
|
set score [expr rand()]
|
||||||
|
lappend aux $score
|
||||||
|
$r zadd zscoretest $score $i
|
||||||
|
}
|
||||||
|
for {set i 0} {$i < 1000} {incr i} {
|
||||||
|
if {[$r zscore zscoretest $i] != [lindex $aux $i]} {
|
||||||
|
set err "Expected score was [lindex $aux $i] but got [$r zscore zscoretest $i] for element $i"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set _ $err
|
||||||
|
} {}
|
||||||
|
|
||||||
test {ZRANGE and ZREVRANGE} {
|
test {ZRANGE and ZREVRANGE} {
|
||||||
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]
|
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]
|
||||||
|
Loading…
Reference in New Issue
Block a user