Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
93238575
Commit
93238575
authored
Jul 01, 2018
by
Jack Drogon
Committed by
Salvatore Sanfilippo
Jul 03, 2018
Browse files
Fix typo
parent
94b3ee61
Changes
40
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
93238575
...
@@ -1658,7 +1658,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
...
@@ -1658,7 +1658,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
if
(
first
==
NULL
)
{
if
(
first
==
NULL
)
{
/* Serialized listpacks should never be empty, since on
/* Serialized listpacks should never be empty, since on
* deletion we should remove the radix tree key if the
* deletion we should remove the radix tree key if the
* resulting listpack is em
t
py. */
* resulting listpack is emp
t
y. */
rdbExitReportCorruptRDB
(
"Empty listpack inside stream"
);
rdbExitReportCorruptRDB
(
"Empty listpack inside stream"
);
}
}
...
@@ -2099,7 +2099,7 @@ void backgroundSaveDoneHandlerDisk(int exitcode, int bysignal) {
...
@@ -2099,7 +2099,7 @@ void backgroundSaveDoneHandlerDisk(int exitcode, int bysignal) {
latencyEndMonitor
(
latency
);
latencyEndMonitor
(
latency
);
latencyAddSampleIfNeeded
(
"rdb-unlink-temp-file"
,
latency
);
latencyAddSampleIfNeeded
(
"rdb-unlink-temp-file"
,
latency
);
/* SIGUSR1 is whitelisted, so we have a way to kill a child without
/* SIGUSR1 is whitelisted, so we have a way to kill a child without
* tirggering an error conditon. */
* tirggering an error condit
i
on. */
if
(
bysignal
!=
SIGUSR1
)
if
(
bysignal
!=
SIGUSR1
)
server
.
lastbgsave_status
=
C_ERR
;
server
.
lastbgsave_status
=
C_ERR
;
}
}
...
@@ -2136,7 +2136,7 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
...
@@ -2136,7 +2136,7 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
* in error state.
* in error state.
*
*
* If the process returned an error, consider the list of slaves that
* If the process returned an error, consider the list of slaves that
* can continue to be em
t
py, so that it's just a special case of the
* can continue to be emp
t
y, so that it's just a special case of the
* normal code path. */
* normal code path. */
ok_slaves
=
zmalloc
(
sizeof
(
uint64_t
));
/* Make space for the count. */
ok_slaves
=
zmalloc
(
sizeof
(
uint64_t
));
/* Make space for the count. */
ok_slaves
[
0
]
=
0
;
ok_slaves
[
0
]
=
0
;
...
...
src/redis-cli.c
View file @
93238575
...
@@ -2423,7 +2423,7 @@ static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes,
...
@@ -2423,7 +2423,7 @@ static void clusterManagerOptimizeAntiAffinity(clusterManagerNodeArray *ipnodes,
ip_count
,
ip_count
,
NULL
,
NULL
);
NULL
,
NULL
);
/* If the change actually makes thing worse, revert. Otherwise
/* If the change actually makes thing worse, revert. Otherwise
* leave as it is bec
u
ase the best solution may need a few
* leave as it is beca
u
se the best solution may need a few
* combined swaps. */
* combined swaps. */
if
(
new_score
>
score
)
{
if
(
new_score
>
score
)
{
first
->
replicate
=
first_master
;
first
->
replicate
=
first_master
;
...
@@ -3539,7 +3539,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -3539,7 +3539,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
if
(
!
clusterManagerCheckRedisReply
(
n
,
r
,
NULL
))
fixed
=
-
1
;
if
(
!
clusterManagerCheckRedisReply
(
n
,
r
,
NULL
))
fixed
=
-
1
;
if
(
r
)
freeReplyObject
(
r
);
if
(
r
)
freeReplyObject
(
r
);
if
(
fixed
<
0
)
goto
cleanup
;
if
(
fixed
<
0
)
goto
cleanup
;
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
/* Since CLUSTER ADDSLOTS succe
e
ded, we also update the slot
* info into the node struct, in order to keep it synced */
* info into the node struct, in order to keep it synced */
n
->
slots
[
atoi
(
slot
)]
=
1
;
n
->
slots
[
atoi
(
slot
)]
=
1
;
fixed
++
;
fixed
++
;
...
@@ -3570,7 +3570,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -3570,7 +3570,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
if
(
!
clusterManagerCheckRedisReply
(
n
,
r
,
NULL
))
fixed
=
-
1
;
if
(
!
clusterManagerCheckRedisReply
(
n
,
r
,
NULL
))
fixed
=
-
1
;
if
(
r
)
freeReplyObject
(
r
);
if
(
r
)
freeReplyObject
(
r
);
if
(
fixed
<
0
)
goto
cleanup
;
if
(
fixed
<
0
)
goto
cleanup
;
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
/* Since CLUSTER ADDSLOTS succe
e
ded, we also update the slot
* info into the node struct, in order to keep it synced */
* info into the node struct, in order to keep it synced */
n
->
slots
[
atoi
(
slot
)]
=
1
;
n
->
slots
[
atoi
(
slot
)]
=
1
;
fixed
++
;
fixed
++
;
...
@@ -3580,7 +3580,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -3580,7 +3580,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
/* Handle case "3": keys in multiple nodes. */
/* Handle case "3": keys in multiple nodes. */
if
(
listLength
(
multi
)
>
0
)
{
if
(
listLength
(
multi
)
>
0
)
{
printf
(
"The folowing uncovered slots have keys in multiple nodes:
\n
"
);
printf
(
"The fol
l
owing uncovered slots have keys in multiple nodes:
\n
"
);
clusterManagerPrintSlotsList
(
multi
);
clusterManagerPrintSlotsList
(
multi
);
if
(
confirmWithYes
(
"Fix these slots by moving keys "
if
(
confirmWithYes
(
"Fix these slots by moving keys "
"into a single node?"
))
{
"into a single node?"
))
{
...
@@ -3612,7 +3612,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -3612,7 +3612,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
if
(
!
clusterManagerCheckRedisReply
(
target
,
r
,
NULL
))
fixed
=
-
1
;
if
(
!
clusterManagerCheckRedisReply
(
target
,
r
,
NULL
))
fixed
=
-
1
;
if
(
r
)
freeReplyObject
(
r
);
if
(
r
)
freeReplyObject
(
r
);
if
(
fixed
<
0
)
goto
cleanup
;
if
(
fixed
<
0
)
goto
cleanup
;
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
/* Since CLUSTER ADDSLOTS succe
e
ded, we also update the slot
* info into the node struct, in order to keep it synced */
* info into the node struct, in order to keep it synced */
target
->
slots
[
atoi
(
slot
)]
=
1
;
target
->
slots
[
atoi
(
slot
)]
=
1
;
listIter
nli
;
listIter
nli
;
...
@@ -3735,7 +3735,7 @@ static int clusterManagerFixOpenSlot(int slot) {
...
@@ -3735,7 +3735,7 @@ static int clusterManagerFixOpenSlot(int slot) {
success
=
clusterManagerCheckRedisReply
(
owner
,
reply
,
NULL
);
success
=
clusterManagerCheckRedisReply
(
owner
,
reply
,
NULL
);
if
(
reply
)
freeReplyObject
(
reply
);
if
(
reply
)
freeReplyObject
(
reply
);
if
(
!
success
)
goto
cleanup
;
if
(
!
success
)
goto
cleanup
;
/* Since CLUSTER ADDSLOTS succeded, we also update the slot
/* Since CLUSTER ADDSLOTS succe
e
ded, we also update the slot
* info into the node struct, in order to keep it synced */
* info into the node struct, in order to keep it synced */
owner
->
slots
[
slot
]
=
1
;
owner
->
slots
[
slot
]
=
1
;
/* Make sure this information will propagate. Not strictly needed
/* Make sure this information will propagate. Not strictly needed
...
@@ -4945,7 +4945,7 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
...
@@ -4945,7 +4945,7 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
src
->
port
,
src
->
port
,
dst
->
ip
,
dst
->
ip
,
dst
->
port
);
dst
->
port
);
/* Act
a
ully move the slots. */
/* Actu
a
lly move the slots. */
list
*
lsrc
=
listCreate
(),
*
table
=
NULL
;
list
*
lsrc
=
listCreate
(),
*
table
=
NULL
;
listAddNodeTail
(
lsrc
,
src
);
listAddNodeTail
(
lsrc
,
src
);
table
=
clusterManagerComputeReshardTable
(
lsrc
,
numslots
);
table
=
clusterManagerComputeReshardTable
(
lsrc
,
numslots
);
...
@@ -5894,15 +5894,15 @@ static void getKeySizes(redisReply *keys, int *types,
...
@@ -5894,15 +5894,15 @@ static void getKeySizes(redisReply *keys, int *types,
keys
->
element
[
i
]
->
str
);
keys
->
element
[
i
]
->
str
);
}
}
/* Retr
e
ive sizes */
/* Retri
e
ve sizes */
for
(
i
=
0
;
i
<
keys
->
elements
;
i
++
)
{
for
(
i
=
0
;
i
<
keys
->
elements
;
i
++
)
{
/* Skip keys that dis
s
apeared between SCAN and TYPE */
/* Skip keys that disa
p
peared between SCAN and TYPE */
if
(
types
[
i
]
==
TYPE_NONE
)
{
if
(
types
[
i
]
==
TYPE_NONE
)
{
sizes
[
i
]
=
0
;
sizes
[
i
]
=
0
;
continue
;
continue
;
}
}
/* Retr
e
ive size */
/* Retri
e
ve size */
if
(
redisGetReply
(
context
,
(
void
**
)
&
reply
)
!=
REDIS_OK
)
{
if
(
redisGetReply
(
context
,
(
void
**
)
&
reply
)
!=
REDIS_OK
)
{
fprintf
(
stderr
,
"Error getting size for key '%s' (%d: %s)
\n
"
,
fprintf
(
stderr
,
"Error getting size for key '%s' (%d: %s)
\n
"
,
keys
->
element
[
i
]
->
str
,
context
->
err
,
context
->
errstr
);
keys
->
element
[
i
]
->
str
,
context
->
err
,
context
->
errstr
);
...
@@ -5972,7 +5972,7 @@ static void findBigKeys(void) {
...
@@ -5972,7 +5972,7 @@ static void findBigKeys(void) {
arrsize
=
keys
->
elements
;
arrsize
=
keys
->
elements
;
}
}
/* Retr
e
ive types and then sizes */
/* Retri
e
ve types and then sizes */
getKeyTypes
(
keys
,
types
);
getKeyTypes
(
keys
,
types
);
getKeySizes
(
keys
,
types
,
sizes
);
getKeySizes
(
keys
,
types
,
sizes
);
...
...
src/redis-trib.rb
View file @
93238575
...
@@ -454,7 +454,7 @@ class RedisTrib
...
@@ -454,7 +454,7 @@ class RedisTrib
# Handle case "1": keys in no node.
# Handle case "1": keys in no node.
if
none
.
length
>
0
if
none
.
length
>
0
xputs
"The folowing uncovered slots have no keys across the cluster:"
xputs
"The fol
l
owing uncovered slots have no keys across the cluster:"
xputs
none
.
keys
.
join
(
","
)
xputs
none
.
keys
.
join
(
","
)
yes_or_die
"Fix these slots by covering with a random node?"
yes_or_die
"Fix these slots by covering with a random node?"
none
.
each
{
|
slot
,
nodes
|
none
.
each
{
|
slot
,
nodes
|
...
@@ -466,7 +466,7 @@ class RedisTrib
...
@@ -466,7 +466,7 @@ class RedisTrib
# Handle case "2": keys only in one node.
# Handle case "2": keys only in one node.
if
single
.
length
>
0
if
single
.
length
>
0
xputs
"The folowing uncovered slots have keys in just one node:"
xputs
"The fol
l
owing uncovered slots have keys in just one node:"
puts
single
.
keys
.
join
(
","
)
puts
single
.
keys
.
join
(
","
)
yes_or_die
"Fix these slots by covering with those nodes?"
yes_or_die
"Fix these slots by covering with those nodes?"
single
.
each
{
|
slot
,
nodes
|
single
.
each
{
|
slot
,
nodes
|
...
@@ -477,7 +477,7 @@ class RedisTrib
...
@@ -477,7 +477,7 @@ class RedisTrib
# Handle case "3": keys in multiple nodes.
# Handle case "3": keys in multiple nodes.
if
multi
.
length
>
0
if
multi
.
length
>
0
xputs
"The folowing uncovered slots have keys in multiple nodes:"
xputs
"The fol
l
owing uncovered slots have keys in multiple nodes:"
xputs
multi
.
keys
.
join
(
","
)
xputs
multi
.
keys
.
join
(
","
)
yes_or_die
"Fix these slots by moving keys into a single node?"
yes_or_die
"Fix these slots by moving keys into a single node?"
multi
.
each
{
|
slot
,
nodes
|
multi
.
each
{
|
slot
,
nodes
|
...
@@ -804,7 +804,7 @@ class RedisTrib
...
@@ -804,7 +804,7 @@ class RedisTrib
new_score
,
aux
=
get_anti_affinity_score
new_score
,
aux
=
get_anti_affinity_score
# If the change actually makes thing worse, revert. Otherwise
# If the change actually makes thing worse, revert. Otherwise
# leave as it is bec
u
ase the best solution may need a few
# leave as it is beca
u
se the best solution may need a few
# combined swaps.
# combined swaps.
if
new_score
>
score
if
new_score
>
score
first
.
set_as_replica
(
first_master
)
first
.
set_as_replica
(
first_master
)
...
@@ -1232,7 +1232,7 @@ class RedisTrib
...
@@ -1232,7 +1232,7 @@ class RedisTrib
if
numslots
>
0
if
numslots
>
0
puts
"Moving
#{
numslots
}
slots from
#{
src
}
to
#{
dst
}
"
puts
"Moving
#{
numslots
}
slots from
#{
src
}
to
#{
dst
}
"
# Act
a
ully move the slots.
# Actu
a
lly move the slots.
reshard_table
=
compute_reshard_table
([
src
],
numslots
)
reshard_table
=
compute_reshard_table
([
src
],
numslots
)
if
reshard_table
.
length
!=
numslots
if
reshard_table
.
length
!=
numslots
xputs
"*** Assertio failed: Reshard table != number of slots"
xputs
"*** Assertio failed: Reshard table != number of slots"
...
@@ -1752,7 +1752,7 @@ private
...
@@ -1752,7 +1752,7 @@ private
]
]
end
end
# Turn a key name into the corr
i
sponding Redis Cluster slot.
# Turn a key name into the corr
e
sponding Redis Cluster slot.
def
key_to_slot
(
key
)
def
key_to_slot
(
key
)
# Only hash what is inside {...} if there is such a pattern in the key.
# Only hash what is inside {...} if there is such a pattern in the key.
# Note that the specification requires the content that is between
# Note that the specification requires the content that is between
...
...
src/redisassert.h
View file @
93238575
/* redisassert.h -- Drop in replacem
net
assert.h that prints the stack trace
/* redisassert.h -- Drop in replacem
ents
assert.h that prints the stack trace
* in the Redis logs.
* in the Redis logs.
*
*
* This file should be included instead of "assert.h" inside libraries used by
* This file should be included instead of "assert.h" inside libraries used by
...
...
src/replication.c
View file @
93238575
...
@@ -553,7 +553,7 @@ need_full_resync:
...
@@ -553,7 +553,7 @@ need_full_resync:
* Side effects, other than starting a BGSAVE:
* Side effects, other than starting a BGSAVE:
*
*
* 1) Handle the slaves in WAIT_START state, by preparing them for a full
* 1) Handle the slaves in WAIT_START state, by preparing them for a full
* sync if the BGSAVE was succesfully started, or sending them an error
* sync if the BGSAVE was succes
s
fully started, or sending them an error
* and dropping them from the list of slaves.
* and dropping them from the list of slaves.
*
*
* 2) Flush the Lua scripting script cache if the BGSAVE was actually
* 2) Flush the Lua scripting script cache if the BGSAVE was actually
...
@@ -896,7 +896,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -896,7 +896,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
}
}
}
}
/* If the preamble was already transfered, send the RDB bulk data. */
/* If the preamble was already transfer
r
ed, send the RDB bulk data. */
lseek
(
slave
->
repldbfd
,
slave
->
repldboff
,
SEEK_SET
);
lseek
(
slave
->
repldbfd
,
slave
->
repldboff
,
SEEK_SET
);
buflen
=
read
(
slave
->
repldbfd
,
buf
,
PROTO_IOBUF_LEN
);
buflen
=
read
(
slave
->
repldbfd
,
buf
,
PROTO_IOBUF_LEN
);
if
(
buflen
<=
0
)
{
if
(
buflen
<=
0
)
{
...
@@ -965,7 +965,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
...
@@ -965,7 +965,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
replicationGetSlaveName
(
slave
));
replicationGetSlaveName
(
slave
));
/* Note: we wait for a REPLCONF ACK message from slave in
/* Note: we wait for a REPLCONF ACK message from slave in
* order to really put it online (install the write handler
* order to really put it online (install the write handler
* so that the accumulated data can be transfered). However
* so that the accumulated data can be transfer
r
ed). However
* we change the replication state ASAP, since our slave
* we change the replication state ASAP, since our slave
* is technically online now. */
* is technically online now. */
slave
->
replstate
=
SLAVE_STATE_ONLINE
;
slave
->
replstate
=
SLAVE_STATE_ONLINE
;
...
@@ -1048,7 +1048,7 @@ int slaveIsInHandshakeState(void) {
...
@@ -1048,7 +1048,7 @@ int slaveIsInHandshakeState(void) {
/* Avoid the master to detect the slave is timing out while loading the
/* Avoid the master to detect the slave is timing out while loading the
* RDB file in initial synchronization. We send a single newline character
* RDB file in initial synchronization. We send a single newline character
* that is valid protocol but is guaranteed to either be sent enti
e
rly or
* that is valid protocol but is guaranteed to either be sent entir
e
ly or
* not, since the byte is indivisible.
* not, since the byte is indivisible.
*
*
* The function is called in two contexts: while we flush the current
* The function is called in two contexts: while we flush the current
...
@@ -1397,7 +1397,7 @@ char *sendSynchronousCommand(int flags, int fd, ...) {
...
@@ -1397,7 +1397,7 @@ char *sendSynchronousCommand(int flags, int fd, ...) {
*
*
* The function returns:
* The function returns:
*
*
* PSYNC_CONTINUE: If the PSYNC command succeded and we can continue.
* PSYNC_CONTINUE: If the PSYNC command succe
e
ded and we can continue.
* PSYNC_FULLRESYNC: If PSYNC is supported but a full resync is needed.
* PSYNC_FULLRESYNC: If PSYNC is supported but a full resync is needed.
* In this case the master run_id and global replication
* In this case the master run_id and global replication
* offset is saved.
* offset is saved.
...
@@ -2120,7 +2120,7 @@ void replicationSendAck(void) {
...
@@ -2120,7 +2120,7 @@ void replicationSendAck(void) {
* functions. */
* functions. */
/* This function is called by freeClient() in order to cache the master
/* This function is called by freeClient() in order to cache the master
* client structure instead of destr
y
oing it. freeClient() will return
* client structure instead of destro
y
ing it. freeClient() will return
* ASAP after this function returns, so every action needed to avoid problems
* ASAP after this function returns, so every action needed to avoid problems
* with a client that is really "suspended" has to be done by this function.
* with a client that is really "suspended" has to be done by this function.
*
*
...
...
src/sds.c
View file @
93238575
...
@@ -283,7 +283,7 @@ sds sdsRemoveFreeSpace(sds s) {
...
@@ -283,7 +283,7 @@ sds sdsRemoveFreeSpace(sds s) {
return
s
;
return
s
;
}
}
/* Return the total size of the allocation of the specifed sds string,
/* Return the total size of the allocation of the specif
i
ed sds string,
* including:
* including:
* 1) The sds header before the pointer.
* 1) The sds header before the pointer.
* 2) The string.
* 2) The string.
...
...
src/sentinel.c
View file @
93238575
...
@@ -514,7 +514,7 @@ void sentinelIsRunning(void) {
...
@@ -514,7 +514,7 @@ void sentinelIsRunning(void) {
if
(
sentinel
.
myid
[
j
]
!=
0
)
break
;
if
(
sentinel
.
myid
[
j
]
!=
0
)
break
;
if
(
j
==
CONFIG_RUN_ID_SIZE
)
{
if
(
j
==
CONFIG_RUN_ID_SIZE
)
{
/* Pick ID and p
r
esist the config. */
/* Pick ID and pe
r
sist the config. */
getRandomHexChars
(
sentinel
.
myid
,
CONFIG_RUN_ID_SIZE
);
getRandomHexChars
(
sentinel
.
myid
,
CONFIG_RUN_ID_SIZE
);
sentinelFlushConfig
();
sentinelFlushConfig
();
}
}
...
@@ -2531,7 +2531,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd
...
@@ -2531,7 +2531,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd
}
}
/* Send an "Hello" message via Pub/Sub to the specified 'ri' Redis
/* Send an "Hello" message via Pub/Sub to the specified 'ri' Redis
* instance in order to broadcast the current configura
i
ton for this
* instance in order to broadcast the current configurat
i
on for this
* master, and to advertise the existence of this Sentinel at the same time.
* master, and to advertise the existence of this Sentinel at the same time.
*
*
* The message has the following format:
* The message has the following format:
...
@@ -3357,7 +3357,7 @@ void sentinelInfoCommand(client *c) {
...
@@ -3357,7 +3357,7 @@ void sentinelInfoCommand(client *c) {
addReplyBulkSds
(
c
,
info
);
addReplyBulkSds
(
c
,
info
);
}
}
/* Implements Sentinel ver
i
son of the ROLE command. The output is
/* Implements Sentinel vers
i
on of the ROLE command. The output is
* "sentinel" and the list of currently monitored master names. */
* "sentinel" and the list of currently monitored master names. */
void
sentinelRoleCommand
(
client
*
c
)
{
void
sentinelRoleCommand
(
client
*
c
)
{
dictIterator
*
di
;
dictIterator
*
di
;
...
@@ -3568,7 +3568,7 @@ void sentinelCheckSubjectivelyDown(sentinelRedisInstance *ri) {
...
@@ -3568,7 +3568,7 @@ void sentinelCheckSubjectivelyDown(sentinelRedisInstance *ri) {
if
(
ri
->
link
->
cc
&&
if
(
ri
->
link
->
cc
&&
(
mstime
()
-
ri
->
link
->
cc_conn_time
)
>
(
mstime
()
-
ri
->
link
->
cc_conn_time
)
>
SENTINEL_MIN_LINK_RECONNECT_PERIOD
&&
SENTINEL_MIN_LINK_RECONNECT_PERIOD
&&
ri
->
link
->
act_ping_time
!=
0
&&
/* Ther is a pending ping... */
ri
->
link
->
act_ping_time
!=
0
&&
/* Ther
e
is a pending ping... */
/* The pending ping is delayed, and we did not received
/* The pending ping is delayed, and we did not received
* error replies as well. */
* error replies as well. */
(
mstime
()
-
ri
->
link
->
act_ping_time
)
>
(
ri
->
down_after_period
/
2
)
&&
(
mstime
()
-
ri
->
link
->
act_ping_time
)
>
(
ri
->
down_after_period
/
2
)
&&
...
@@ -3757,7 +3757,7 @@ void sentinelSimFailureCrash(void) {
...
@@ -3757,7 +3757,7 @@ void sentinelSimFailureCrash(void) {
}
}
/* Vote for the sentinel with 'req_runid' or return the old vote if already
/* Vote for the sentinel with 'req_runid' or return the old vote if already
* voted for the specifed 'req_epoch' or one greater.
* voted for the specif
i
ed 'req_epoch' or one greater.
*
*
* If a vote is not available returns NULL, otherwise return the Sentinel
* If a vote is not available returns NULL, otherwise return the Sentinel
* runid and populate the leader_epoch with the epoch of the vote. */
* runid and populate the leader_epoch with the epoch of the vote. */
...
@@ -3908,7 +3908,7 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) {
...
@@ -3908,7 +3908,7 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) {
/* In order to send SLAVEOF in a safe way, we send a transaction performing
/* In order to send SLAVEOF in a safe way, we send a transaction performing
* the following tasks:
* the following tasks:
* 1) Reconfigure the instance according to the specified host/port params.
* 1) Reconfigure the instance according to the specified host/port params.
* 2) Rewrite the configura
i
ton.
* 2) Rewrite the configurat
i
on.
* 3) Disconnect all clients (but this one sending the commnad) in order
* 3) Disconnect all clients (but this one sending the commnad) in order
* to trigger the ask-master-on-reconnection protocol for connected
* to trigger the ask-master-on-reconnection protocol for connected
* clients.
* clients.
...
...
src/server.c
View file @
93238575
...
@@ -2364,7 +2364,7 @@ void call(client *c, int flags) {
...
@@ -2364,7 +2364,7 @@ void call(client *c, int flags) {
if
(
c
->
flags
&
CLIENT_FORCE_AOF
)
propagate_flags
|=
PROPAGATE_AOF
;
if
(
c
->
flags
&
CLIENT_FORCE_AOF
)
propagate_flags
|=
PROPAGATE_AOF
;
/* However prevent AOF / replication propagation if the command
/* However prevent AOF / replication propagation if the command
* implementati
n
o called preventCommandPropagation() or similar,
* implementatio
ns
called preventCommandPropagation() or similar,
* or if we don't have the call() flags to do so. */
* or if we don't have the call() flags to do so. */
if
(
c
->
flags
&
CLIENT_PREVENT_REPL_PROP
||
if
(
c
->
flags
&
CLIENT_PREVENT_REPL_PROP
||
!
(
flags
&
CMD_CALL_PROPAGATE_REPL
))
!
(
flags
&
CMD_CALL_PROPAGATE_REPL
))
...
@@ -3920,7 +3920,7 @@ int main(int argc, char **argv) {
...
@@ -3920,7 +3920,7 @@ int main(int argc, char **argv) {
configfile
=
argv
[
j
];
configfile
=
argv
[
j
];
server
.
configfile
=
getAbsolutePath
(
configfile
);
server
.
configfile
=
getAbsolutePath
(
configfile
);
/* Replace the config file in server.exec_argv with
/* Replace the config file in server.exec_argv with
* its abso
u
lte path. */
* its absol
u
te path. */
zfree
(
server
.
exec_argv
[
j
]);
zfree
(
server
.
exec_argv
[
j
]);
server
.
exec_argv
[
j
]
=
zstrdup
(
server
.
configfile
);
server
.
exec_argv
[
j
]
=
zstrdup
(
server
.
configfile
);
j
++
;
j
++
;
...
...
src/server.h
View file @
93238575
...
@@ -1601,11 +1601,11 @@ void receiveChildInfo(void);
...
@@ -1601,11 +1601,11 @@ void receiveChildInfo(void);
#define ZADD_NONE 0
#define ZADD_NONE 0
#define ZADD_INCR (1<<0)
/* Increment the score instead of setting it. */
#define ZADD_INCR (1<<0)
/* Increment the score instead of setting it. */
#define ZADD_NX (1<<1)
/* Don't touch elements not already existing. */
#define ZADD_NX (1<<1)
/* Don't touch elements not already existing. */
#define ZADD_XX (1<<2)
/* Only touch elements already exis
i
tng. */
#define ZADD_XX (1<<2)
/* Only touch elements already exist
i
ng. */
/* Output flags. */
/* Output flags. */
#define ZADD_NOP (1<<3)
/* Operation not performed because of conditionals.*/
#define ZADD_NOP (1<<3)
/* Operation not performed because of conditionals.*/
#define ZADD_NAN (1<<4)
/* Only touch elements already exis
i
tng. */
#define ZADD_NAN (1<<4)
/* Only touch elements already exist
i
ng. */
#define ZADD_ADDED (1<<5)
/* The element was new and was added. */
#define ZADD_ADDED (1<<5)
/* The element was new and was added. */
#define ZADD_UPDATED (1<<6)
/* The element already existed, score updated. */
#define ZADD_UPDATED (1<<6)
/* The element already existed, score updated. */
...
...
src/sort.c
View file @
93238575
...
@@ -193,7 +193,7 @@ void sortCommand(client *c) {
...
@@ -193,7 +193,7 @@ void sortCommand(client *c) {
long
limit_start
=
0
,
limit_count
=
-
1
,
start
,
end
;
long
limit_start
=
0
,
limit_count
=
-
1
,
start
,
end
;
int
j
,
dontsort
=
0
,
vectorlen
;
int
j
,
dontsort
=
0
,
vectorlen
;
int
getop
=
0
;
/* GET operation counter */
int
getop
=
0
;
/* GET operation counter */
int
int_conver
t
ion_error
=
0
;
int
int_conver
s
ion_error
=
0
;
int
syntax_error
=
0
;
int
syntax_error
=
0
;
robj
*
sortval
,
*
sortby
=
NULL
,
*
storekey
=
NULL
;
robj
*
sortval
,
*
sortby
=
NULL
,
*
storekey
=
NULL
;
redisSortObject
*
vector
;
/* Resulting vector to sort */
redisSortObject
*
vector
;
/* Resulting vector to sort */
...
@@ -469,7 +469,7 @@ void sortCommand(client *c) {
...
@@ -469,7 +469,7 @@ void sortCommand(client *c) {
if
(
eptr
[
0
]
!=
'\0'
||
errno
==
ERANGE
||
if
(
eptr
[
0
]
!=
'\0'
||
errno
==
ERANGE
||
isnan
(
vector
[
j
].
u
.
score
))
isnan
(
vector
[
j
].
u
.
score
))
{
{
int_conver
t
ion_error
=
1
;
int_conver
s
ion_error
=
1
;
}
}
}
else
if
(
byval
->
encoding
==
OBJ_ENCODING_INT
)
{
}
else
if
(
byval
->
encoding
==
OBJ_ENCODING_INT
)
{
/* Don't need to decode the object if it's
/* Don't need to decode the object if it's
...
@@ -501,7 +501,7 @@ void sortCommand(client *c) {
...
@@ -501,7 +501,7 @@ void sortCommand(client *c) {
/* Send command output to the output buffer, performing the specified
/* Send command output to the output buffer, performing the specified
* GET/DEL/INCR/DECR operations if any. */
* GET/DEL/INCR/DECR operations if any. */
outputlen
=
getop
?
getop
*
(
end
-
start
+
1
)
:
end
-
start
+
1
;
outputlen
=
getop
?
getop
*
(
end
-
start
+
1
)
:
end
-
start
+
1
;
if
(
int_conver
t
ion_error
)
{
if
(
int_conver
s
ion_error
)
{
addReplyError
(
c
,
"One or more scores can't be converted into double"
);
addReplyError
(
c
,
"One or more scores can't be converted into double"
);
}
else
if
(
storekey
==
NULL
)
{
}
else
if
(
storekey
==
NULL
)
{
/* STORE option not specified, sent the sorting result to client */
/* STORE option not specified, sent the sorting result to client */
...
...
src/t_stream.c
View file @
93238575
...
@@ -207,7 +207,7 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
...
@@ -207,7 +207,7 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
/* Create a new listpack and radix tree node if needed. Note that when
/* Create a new listpack and radix tree node if needed. Note that when
* a new listpack is created, we populate it with a "master entry". This
* a new listpack is created, we populate it with a "master entry". This
* is just a set of fields that is taken as refernce in order to compress
* is just a set of fields that is taken as refer
e
nce
s
in order to compress
* the stream entries that we'll add inside the listpack.
* the stream entries that we'll add inside the listpack.
*
*
* Note that while we use the first added entry fields to create
* Note that while we use the first added entry fields to create
...
@@ -469,7 +469,7 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) {
...
@@ -469,7 +469,7 @@ int64_t streamTrimByLength(stream *s, size_t maxlen, int approx) {
* iteration is from the start to the end element (inclusive), otherwise
* iteration is from the start to the end element (inclusive), otherwise
* if rev is non-zero, the iteration is reversed.
* if rev is non-zero, the iteration is reversed.
*
*
* Once the iterator is initalized, we iterate like this:
* Once the iterator is init
i
alized, we iterate like this:
*
*
* streamIterator myiterator;
* streamIterator myiterator;
* streamIteratorStart(&myiterator,...);
* streamIteratorStart(&myiterator,...);
...
@@ -834,7 +834,7 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
...
@@ -834,7 +834,7 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
* given, but currently such a feature is never used by the code base that
* given, but currently such a feature is never used by the code base that
* will always pass 'spi' and propagate when a group is passed.
* will always pass 'spi' and propagate when a group is passed.
*
*
* Note that this function is recursive in cert
i
an cases. When it's called
* Note that this function is recursive in certa
i
n cases. When it's called
* with a non NULL group and consumer argument, it may call
* with a non NULL group and consumer argument, it may call
* streamReplyWithRangeFromConsumerPEL() in order to get entries from the
* streamReplyWithRangeFromConsumerPEL() in order to get entries from the
* consumer pending entries list. However such a function will then call
* consumer pending entries list. However such a function will then call
...
@@ -2067,7 +2067,7 @@ void xclaimCommand(client *c) {
...
@@ -2067,7 +2067,7 @@ void xclaimCommand(client *c) {
/* XDEL <key> [<ID1> <ID2> ... <IDN>]
/* XDEL <key> [<ID1> <ID2> ... <IDN>]
*
*
* Removes the specified entries from the stream. Returns the number
* Removes the specified entries from the stream. Returns the number
* of items act
a
ully deleted, that may be different from the number
* of items actu
a
lly deleted, that may be different from the number
* of IDs passed in case certain IDs do not exist. */
* of IDs passed in case certain IDs do not exist. */
void
xdelCommand
(
client
*
c
)
{
void
xdelCommand
(
client
*
c
)
{
robj
*
o
;
robj
*
o
;
...
@@ -2078,13 +2078,13 @@ void xdelCommand(client *c) {
...
@@ -2078,13 +2078,13 @@ void xdelCommand(client *c) {
/* We need to sanity check the IDs passed to start. Even if not
/* We need to sanity check the IDs passed to start. Even if not
* a big issue, it is not great that the command is only partially
* a big issue, it is not great that the command is only partially
* executed bec
u
ase at some point an invalid ID is parsed. */
* executed beca
u
se at some point an invalid ID is parsed. */
streamID
id
;
streamID
id
;
for
(
int
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
for
(
int
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
if
(
streamParseIDOrReply
(
c
,
c
->
argv
[
j
],
&
id
,
0
)
!=
C_OK
)
return
;
if
(
streamParseIDOrReply
(
c
,
c
->
argv
[
j
],
&
id
,
0
)
!=
C_OK
)
return
;
}
}
/* Act
a
ully apply the command. */
/* Actu
a
lly apply the command. */
int
deleted
=
0
;
int
deleted
=
0
;
for
(
int
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
for
(
int
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
streamParseIDOrReply
(
c
,
c
->
argv
[
j
],
&
id
,
0
);
/* Retval already checked. */
streamParseIDOrReply
(
c
,
c
->
argv
[
j
],
&
id
,
0
);
/* Retval already checked. */
...
...
src/t_zset.c
View file @
93238575
...
@@ -507,7 +507,7 @@ static int zslParseRange(robj *min, robj *max, zrangespec *spec) {
...
@@ -507,7 +507,7 @@ static int zslParseRange(robj *min, robj *max, zrangespec *spec) {
* + means the max string possible
* + means the max string possible
*
*
* If the string is valid the *dest pointer is set to the redis object
* If the string is valid the *dest pointer is set to the redis object
* that will be used for the comparis
i
on, and ex will be set to 0 or 1
* that will be used for the comparison, and ex will be set to 0 or 1
* respectively if the item is exclusive or inclusive. C_OK will be
* respectively if the item is exclusive or inclusive. C_OK will be
* returned.
* returned.
*
*
...
...
src/util.c
View file @
93238575
...
@@ -451,7 +451,7 @@ int string2ld(const char *s, size_t slen, long double *dp) {
...
@@ -451,7 +451,7 @@ int string2ld(const char *s, size_t slen, long double *dp) {
/* Convert a double to a string representation. Returns the number of bytes
/* Convert a double to a string representation. Returns the number of bytes
* required. The representation should always be parsable by strtod(3).
* required. The representation should always be parsable by strtod(3).
* This function does not support human-friendly formatting like ld2string
* This function does not support human-friendly formatting like ld2string
* does. It is inten
t
ed mainly to be used inside t_zset.c when writing scores
* does. It is inten
d
ed mainly to be used inside t_zset.c when writing scores
* into a ziplist representing a sorted set. */
* into a ziplist representing a sorted set. */
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
)
{
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
)
{
if
(
isnan
(
value
))
{
if
(
isnan
(
value
))
{
...
...
src/ziplist.c
View file @
93238575
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
* Note that this is not how the data is actually encoded, is just what we
* Note that this is not how the data is actually encoded, is just what we
* get filled by a function in order to operate more easily. */
* get filled by a function in order to operate more easily. */
typedef
struct
zlentry
{
typedef
struct
zlentry
{
unsigned
int
prevrawlensize
;
/* Bytes used to encode the previos entry len*/
unsigned
int
prevrawlensize
;
/* Bytes used to encode the previo
u
s entry len*/
unsigned
int
prevrawlen
;
/* Previous entry len. */
unsigned
int
prevrawlen
;
/* Previous entry len. */
unsigned
int
lensize
;
/* Bytes used to encode this entry type/len.
unsigned
int
lensize
;
/* Bytes used to encode this entry type/len.
For example strings have a 1, 2 or 5 bytes
For example strings have a 1, 2 or 5 bytes
...
@@ -431,7 +431,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) {
...
@@ -431,7 +431,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) {
/* Return the length of the previous element, and the number of bytes that
/* Return the length of the previous element, and the number of bytes that
* are used in order to encode the previous element length.
* are used in order to encode the previous element length.
* 'ptr' must point to the prevlen prefix of an entry (that encodes the
* 'ptr' must point to the prevlen prefix of an entry (that encodes the
* length of the previos entry in order to navigate the elements backward).
* length of the previo
u
s entry in order to navigate the elements backward).
* The length of the previous entry is stored in 'prevlen', the number of
* The length of the previous entry is stored in 'prevlen', the number of
* bytes needed to encode the previous entry length are stored in
* bytes needed to encode the previous entry length are stored in
* 'prevlensize'. */
* 'prevlensize'. */
...
...
src/zmalloc.c
View file @
93238575
...
@@ -380,7 +380,7 @@ size_t zmalloc_get_private_dirty(long pid) {
...
@@ -380,7 +380,7 @@ size_t zmalloc_get_private_dirty(long pid) {
}
}
/* Returns the size of physical memory (RAM) in bytes.
/* Returns the size of physical memory (RAM) in bytes.
* It looks ugly, but this is the cleanest way to achive cross platform results.
* It looks ugly, but this is the cleanest way to achi
e
ve cross platform results.
* Cleaned up from:
* Cleaned up from:
*
*
* http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
* http://nadeausoftware.com/articles/2012/09/c_c_tip_how_get_physical_memory_size_system
...
...
tests/integration/replication-psync.tcl
View file @
93238575
...
@@ -11,7 +11,7 @@ proc stop_bg_complex_data {handle} {
...
@@ -11,7 +11,7 @@ proc stop_bg_complex_data {handle} {
# partial resyncs attempts, all this while flooding the master with
# partial resyncs attempts, all this while flooding the master with
# write queries.
# write queries.
#
#
# You can specif
i
y backlog size, ttl, delay before reconnection, test duration
# You can specify backlog size, ttl, delay before reconnection, test duration
# in seconds, and an additional condition to verify at the end.
# in seconds, and an additional condition to verify at the end.
#
#
# If reconnect is > 0, the test actually try to break the connection and
# If reconnect is > 0, the test actually try to break the connection and
...
...
tests/unit/dump.tcl
View file @
93238575
...
@@ -279,7 +279,7 @@ start_server {tags {"dump"}} {
...
@@ -279,7 +279,7 @@ start_server {tags {"dump"}} {
set e
set e
}
{
*empty string*
}
}
{
*empty string*
}
test
{
MIGRATE with mu
t
liple keys migrate just existing ones
}
{
test
{
MIGRATE with mul
t
iple keys migrate just existing ones
}
{
set first
[
srv 0 client
]
set first
[
srv 0 client
]
r set key1
"v1"
r set key1
"v1"
r set key2
"v2"
r set key2
"v2"
...
...
tests/unit/scripting.tcl
View file @
93238575
...
@@ -517,7 +517,7 @@ start_server {tags {"scripting"}} {
...
@@ -517,7 +517,7 @@ start_server {tags {"scripting"}} {
# Note: keep this test at the end of this server stanza because it
# Note: keep this test at the end of this server stanza because it
# kills the server.
# kills the server.
test
{
SHUTDOWN NOSAVE can kill a timedout script anyway
}
{
test
{
SHUTDOWN NOSAVE can kill a timedout script anyway
}
{
# The server
s
ould be still unresponding to normal commands.
# The server
c
ould be still unresponding to normal commands.
catch
{
r ping
}
e
catch
{
r ping
}
e
assert_match
{
BUSY*
}
$e
assert_match
{
BUSY*
}
$e
catch
{
r shutdown nosave
}
catch
{
r shutdown nosave
}
...
...
tests/unit/type/zset.tcl
View file @
93238575
...
@@ -84,7 +84,7 @@ start_server {tags {"zset"}} {
...
@@ -84,7 +84,7 @@ start_server {tags {"zset"}} {
set err
set err
}
{
ERR*
}
}
{
ERR*
}
test
"ZADD NX with non exis
i
tng key"
{
test
"ZADD NX with non exist
i
ng key"
{
r del ztmp
r del ztmp
r zadd ztmp nx 10 x 20 y 30 z
r zadd ztmp nx 10 x 20 y 30 z
assert
{[
r zcard ztmp
]
== 3
}
assert
{[
r zcard ztmp
]
== 3
}
...
...
utils/hashtable/README
View file @
93238575
...
@@ -5,7 +5,7 @@ rehashing.c
...
@@ -5,7 +5,7 @@ rehashing.c
Visually show buckets in the two hash tables between rehashings. Also stress
Visually show buckets in the two hash tables between rehashings. Also stress
test getRandomKeys() implementation, that may actually disappear from
test getRandomKeys() implementation, that may actually disappear from
Redis soon, however visualiza
i
ton some code is reusable in new bugs
Redis soon, however visualizat
i
on some code is reusable in new bugs
investigation.
investigation.
Compile with:
Compile with:
...
...
Prev
1
2
Next
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