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
60323407
Commit
60323407
authored
May 09, 2016
by
oranagra
Committed by
antirez
May 18, 2016
Browse files
minor fixes - mainly signalModifiedKey, and GEORADIUS
parent
2e6b9949
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/geo.c
View file @
60323407
...
@@ -467,6 +467,7 @@ void georadiusGeneric(client *c, int type) {
...
@@ -467,6 +467,7 @@ void georadiusGeneric(client *c, int type) {
double
radius_meters
=
0
,
conversion
=
1
;
double
radius_meters
=
0
,
conversion
=
1
;
if
((
radius_meters
=
extractDistanceOrReply
(
c
,
c
->
argv
+
base_args
-
2
,
if
((
radius_meters
=
extractDistanceOrReply
(
c
,
c
->
argv
+
base_args
-
2
,
&
conversion
))
<
0
)
{
&
conversion
))
<
0
)
{
addReplyError
(
c
,
"radius must be >= 0"
);
return
;
return
;
}
}
...
...
src/sds.c
View file @
60323407
...
@@ -55,13 +55,13 @@ static inline int sdsHdrSize(char type) {
...
@@ -55,13 +55,13 @@ static inline int sdsHdrSize(char type) {
}
}
static
inline
char
sdsReqType
(
size_t
string_size
)
{
static
inline
char
sdsReqType
(
size_t
string_size
)
{
if
(
string_size
<
32
)
if
(
string_size
<
1
<<
5
)
return
SDS_TYPE_5
;
return
SDS_TYPE_5
;
if
(
string_size
<
0xff
)
if
(
string_size
<
1
<<
8
)
return
SDS_TYPE_8
;
return
SDS_TYPE_8
;
if
(
string_size
<
0xffff
)
if
(
string_size
<
1
<<
16
)
return
SDS_TYPE_16
;
return
SDS_TYPE_16
;
if
(
string_size
<
0xffffffff
)
if
(
string_size
<
1ll
<<
32
)
return
SDS_TYPE_32
;
return
SDS_TYPE_32
;
return
SDS_TYPE_64
;
return
SDS_TYPE_64
;
}
}
...
...
src/server.c
View file @
60323407
...
@@ -663,7 +663,7 @@ int htNeedsResize(dict *dict) {
...
@@ -663,7 +663,7 @@ int htNeedsResize(dict *dict) {
size
=
dictSlots
(
dict
);
size
=
dictSlots
(
dict
);
used
=
dictSize
(
dict
);
used
=
dictSize
(
dict
);
return
(
size
&&
used
&&
size
>
DICT_HT_INITIAL_SIZE
&&
return
(
size
>
DICT_HT_INITIAL_SIZE
&&
(
used
*
100
/
size
<
HASHTABLE_MIN_FILL
));
(
used
*
100
/
size
<
HASHTABLE_MIN_FILL
));
}
}
...
...
src/server.h
View file @
60323407
...
@@ -467,7 +467,7 @@ typedef struct redisObject {
...
@@ -467,7 +467,7 @@ typedef struct redisObject {
/* Macro used to obtain the current LRU clock.
/* Macro used to obtain the current LRU clock.
* If the current resolution is lower than the frequency we refresh the
* If the current resolution is lower than the frequency we refresh the
* LRU clock (as it should be in production servers) we return the
* LRU clock (as it should be in production servers) we return the
* precomputed value, otherwise we need to resort to a
function
call. */
* precomputed value, otherwise we need to resort to a
system
call. */
#define LRU_CLOCK() ((1000/server.hz <= LRU_CLOCK_RESOLUTION) ? server.lruclock : getLRUClock())
#define LRU_CLOCK() ((1000/server.hz <= LRU_CLOCK_RESOLUTION) ? server.lruclock : getLRUClock())
/* Macro used to initialize a Redis object allocated on the stack.
/* Macro used to initialize a Redis object allocated on the stack.
...
@@ -1320,7 +1320,6 @@ void serverLogFromHandler(int level, const char *msg);
...
@@ -1320,7 +1320,6 @@ void serverLogFromHandler(int level, const char *msg);
void
usage
(
void
);
void
usage
(
void
);
void
updateDictResizePolicy
(
void
);
void
updateDictResizePolicy
(
void
);
int
htNeedsResize
(
dict
*
dict
);
int
htNeedsResize
(
dict
*
dict
);
void
oom
(
const
char
*
msg
);
void
populateCommandTable
(
void
);
void
populateCommandTable
(
void
);
void
resetCommandTableStats
(
void
);
void
resetCommandTableStats
(
void
);
void
adjustOpenFilesLimit
(
void
);
void
adjustOpenFilesLimit
(
void
);
...
...
src/t_set.c
View file @
60323407
...
@@ -359,9 +359,6 @@ void smoveCommand(client *c) {
...
@@ -359,9 +359,6 @@ void smoveCommand(client *c) {
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
notifyKeyspaceEvent
(
NOTIFY_GENERIC
,
"del"
,
c
->
argv
[
1
],
c
->
db
->
id
);
notifyKeyspaceEvent
(
NOTIFY_GENERIC
,
"del"
,
c
->
argv
[
1
],
c
->
db
->
id
);
}
}
signalModifiedKey
(
c
->
db
,
c
->
argv
[
1
]);
signalModifiedKey
(
c
->
db
,
c
->
argv
[
2
]);
server
.
dirty
++
;
/* Create the destination set when it doesn't exist */
/* Create the destination set when it doesn't exist */
if
(
!
dstset
)
{
if
(
!
dstset
)
{
...
@@ -369,6 +366,10 @@ void smoveCommand(client *c) {
...
@@ -369,6 +366,10 @@ void smoveCommand(client *c) {
dbAdd
(
c
->
db
,
c
->
argv
[
2
],
dstset
);
dbAdd
(
c
->
db
,
c
->
argv
[
2
],
dstset
);
}
}
signalModifiedKey
(
c
->
db
,
c
->
argv
[
1
]);
signalModifiedKey
(
c
->
db
,
c
->
argv
[
2
]);
server
.
dirty
++
;
/* An extra key has changed when ele was successfully added to dstset */
/* An extra key has changed when ele was successfully added to dstset */
if
(
setTypeAdd
(
dstset
,
ele
))
{
if
(
setTypeAdd
(
dstset
,
ele
))
{
server
.
dirty
++
;
server
.
dirty
++
;
...
@@ -554,6 +555,8 @@ void spopWithCountCommand(client *c) {
...
@@ -554,6 +555,8 @@ void spopWithCountCommand(client *c) {
* the alsoPropagate() API. */
* the alsoPropagate() API. */
decrRefCount
(
propargv
[
0
]);
decrRefCount
(
propargv
[
0
]);
preventCommandPropagation
(
c
);
preventCommandPropagation
(
c
);
signalModifiedKey
(
c
->
db
,
c
->
argv
[
1
]);
server
.
dirty
++
;
}
}
void
spopCommand
(
client
*
c
)
{
void
spopCommand
(
client
*
c
)
{
...
...
src/t_zset.c
View file @
60323407
...
@@ -2148,16 +2148,13 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
...
@@ -2148,16 +2148,13 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
serverPanic
(
"Unknown operator"
);
serverPanic
(
"Unknown operator"
);
}
}
if
(
dbDelete
(
c
->
db
,
dstkey
))
{
if
(
dbDelete
(
c
->
db
,
dstkey
))
signalModifiedKey
(
c
->
db
,
dstkey
);
touched
=
1
;
touched
=
1
;
server
.
dirty
++
;
}
if
(
dstzset
->
zsl
->
length
)
{
if
(
dstzset
->
zsl
->
length
)
{
zsetConvertToZiplistIfNeeded
(
dstobj
,
maxelelen
);
zsetConvertToZiplistIfNeeded
(
dstobj
,
maxelelen
);
dbAdd
(
c
->
db
,
dstkey
,
dstobj
);
dbAdd
(
c
->
db
,
dstkey
,
dstobj
);
addReplyLongLong
(
c
,
zsetLength
(
dstobj
));
addReplyLongLong
(
c
,
zsetLength
(
dstobj
));
if
(
!
touched
)
signalModifiedKey
(
c
->
db
,
dstkey
);
signalModifiedKey
(
c
->
db
,
dstkey
);
notifyKeyspaceEvent
(
NOTIFY_ZSET
,
notifyKeyspaceEvent
(
NOTIFY_ZSET
,
(
op
==
SET_OP_UNION
)
?
"zunionstore"
:
"zinterstore"
,
(
op
==
SET_OP_UNION
)
?
"zunionstore"
:
"zinterstore"
,
dstkey
,
c
->
db
->
id
);
dstkey
,
c
->
db
->
id
);
...
@@ -2165,8 +2162,11 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
...
@@ -2165,8 +2162,11 @@ void zunionInterGenericCommand(client *c, robj *dstkey, int op) {
}
else
{
}
else
{
decrRefCount
(
dstobj
);
decrRefCount
(
dstobj
);
addReply
(
c
,
shared
.
czero
);
addReply
(
c
,
shared
.
czero
);
if
(
touched
)
if
(
touched
)
{
signalModifiedKey
(
c
->
db
,
dstkey
);
notifyKeyspaceEvent
(
NOTIFY_GENERIC
,
"del"
,
dstkey
,
c
->
db
->
id
);
notifyKeyspaceEvent
(
NOTIFY_GENERIC
,
"del"
,
dstkey
,
c
->
db
->
id
);
server
.
dirty
++
;
}
}
}
zfree
(
src
);
zfree
(
src
);
}
}
...
...
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