Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
98d2e23b
Commit
98d2e23b
authored
May 06, 2010
by
Pieter Noordhuis
Browse files
Merge branch 'master' into check-aof
parents
81330149
946342c1
Changes
3
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
98d2e23b
...
@@ -3221,7 +3221,7 @@ static int getDoubleFromObject(robj *o, double *target) {
...
@@ -3221,7 +3221,7 @@ static int getDoubleFromObject(robj *o, double *target) {
} else if (o->encoding == REDIS_ENCODING_INT) {
} else if (o->encoding == REDIS_ENCODING_INT) {
value = (long)o->ptr;
value = (long)o->ptr;
} else {
} else {
redis
Assert(1 != 1
);
redis
Panic("Unknown string encoding"
);
}
}
}
}
...
@@ -3258,7 +3258,7 @@ static int getLongLongFromObject(robj *o, long long *target) {
...
@@ -3258,7 +3258,7 @@ static int getLongLongFromObject(robj *o, long long *target) {
} else if (o->encoding == REDIS_ENCODING_INT) {
} else if (o->encoding == REDIS_ENCODING_INT) {
value = (long)o->ptr;
value = (long)o->ptr;
} else {
} else {
redis
Assert(1 != 1
);
redis
Panic("Unknown string encoding"
);
}
}
}
}
...
@@ -6462,12 +6462,11 @@ static void hincrbyCommand(redisClient *c) {
...
@@ -6462,12 +6462,11 @@ static void hincrbyCommand(redisClient *c) {
if (getLongLongFromObjectOrReply(c,c->argv[3],&incr,NULL) != REDIS_OK) return;
if (getLongLongFromObjectOrReply(c,c->argv[3],&incr,NULL) != REDIS_OK) return;
if ((o = hashLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
if ((o = hashLookupWriteOrCreate(c,c->argv[1])) == NULL) return;
if ((current = hashGet(o,c->argv[2])) != NULL) {
if ((current = hashGet(o,c->argv[2])) != NULL) {
if (current->encoding == REDIS_ENCODING_RAW)
if (getLongLongFromObjectOrReply(c,current,&value,
value = strtoll(current->ptr,NULL,10);
"hash value is not an integer") != REDIS_OK) {
else if (current->encoding == REDIS_ENCODING_INT)
decrRefCount(current);
value = (long)current->ptr;
return;
else
}
redisAssert(1 != 1);
decrRefCount(current);
decrRefCount(current);
} else {
} else {
value = 0;
value = 0;
...
...
redis.conf
View file @
98d2e23b
...
@@ -16,15 +16,15 @@
...
@@ -16,15 +16,15 @@
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize
no
daemonize
no
# When run
as a
daemon, Redis write a pid file in /var/run/redis.pid by
default.
# When run
ning
daemon
ized
, Redis write
s
a pid file in /var/run/redis.pid by
# You can specify a custom pid file location here.
#
default.
You can specify a custom pid file location here.
pidfile
/
var
/
run
/
redis
.
pid
pidfile
/
var
/
run
/
redis
.
pid
# Accept connections on the specified port, default is 6379
# Accept connections on the specified port, default is 6379
port
6379
port
6379
# If you want you can bind a single interface, if the bind option is not
# 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
# bind 127.0.0.1
...
@@ -40,7 +40,7 @@ timeout 300
...
@@ -40,7 +40,7 @@ timeout 300
loglevel
verbose
loglevel
verbose
# Specify the log file name. Also 'stdout' can be used to force
# 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
# output for logging but daemonize, logs will be sent to /dev/null
logfile
stdout
logfile
stdout
...
@@ -78,8 +78,14 @@ rdbcompression yes
...
@@ -78,8 +78,14 @@ rdbcompression yes
# The filename where to dump the DB
# The filename where to dump the DB
dbfilename
dump
.
rdb
dbfilename
dump
.
rdb
# For default save/load DB in/from the working directory
# The working directory.
# Note that you must specify a directory not a file name.
#
# 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
./
dir
./
################################# REPLICATION #################################
################################# REPLICATION #################################
...
...
test-redis.tcl
View file @
98d2e23b
...
@@ -1898,11 +1898,15 @@ proc main {} {
...
@@ -1898,11 +1898,15 @@ proc main {} {
list
[
$r
hincrby smallhash tmp 17179869184
]
[
$r
hincrby bighash tmp 17179869184
]
list
[
$r
hincrby smallhash tmp 17179869184
]
[
$r
hincrby bighash tmp 17179869184
]
}
{
34359738368 34359738368
}
}
{
34359738368 34359738368
}
test
{
HINCRBY against key with spaces
(
no integer encoded
)}
{
test
{
HINCRBY fails against hash value with spaces
}
{
$r hset smallhash tmp
" 11 "
$r hset smallhash str
" 11 "
$r hset bighash tmp
" 11 "
$r hset bighash str
" 11 "
list
[
$r
hincrby smallhash tmp 1
]
[
$r
hincrby bighash tmp 1
]
catch
{
$r
hincrby smallhash str 1
}
smallerr
}
{
12 12
}
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:
# TODO:
# Randomized test, small and big
# Randomized test, small and big
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment