Fix typos include two code typos in cluster.c and latency.c

This commit is contained in:
zhaojun11 2018-01-17 19:05:28 +08:00
parent e1e0bbe04d
commit 3c02028606
5 changed files with 35 additions and 35 deletions

View File

@ -621,7 +621,7 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
serverLog(LL_VERBOSE,"Accepted cluster node %s:%d", cip, cport); serverLog(LL_VERBOSE,"Accepted cluster node %s:%d", cip, cport);
/* Create a link object we use to handle the connection. /* Create a link object we use to handle the connection.
* It gets passed to the readable handler when data is available. * It gets passed to the readable handler when data is available.
* Initiallly the link->node pointer is set to NULL as we don't know * Initially the link->node pointer is set to NULL as we don't know
* which node is, but the right node is references once we know the * which node is, but the right node is references once we know the
* node identity. */ * node identity. */
link = createClusterLink(NULL); link = createClusterLink(NULL);
@ -872,7 +872,7 @@ int clusterAddNode(clusterNode *node) {
return (retval == DICT_OK) ? C_OK : C_ERR; return (retval == DICT_OK) ? C_OK : C_ERR;
} }
/* Remove a node from the cluster. The functio performs the high level /* Remove a node from the cluster. The function performs the high level
* cleanup, calling freeClusterNode() for the low level cleanup. * cleanup, calling freeClusterNode() for the low level cleanup.
* Here we do the following: * Here we do the following:
* *
@ -969,7 +969,7 @@ uint64_t clusterGetMaxEpoch(void) {
* 3) Persist the configuration on disk before sending packets with the * 3) Persist the configuration on disk before sending packets with the
* new configuration. * new configuration.
* *
* If the new config epoch is generated and assigend, C_OK is returned, * If the new config epoch is generated and assigned, C_OK is returned,
* otherwise C_ERR is returned (since the node has already the greatest * otherwise C_ERR is returned (since the node has already the greatest
* configuration around) and no operation is performed. * configuration around) and no operation is performed.
* *
@ -1042,7 +1042,7 @@ int clusterBumpConfigEpochWithoutConsensus(void) {
* *
* In general we want a system that eventually always ends with different * In general we want a system that eventually always ends with different
* masters having different configuration epochs whatever happened, since * masters having different configuration epochs whatever happened, since
* nothign is worse than a split-brain condition in a distributed system. * nothing is worse than a split-brain condition in a distributed system.
* *
* BEHAVIOR * BEHAVIOR
* *
@ -1101,7 +1101,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
* entries from the black list. This is an O(N) operation but it is not a * entries from the black list. This is an O(N) operation but it is not a
* problem since add / exists operations are called very infrequently and * problem since add / exists operations are called very infrequently and
* the hash table is supposed to contain very little elements at max. * the hash table is supposed to contain very little elements at max.
* However without the cleanup during long uptimes and with some automated * However without the cleanup during long uptime and with some automated
* node add/removal procedures, entries could accumulate. */ * node add/removal procedures, entries could accumulate. */
void clusterBlacklistCleanup(void) { void clusterBlacklistCleanup(void) {
dictIterator *di; dictIterator *di;
@ -1669,7 +1669,7 @@ int clusterProcessPacket(clusterLink *link) {
/* Check if the sender is a known node. */ /* Check if the sender is a known node. */
sender = clusterLookupNode(hdr->sender); sender = clusterLookupNode(hdr->sender);
if (sender && !nodeInHandshake(sender)) { if (sender && !nodeInHandshake(sender)) {
/* Update our curretEpoch if we see a newer epoch in the cluster. */ /* Update our currentEpoch if we see a newer epoch in the cluster. */
senderCurrentEpoch = ntohu64(hdr->currentEpoch); senderCurrentEpoch = ntohu64(hdr->currentEpoch);
senderConfigEpoch = ntohu64(hdr->configEpoch); senderConfigEpoch = ntohu64(hdr->configEpoch);
if (senderCurrentEpoch > server.cluster->currentEpoch) if (senderCurrentEpoch > server.cluster->currentEpoch)
@ -2294,7 +2294,7 @@ void clusterSetGossipEntry(clusterMsg *hdr, int i, clusterNode *n) {
} }
/* Send a PING or PONG packet to the specified node, making sure to add enough /* Send a PING or PONG packet to the specified node, making sure to add enough
* gossip informations. */ * gossip information. */
void clusterSendPing(clusterLink *link, int type) { void clusterSendPing(clusterLink *link, int type) {
unsigned char *buf; unsigned char *buf;
clusterMsg *hdr; clusterMsg *hdr;
@ -2314,7 +2314,7 @@ void clusterSendPing(clusterLink *link, int type) {
* node_timeout we exchange with each other node at least 4 packets * node_timeout we exchange with each other node at least 4 packets
* (we ping in the worst case in node_timeout/2 time, and we also * (we ping in the worst case in node_timeout/2 time, and we also
* receive two pings from the host), we have a total of 8 packets * receive two pings from the host), we have a total of 8 packets
* in the node_timeout*2 falure reports validity time. So we have * in the node_timeout*2 failure reports validity time. So we have
* that, for a single PFAIL node, we can expect to receive the following * that, for a single PFAIL node, we can expect to receive the following
* number of failure reports (in the specified window of time): * number of failure reports (in the specified window of time):
* *
@ -2331,7 +2331,7 @@ void clusterSendPing(clusterLink *link, int type) {
* same time. * same time.
* *
* Since we have non-voting slaves that lower the probability of an entry * Since we have non-voting slaves that lower the probability of an entry
* to feature our node, we set the number of entires per packet as * to feature our node, we set the number of entries per packet as
* 10% of the total nodes we have. */ * 10% of the total nodes we have. */
wanted = floor(dictSize(server.cluster->nodes)/10); wanted = floor(dictSize(server.cluster->nodes)/10);
if (wanted < 3) wanted = 3; if (wanted < 3) wanted = 3;
@ -2378,7 +2378,7 @@ void clusterSendPing(clusterLink *link, int type) {
if (this->flags & (CLUSTER_NODE_HANDSHAKE|CLUSTER_NODE_NOADDR) || if (this->flags & (CLUSTER_NODE_HANDSHAKE|CLUSTER_NODE_NOADDR) ||
(this->link == NULL && this->numslots == 0)) (this->link == NULL && this->numslots == 0))
{ {
freshnodes--; /* Tecnically not correct, but saves CPU. */ freshnodes--; /* Technically not correct, but saves CPU. */
continue; continue;
} }
@ -2901,7 +2901,7 @@ void clusterHandleSlaveFailover(void) {
} }
} }
/* If the previous failover attempt timedout and the retry time has /* If the previous failover attempt timeout and the retry time has
* elapsed, we can setup a new one. */ * elapsed, we can setup a new one. */
if (auth_age > auth_retry_time) { if (auth_age > auth_retry_time) {
server.cluster->failover_auth_time = mstime() + server.cluster->failover_auth_time = mstime() +
@ -2994,7 +2994,7 @@ void clusterHandleSlaveFailover(void) {
(unsigned long long) myself->configEpoch); (unsigned long long) myself->configEpoch);
} }
/* Take responsability for the cluster slots. */ /* Take responsibility for the cluster slots. */
clusterFailoverReplaceYourMaster(); clusterFailoverReplaceYourMaster();
} else { } else {
clusterLogCantFailover(CLUSTER_CANT_FAILOVER_WAITING_VOTES); clusterLogCantFailover(CLUSTER_CANT_FAILOVER_WAITING_VOTES);
@ -3006,7 +3006,7 @@ void clusterHandleSlaveFailover(void) {
* *
* Slave migration is the process that allows a slave of a master that is * Slave migration is the process that allows a slave of a master that is
* already covered by at least another slave, to "migrate" to a master that * already covered by at least another slave, to "migrate" to a master that
* is orpaned, that is, left with no working slaves. * is orphaned, that is, left with no working slaves.
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/* This function is responsible to decide if this replica should be migrated /* This function is responsible to decide if this replica should be migrated
@ -3023,7 +3023,7 @@ void clusterHandleSlaveFailover(void) {
* the nodes anyway, so we spend time into clusterHandleSlaveMigration() * the nodes anyway, so we spend time into clusterHandleSlaveMigration()
* if definitely needed. * if definitely needed.
* *
* The fuction is called with a pre-computed max_slaves, that is the max * The function is called with a pre-computed max_slaves, that is the max
* number of working (not in FAIL state) slaves for a single master. * number of working (not in FAIL state) slaves for a single master.
* *
* Additional conditions for migration are examined inside the function. * Additional conditions for migration are examined inside the function.
@ -3045,7 +3045,7 @@ void clusterHandleSlaveMigration(int max_slaves) {
!nodeTimedOut(mymaster->slaves[j])) okslaves++; !nodeTimedOut(mymaster->slaves[j])) okslaves++;
if (okslaves <= server.cluster_migration_barrier) return; if (okslaves <= server.cluster_migration_barrier) return;
/* Step 3: Idenitfy a candidate for migration, and check if among the /* Step 3: Identify a candidate for migration, and check if among the
* masters with the greatest number of ok slaves, I'm the one with the * masters with the greatest number of ok slaves, I'm the one with the
* smallest node ID (the "candidate slave"). * smallest node ID (the "candidate slave").
* *
@ -3141,7 +3141,7 @@ void clusterHandleSlaveMigration(int max_slaves) {
* data loss due to the asynchronous master-slave replication. * data loss due to the asynchronous master-slave replication.
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/* Reset the manual failover state. This works for both masters and slavesa /* Reset the manual failover state. This works for both masters and slaves
* as all the state about manual failover is cleared. * as all the state about manual failover is cleared.
* *
* The function can be used both to initialize the manual failover state at * The function can be used both to initialize the manual failover state at
@ -3549,12 +3549,12 @@ int clusterNodeSetSlotBit(clusterNode *n, int slot) {
* target for replicas migration, if and only if at least one of * target for replicas migration, if and only if at least one of
* the other masters has slaves right now. * the other masters has slaves right now.
* *
* Normally masters are valid targerts of replica migration if: * Normally masters are valid targets of replica migration if:
* 1. The used to have slaves (but no longer have). * 1. The used to have slaves (but no longer have).
* 2. They are slaves failing over a master that used to have slaves. * 2. They are slaves failing over a master that used to have slaves.
* *
* However new masters with slots assigned are considered valid * However new masters with slots assigned are considered valid
* migration tagets if the rest of the cluster is not a slave-less. * migration targets if the rest of the cluster is not a slave-less.
* *
* See https://github.com/antirez/redis/issues/3043 for more info. */ * See https://github.com/antirez/redis/issues/3043 for more info. */
if (n->numslots == 1 && clusterMastersHaveSlaves()) if (n->numslots == 1 && clusterMastersHaveSlaves())
@ -3627,7 +3627,7 @@ void clusterCloseAllSlots(void) {
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/* The following are defines that are only used in the evaluation function /* The following are defines that are only used in the evaluation function
* and are based on heuristics. Actaully the main point about the rejoin and * and are based on heuristics. Actually the main point about the rejoin and
* writable delay is that they should be a few orders of magnitude larger * writable delay is that they should be a few orders of magnitude larger
* than the network latency. */ * than the network latency. */
#define CLUSTER_MAX_REJOIN_DELAY 5000 #define CLUSTER_MAX_REJOIN_DELAY 5000
@ -3738,7 +3738,7 @@ void clusterUpdateState(void) {
* A) If no other node is in charge according to the current cluster * A) If no other node is in charge according to the current cluster
* configuration, we add these slots to our node. * configuration, we add these slots to our node.
* B) If according to our config other nodes are already in charge for * B) If according to our config other nodes are already in charge for
* this lots, we set the slots as IMPORTING from our point of view * this slots, we set the slots as IMPORTING from our point of view
* in order to justify we have those slots, and in order to make * in order to justify we have those slots, and in order to make
* redis-trib aware of the issue, so that it can try to fix it. * redis-trib aware of the issue, so that it can try to fix it.
* 2) If we find data in a DB different than DB0 we return C_ERR to * 2) If we find data in a DB different than DB0 we return C_ERR to
@ -4076,7 +4076,7 @@ void clusterCommand(client *c) {
"forget <node-id> -- Remove a node from the cluster.", "forget <node-id> -- Remove a node from the cluster.",
"getkeysinslot <slot> <count> -- Return key names stored by current node in a slot.", "getkeysinslot <slot> <count> -- Return key names stored by current node in a slot.",
"flushslots -- Delete current node own slots information.", "flushslots -- Delete current node own slots information.",
"info - Return onformation about the cluster.", "info - Return information about the cluster.",
"keyslot <key> -- Return the hash slot for <key>.", "keyslot <key> -- Return the hash slot for <key>.",
"meet <ip> <port> [bus-port] -- Connect nodes into a working cluster.", "meet <ip> <port> [bus-port] -- Connect nodes into a working cluster.",
"myid -- Return the node id.", "myid -- Return the node id.",
@ -4256,7 +4256,7 @@ NULL
} }
/* If this slot is in migrating status but we have no keys /* If this slot is in migrating status but we have no keys
* for it assigning the slot to another node will clear * for it assigning the slot to another node will clear
* the migratig status. */ * the migrating status. */
if (countKeysInSlot(slot) == 0 && if (countKeysInSlot(slot) == 0 &&
server.cluster->migrating_slots_to[slot]) server.cluster->migrating_slots_to[slot])
server.cluster->migrating_slots_to[slot] = NULL; server.cluster->migrating_slots_to[slot] = NULL;
@ -4880,7 +4880,7 @@ void migrateCloseSocket(robj *host, robj *port) {
sdsfree(name); sdsfree(name);
} }
void migrateCloseTimedoutSockets(void) { void migrateCloseTimeoutSockets(void) {
dictIterator *di = dictGetSafeIterator(server.migrate_cached_sockets); dictIterator *di = dictGetSafeIterator(server.migrate_cached_sockets);
dictEntry *de; dictEntry *de;
@ -5244,7 +5244,7 @@ void readwriteCommand(client *c) {
* resharding in progress). * resharding in progress).
* *
* On success the function returns the node that is able to serve the request. * On success the function returns the node that is able to serve the request.
* If the node is not 'myself' a redirection must be perfomed. The kind of * If the node is not 'myself' a redirection must be performed. The kind of
* redirection is specified setting the integer passed by reference * redirection is specified setting the integer passed by reference
* 'error_code', which will be set to CLUSTER_REDIR_ASK or * 'error_code', which will be set to CLUSTER_REDIR_ASK or
* CLUSTER_REDIR_MOVED. * CLUSTER_REDIR_MOVED.
@ -5363,7 +5363,7 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
} }
} }
/* Migarting / Improrting slot? Count keys we don't have. */ /* Migrating / Importing slot? Count keys we don't have. */
if ((migrating_slot || importing_slot) && if ((migrating_slot || importing_slot) &&
lookupKeyRead(&server.db[0],thiskey) == NULL) lookupKeyRead(&server.db[0],thiskey) == NULL)
{ {
@ -5443,7 +5443,7 @@ void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_co
if (error_code == CLUSTER_REDIR_CROSS_SLOT) { if (error_code == CLUSTER_REDIR_CROSS_SLOT) {
addReplySds(c,sdsnew("-CROSSSLOT Keys in request don't hash to the same slot\r\n")); addReplySds(c,sdsnew("-CROSSSLOT Keys in request don't hash to the same slot\r\n"));
} else if (error_code == CLUSTER_REDIR_UNSTABLE) { } else if (error_code == CLUSTER_REDIR_UNSTABLE) {
/* The request spawns mutliple keys in the same slot, /* The request spawns multiple keys in the same slot,
* but the slot is not "stable" currently as there is * but the slot is not "stable" currently as there is
* a migration or import in progress. */ * a migration or import in progress. */
addReplySds(c,sdsnew("-TRYAGAIN Multiple keys request during rehashing of slot\r\n")); addReplySds(c,sdsnew("-TRYAGAIN Multiple keys request during rehashing of slot\r\n"));

View File

@ -85,7 +85,7 @@ int THPGetAnonHugePagesSize(void) {
/* ---------------------------- Latency API --------------------------------- */ /* ---------------------------- Latency API --------------------------------- */
/* Latency monitor initialization. We just need to create the dictionary /* Latency monitor initialization. We just need to create the dictionary
* of time series, each time serie is craeted on demand in order to avoid * of time series, each time serie is created on demand in order to avoid
* having a fixed list to maintain. */ * having a fixed list to maintain. */
void latencyMonitorInit(void) { void latencyMonitorInit(void) {
server.latency_events = dictCreate(&latencyTimeSeriesDictType,NULL); server.latency_events = dictCreate(&latencyTimeSeriesDictType,NULL);
@ -151,9 +151,9 @@ int latencyResetEvent(char *event_to_reset) {
/* ------------------------ Latency reporting (doctor) ---------------------- */ /* ------------------------ Latency reporting (doctor) ---------------------- */
/* Analyze the samples avaialble for a given event and return a structure /* Analyze the samples available for a given event and return a structure
* populate with different metrics, average, MAD, min, max, and so forth. * populate with different metrics, average, MAD, min, max, and so forth.
* Check latency.h definition of struct latenctStat for more info. * Check latency.h definition of struct latencyStats for more info.
* If the specified event has no elements the structure is populate with * If the specified event has no elements the structure is populate with
* zero values. */ * zero values. */
void analyzeLatencyForEvent(char *event, struct latencyStats *ls) { void analyzeLatencyForEvent(char *event, struct latencyStats *ls) {
@ -342,7 +342,7 @@ sds createLatencyReport(void) {
} }
if (!strcasecmp(event,"aof-fstat") || if (!strcasecmp(event,"aof-fstat") ||
!strcasecmp(event,"rdb-unlik-temp-file")) { !strcasecmp(event,"rdb-unlink-temp-file")) {
advise_disk_contention = 1; advise_disk_contention = 1;
advise_local_disk = 1; advise_local_disk = 1;
advices += 2; advices += 2;

View File

@ -1171,7 +1171,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* Cleanup expired MIGRATE cached sockets. */ /* Cleanup expired MIGRATE cached sockets. */
run_with_period(1000) { run_with_period(1000) {
migrateCloseTimedoutSockets(); migrateCloseTimeoutSockets();
} }
/* Start a scheduled BGSAVE if the corresponding flag is set. This is /* Start a scheduled BGSAVE if the corresponding flag is set. This is

View File

@ -1779,7 +1779,7 @@ unsigned short crc16(const char *buf, int len);
unsigned int keyHashSlot(char *key, int keylen); unsigned int keyHashSlot(char *key, int keylen);
void clusterCron(void); void clusterCron(void);
void clusterPropagatePublish(robj *channel, robj *message); void clusterPropagatePublish(robj *channel, robj *message);
void migrateCloseTimedoutSockets(void); void migrateCloseTimeoutSockets(void);
void clusterBeforeSleep(void); void clusterBeforeSleep(void);
/* Sentinel */ /* Sentinel */

View File

@ -1,7 +1,7 @@
# Failover stress test. # Failover stress test.
# In this test a different node is killed in a loop for N # In this test a different node is killed in a loop for N
# iterations. The test checks that certain properties # iterations. The test checks that certain properties
# are preseved across iterations. # are preserved across iterations.
source "../tests/includes/init-tests.tcl" source "../tests/includes/init-tests.tcl"
@ -31,7 +31,7 @@ test "Enable AOF in all the instances" {
} }
} }
# Return nno-zero if the specified PID is about a process still in execution, # Return non-zero if the specified PID is about a process still in execution,
# otherwise 0 is returned. # otherwise 0 is returned.
proc process_is_running {pid} { proc process_is_running {pid} {
# PS should return with an error if PID is non existing, # PS should return with an error if PID is non existing,
@ -44,7 +44,7 @@ proc process_is_running {pid} {
# #
# - N commands are sent to the cluster in the course of the test. # - N commands are sent to the cluster in the course of the test.
# - Every command selects a random key from key:0 to key:MAX-1. # - Every command selects a random key from key:0 to key:MAX-1.
# - The operation RPUSH key <randomvalue> is perforemd. # - The operation RPUSH key <randomvalue> is performed.
# - Tcl remembers into an array all the values pushed to each list. # - Tcl remembers into an array all the values pushed to each list.
# - After N/2 commands, the resharding process is started in background. # - After N/2 commands, the resharding process is started in background.
# - The test continues while the resharding is in progress. # - The test continues while the resharding is in progress.