From: Pieter Noordhuis Date: Thu, 6 May 2010 19:06:09 +0000 (+0200) Subject: Merge branch 'master' into check-aof X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/98d2e23be23f9af02653672081896747baf985f7?hp=81330149f84f26c3e0492a296acfce7bd55d783f Merge branch 'master' into check-aof --- diff --git a/redis.c b/redis.c index 05f1c64a..465398ad 100644 --- a/redis.c +++ b/redis.c @@ -3221,7 +3221,7 @@ static int getDoubleFromObject(robj *o, double *target) { } else if (o->encoding == REDIS_ENCODING_INT) { value = (long)o->ptr; } else { - redisAssert(1 != 1); + redisPanic("Unknown string encoding"); } } @@ -3258,7 +3258,7 @@ static int getLongLongFromObject(robj *o, long long *target) { } else if (o->encoding == REDIS_ENCODING_INT) { value = (long)o->ptr; } else { - redisAssert(1 != 1); + redisPanic("Unknown string encoding"); } } @@ -6462,12 +6462,11 @@ static void hincrbyCommand(redisClient *c) { if (getLongLongFromObjectOrReply(c,c->argv[3],&incr,NULL) != REDIS_OK) return; if ((o = hashLookupWriteOrCreate(c,c->argv[1])) == NULL) return; if ((current = hashGet(o,c->argv[2])) != NULL) { - if (current->encoding == REDIS_ENCODING_RAW) - value = strtoll(current->ptr,NULL,10); - else if (current->encoding == REDIS_ENCODING_INT) - value = (long)current->ptr; - else - redisAssert(1 != 1); + if (getLongLongFromObjectOrReply(c,current,&value, + "hash value is not an integer") != REDIS_OK) { + decrRefCount(current); + return; + } decrRefCount(current); } else { value = 0; diff --git a/redis.conf b/redis.conf index 909f03bf..377d947a 100644 --- a/redis.conf +++ b/redis.conf @@ -16,15 +16,15 @@ # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. daemonize no -# When run as a daemon, Redis write a pid file in /var/run/redis.pid by default. -# You can specify a custom pid file location here. +# When running daemonized, Redis writes a pid file in /var/run/redis.pid by +# default. You can specify a custom pid file location here. pidfile /var/run/redis.pid # Accept connections on the specified port, default is 6379 port 6379 # If you want you can bind a single interface, if the bind option is not -# specified all the interfaces will listen for connections. +# specified all the interfaces will listen for incoming connections. # # bind 127.0.0.1 @@ -40,7 +40,7 @@ timeout 300 loglevel verbose # Specify the log file name. Also 'stdout' can be used to force -# the demon to log on the standard output. Note that if you use standard +# Redis to log on the standard output. Note that if you use standard # output for logging but daemonize, logs will be sent to /dev/null logfile stdout @@ -78,8 +78,14 @@ rdbcompression yes # The filename where to dump the DB dbfilename dump.rdb -# For default save/load DB in/from the working directory -# Note that you must specify a directory not a file name. +# The working directory. +# +# The DB will be written inside this directory, with the filename specified +# above using the 'dbfilename' configuration directive. +# +# Also the Append Only File will be created inside this directory. +# +# Note that you must specify a directory here, not a file name. dir ./ ################################# REPLICATION ################################# diff --git a/test-redis.tcl b/test-redis.tcl index 8f71c624..d4a9ecdb 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -1898,11 +1898,15 @@ proc main {} { list [$r hincrby smallhash tmp 17179869184] [$r hincrby bighash tmp 17179869184] } {34359738368 34359738368} - test {HINCRBY against key with spaces (no integer encoded)} { - $r hset smallhash tmp " 11 " - $r hset bighash tmp " 11 " - list [$r hincrby smallhash tmp 1] [$r hincrby bighash tmp 1] - } {12 12} + test {HINCRBY fails against hash value with spaces} { + $r hset smallhash str " 11 " + $r hset bighash str " 11 " + catch {$r hincrby smallhash str 1} smallerr + catch {$r hincrby smallhash str 1} bigerr + set rv {} + lappend rv [string match "ERR*not an integer*" $smallerr] + lappend rv [string match "ERR*not an integer*" $bigerr] + } {1 1} # TODO: # Randomized test, small and big