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
1b1b3f6c
Commit
1b1b3f6c
authored
Feb 26, 2013
by
antirez
Browse files
Cluster: invert two functions declarations in more natural order.
parent
d5e8b0a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
1b1b3f6c
...
@@ -374,6 +374,26 @@ void clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) {
...
@@ -374,6 +374,26 @@ void clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) {
listAddNodeTail
(
l
,
fr
);
listAddNodeTail
(
l
,
fr
);
}
}
/* Remove failure reports that are too old, where too old means reasonably
* older than the global node timeout. Note that anyway for a node to be
* flagged as FAIL we need to have a local PFAIL state that is at least
* older than the global node timeout, so we don't just trust the number
* of failure reports from other nodes. */
void
clusterNodeCleanupFailureReports
(
clusterNode
*
node
)
{
list
*
l
=
node
->
fail_reports
;
listNode
*
ln
;
listIter
li
;
clusterNodeFailReport
*
fr
;
time_t
maxtime
=
server
.
cluster
->
node_timeout
*
2
;
time_t
now
=
time
(
NULL
);
listRewind
(
l
,
&
li
);
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
fr
=
ln
->
value
;
if
(
now
-
fr
->
time
>
maxtime
)
listDelNode
(
l
,
ln
);
}
}
/* Remove the failing report for 'node' if it was previously considered
/* Remove the failing report for 'node' if it was previously considered
* failing by 'sender'. This function is called when a node informs us via
* failing by 'sender'. This function is called when a node informs us via
* gossip that a node is OK from its point of view (no FAIL or PFAIL flags).
* gossip that a node is OK from its point of view (no FAIL or PFAIL flags).
...
@@ -401,26 +421,6 @@ void clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
...
@@ -401,26 +421,6 @@ void clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
clusterNodeCleanupFailureReports
(
node
);
clusterNodeCleanupFailureReports
(
node
);
}
}
/* Remove failure reports that are too old, where too old means reasonably
* older than the global node timeout. Note that anyway for a node to be
* flagged as FAIL we need to have a local PFAIL state that is at least
* older than the global node timeout, so we don't just trust the number
* of failure reports from other nodes. */
void clusterNodeCleanupFailureReports(clusterNode *node) {
list *l = node->fail_reports;
listNode *ln;
listIter li;
clusterNodeFailReport *fr;
time_t maxtime = server.cluster->node_timeout*2;
time_t now = time(NULL);
listRewind(l,&li);
while ((ln = listNext(&li)) != NULL) {
fr = ln->value;
if (now - fr->time > maxtime) listDelNode(l,ln);
}
}
/* Return the number of external nodes that believe 'node' is failing,
/* Return the number of external nodes that believe 'node' is failing,
* not including this node, that may have a PFAIL or FAIL state for this
* not including this node, that may have a PFAIL or FAIL state for this
* node as well. */
* node as well. */
...
...
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