MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clusterNodeDelFailureReport

Function clusterNodeDelFailureReport

src/cluster.cpp:920–938  ·  view source on GitHub ↗

Remove the failing report for 'node' if it was previously considered * 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). * * Note that this function is called relatively often as it gets called even * when there are no nodes failing, and is O(N), however when the cluster is * fine the failure re

Source from the content-addressed store, hash-verified

918 * The function returns 1 if the failure report was found and removed.
919 * Otherwise 0 is returned. */
920int clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
921 list *l = node->fail_reports;
922 listNode *ln;
923 listIter li;
924 clusterNodeFailReport *fr;
925
926 /* Search for a failure report from this sender. */
927 listRewind(l,&li);
928 while ((ln = listNext(&li)) != NULL) {
929 fr = (clusterNodeFailReport*)ln->value;
930 if (fr->node == sender) break;
931 }
932 if (!ln) return 0; /* No failure report from this sender. */
933
934 /* Remove the failure report. */
935 listDelNode(l,ln);
936 clusterNodeCleanupFailureReports(node);
937 return 1;
938}
939
940/* Return the number of external nodes that believe 'node' is failing,
941 * not including this node, that may have a PFAIL or FAIL state for this

Callers 2

clusterDelNodeFunction · 0.85

Calls 4

listRewindFunction · 0.85
listNextFunction · 0.85
listDelNodeFunction · 0.85

Tested by

no test coverage detected