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
8b9d5ecb
Commit
8b9d5ecb
authored
May 15, 2014
by
antirez
Browse files
Remove trailing spaces from cluster.c file.
parent
0b7aa261
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
8b9d5ecb
...
@@ -102,7 +102,7 @@ int clusterLoadConfig(char *filename) {
...
@@ -102,7 +102,7 @@ int clusterLoadConfig(char *filename) {
struct
stat
sb
;
struct
stat
sb
;
char
*
line
;
char
*
line
;
int
maxline
,
j
;
int
maxline
,
j
;
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
if
(
errno
==
ENOENT
)
{
if
(
errno
==
ENOENT
)
{
return
REDIS_ERR
;
return
REDIS_ERR
;
...
@@ -311,7 +311,7 @@ int clusterSaveConfig(int do_fsync) {
...
@@ -311,7 +311,7 @@ int clusterSaveConfig(int do_fsync) {
(
unsigned
long
long
)
server
.
cluster
->
currentEpoch
,
(
unsigned
long
long
)
server
.
cluster
->
currentEpoch
,
(
unsigned
long
long
)
server
.
cluster
->
lastVoteEpoch
);
(
unsigned
long
long
)
server
.
cluster
->
lastVoteEpoch
);
content_size
=
sdslen
(
ci
);
content_size
=
sdslen
(
ci
);
if
((
fd
=
open
(
server
.
cluster_configfile
,
O_WRONLY
|
O_CREAT
,
0644
))
if
((
fd
=
open
(
server
.
cluster_configfile
,
O_WRONLY
|
O_CREAT
,
0644
))
==
-
1
)
goto
err
;
==
-
1
)
goto
err
;
...
@@ -751,7 +751,7 @@ void freeClusterNode(clusterNode *n) {
...
@@ -751,7 +751,7 @@ void freeClusterNode(clusterNode *n) {
/* Add a node to the nodes hash table */
/* Add a node to the nodes hash table */
int
clusterAddNode
(
clusterNode
*
node
)
{
int
clusterAddNode
(
clusterNode
*
node
)
{
int
retval
;
int
retval
;
retval
=
dictAdd
(
server
.
cluster
->
nodes
,
retval
=
dictAdd
(
server
.
cluster
->
nodes
,
sdsnewlen
(
node
->
name
,
REDIS_CLUSTER_NAMELEN
),
node
);
sdsnewlen
(
node
->
name
,
REDIS_CLUSTER_NAMELEN
),
node
);
return
(
retval
==
DICT_OK
)
?
REDIS_OK
:
REDIS_ERR
;
return
(
retval
==
DICT_OK
)
?
REDIS_OK
:
REDIS_ERR
;
...
@@ -814,7 +814,7 @@ clusterNode *clusterLookupNode(char *name) {
...
@@ -814,7 +814,7 @@ clusterNode *clusterLookupNode(char *name) {
void
clusterRenameNode
(
clusterNode
*
node
,
char
*
newname
)
{
void
clusterRenameNode
(
clusterNode
*
node
,
char
*
newname
)
{
int
retval
;
int
retval
;
sds
s
=
sdsnewlen
(
node
->
name
,
REDIS_CLUSTER_NAMELEN
);
sds
s
=
sdsnewlen
(
node
->
name
,
REDIS_CLUSTER_NAMELEN
);
redisLog
(
REDIS_DEBUG
,
"Renaming node %.40s into %.40s"
,
redisLog
(
REDIS_DEBUG
,
"Renaming node %.40s into %.40s"
,
node
->
name
,
newname
);
node
->
name
,
newname
);
retval
=
dictDelete
(
server
.
cluster
->
nodes
,
s
);
retval
=
dictDelete
(
server
.
cluster
->
nodes
,
s
);
...
@@ -1783,7 +1783,7 @@ int clusterProcessPacket(clusterLink *link) {
...
@@ -1783,7 +1783,7 @@ int clusterProcessPacket(clusterLink *link) {
/* This function is called when we detect the link with this node is lost.
/* This function is called when we detect the link with this node is lost.
We set the node as no longer connected. The Cluster Cron will detect
We set the node as no longer connected. The Cluster Cron will detect
this connection and will try to get it connected again.
this connection and will try to get it connected again.
Instead if the node is a temporary node used to accept a query, we
Instead if the node is a temporary node used to accept a query, we
completely free the node on error. */
completely free the node on error. */
void
handleLinkIOError
(
clusterLink
*
link
)
{
void
handleLinkIOError
(
clusterLink
*
link
)
{
...
@@ -1893,7 +1893,7 @@ void clusterSendMessage(clusterLink *link, unsigned char *msg, size_t msglen) {
...
@@ -1893,7 +1893,7 @@ void clusterSendMessage(clusterLink *link, unsigned char *msg, size_t msglen) {
/* Send a message to all the nodes that are part of the cluster having
/* Send a message to all the nodes that are part of the cluster having
* a connected link.
* a connected link.
*
*
* It is guaranteed that this function will never have as a side effect
* It is guaranteed that this function will never have as a side effect
* some node->link to be invalidated, so it is safe to call this function
* some node->link to be invalidated, so it is safe to call this function
* from event handlers that will do stuff with node links later. */
* from event handlers that will do stuff with node links later. */
...
@@ -1987,7 +1987,7 @@ void clusterSendPing(clusterLink *link, int type) {
...
@@ -1987,7 +1987,7 @@ void clusterSendPing(clusterLink *link, int type) {
if
(
link
->
node
&&
type
==
CLUSTERMSG_TYPE_PING
)
if
(
link
->
node
&&
type
==
CLUSTERMSG_TYPE_PING
)
link
->
node
->
ping_sent
=
mstime
();
link
->
node
->
ping_sent
=
mstime
();
clusterBuildMessageHdr
(
hdr
,
type
);
clusterBuildMessageHdr
(
hdr
,
type
);
/* Populate the gossip fields */
/* Populate the gossip fields */
while
(
freshnodes
>
0
&&
gossipcount
<
3
)
{
while
(
freshnodes
>
0
&&
gossipcount
<
3
)
{
dictEntry
*
de
=
dictGetRandomKey
(
server
.
cluster
->
nodes
);
dictEntry
*
de
=
dictGetRandomKey
(
server
.
cluster
->
nodes
);
...
@@ -3052,7 +3052,7 @@ void clusterUpdateState(void) {
...
@@ -3052,7 +3052,7 @@ void clusterUpdateState(void) {
* of the netsplit because of lack of majority. */
* of the netsplit because of lack of majority. */
{
{
int
needed_quorum
=
(
server
.
cluster
->
size
/
2
)
+
1
;
int
needed_quorum
=
(
server
.
cluster
->
size
/
2
)
+
1
;
if
(
unreachable_masters
>=
needed_quorum
)
{
if
(
unreachable_masters
>=
needed_quorum
)
{
new_state
=
REDIS_CLUSTER_FAIL
;
new_state
=
REDIS_CLUSTER_FAIL
;
among_minority_time
=
mstime
();
among_minority_time
=
mstime
();
...
@@ -4028,7 +4028,7 @@ try_again:
...
@@ -4028,7 +4028,7 @@ try_again:
addReplySds
(
c
,
sdsnew
(
"+NOKEY
\r\n
"
));
addReplySds
(
c
,
sdsnew
(
"+NOKEY
\r\n
"
));
return
;
return
;
}
}
/* Connect */
/* Connect */
fd
=
migrateGetSocket
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
],
timeout
);
fd
=
migrateGetSocket
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
],
timeout
);
if
(
fd
==
-
1
)
return
;
/* error sent to the client by migrateGetSocket() */
if
(
fd
==
-
1
)
return
;
/* error sent to the client by migrateGetSocket() */
...
...
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