Commit 9d09ce39 authored by guiquanz's avatar guiquanz Committed by antirez
Browse files

Fixed many typos.

parent 61dfc2e5
...@@ -72,7 +72,7 @@ robj *createStringObjectFromLongDouble(long double value) { ...@@ -72,7 +72,7 @@ robj *createStringObjectFromLongDouble(long double value) {
int len; int len;
/* We use 17 digits precision since with 128 bit floats that precision /* We use 17 digits precision since with 128 bit floats that precision
* after rouding is able to represent most small decimal numbers in a way * after rounding is able to represent most small decimal numbers in a way
* that is "non surprising" for the user (that is, most small decimal * that is "non surprising" for the user (that is, most small decimal
* numbers will be represented in a way that when converted back into * numbers will be represented in a way that when converted back into
* a string are exactly the same as what the user typed.) */ * a string are exactly the same as what the user typed.) */
......
...@@ -117,7 +117,7 @@ int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) { ...@@ -117,7 +117,7 @@ int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
return retval; return retval;
} }
/* Subscribe a client to a pattern. Returns 1 if the operation succeeded, or 0 if the clinet was already subscribed to that pattern. */ /* Subscribe a client to a pattern. Returns 1 if the operation succeeded, or 0 if the client was already subscribed to that pattern. */
int pubsubSubscribePattern(redisClient *c, robj *pattern) { int pubsubSubscribePattern(redisClient *c, robj *pattern) {
int retval = 0; int retval = 0;
......
...@@ -265,7 +265,7 @@ err: ...@@ -265,7 +265,7 @@ err:
return NULL; return NULL;
} }
/* Save a string objet as [len][data] on disk. If the object is a string /* Save a string object as [len][data] on disk. If the object is a string
* representation of an integer value we try to save it in a special form */ * representation of an integer value we try to save it in a special form */
int rdbSaveRawString(rio *rdb, unsigned char *s, size_t len) { int rdbSaveRawString(rio *rdb, unsigned char *s, size_t len) {
int enclen; int enclen;
...@@ -321,7 +321,7 @@ int rdbSaveLongLongAsStringObject(rio *rdb, long long value) { ...@@ -321,7 +321,7 @@ int rdbSaveLongLongAsStringObject(rio *rdb, long long value) {
/* Like rdbSaveStringObjectRaw() but handle encoded objects */ /* Like rdbSaveStringObjectRaw() but handle encoded objects */
int rdbSaveStringObject(rio *rdb, robj *obj) { int rdbSaveStringObject(rio *rdb, robj *obj) {
/* Avoid to decode the object, then encode it again, if the /* Avoid to decode the object, then encode it again, if the
* object is alrady integer encoded. */ * object is already integer encoded. */
if (obj->encoding == REDIS_ENCODING_INT) { if (obj->encoding == REDIS_ENCODING_INT) {
return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr); return rdbSaveLongLongAsStringObject(rdb,(long)obj->ptr);
} else { } else {
...@@ -367,7 +367,7 @@ robj *rdbLoadEncodedStringObject(rio *rdb) { ...@@ -367,7 +367,7 @@ robj *rdbLoadEncodedStringObject(rio *rdb) {
} }
/* Save a double value. Doubles are saved as strings prefixed by an unsigned /* Save a double value. Doubles are saved as strings prefixed by an unsigned
* 8 bit integer specifing the length of the representation. * 8 bit integer specifying the length of the representation.
* This 8 bit integer has special values in order to specify the following * This 8 bit integer has special values in order to specify the following
* conditions: * conditions:
* 253: not a number * 253: not a number
...@@ -606,7 +606,7 @@ off_t rdbSavedObjectLen(robj *o) { ...@@ -606,7 +606,7 @@ off_t rdbSavedObjectLen(robj *o) {
/* Save a key-value pair, with expire time, type, key, value. /* Save a key-value pair, with expire time, type, key, value.
* On error -1 is returned. * On error -1 is returned.
* On success if the key was actaully saved 1 is returned, otherwise 0 * On success if the key was actually saved 1 is returned, otherwise 0
* is returned (the key was already expired). */ * is returned (the key was already expired). */
int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val, int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val,
long long expiretime, long long now) long long expiretime, long long now)
...@@ -1109,7 +1109,7 @@ int rdbLoad(char *filename) { ...@@ -1109,7 +1109,7 @@ int rdbLoad(char *filename) {
/* We read the time so we need to read the object type again. */ /* We read the time so we need to read the object type again. */
if ((type = rdbLoadType(&rdb)) == -1) goto eoferr; if ((type = rdbLoadType(&rdb)) == -1) goto eoferr;
/* the EXPIRETIME opcode specifies time in seconds, so convert /* the EXPIRETIME opcode specifies time in seconds, so convert
* into milliesconds. */ * into milliseconds. */
expiretime *= 1000; expiretime *= 1000;
} else if (type == REDIS_RDB_OPCODE_EXPIRETIME_MS) { } else if (type == REDIS_RDB_OPCODE_EXPIRETIME_MS) {
/* Milliseconds precision expire times introduced with RDB /* Milliseconds precision expire times introduced with RDB
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
* number specify the kind of object that follows. * number specify the kind of object that follows.
* See the REDIS_RDB_ENC_* defines. * See the REDIS_RDB_ENC_* defines.
* *
* Lenghts up to 63 are stored using a single byte, most DB keys, and may * Lengths up to 63 are stored using a single byte, most DB keys, and may
* values, will fit inside. */ * values, will fit inside. */
#define REDIS_RDB_6BITLEN 0 #define REDIS_RDB_6BITLEN 0
#define REDIS_RDB_14BITLEN 1 #define REDIS_RDB_14BITLEN 1
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
* number specify the kind of object that follows. * number specify the kind of object that follows.
* See the REDIS_RDB_ENC_* defines. * See the REDIS_RDB_ENC_* defines.
* *
* Lenghts up to 63 are stored using a single byte, most DB keys, and may * Lengths up to 63 are stored using a single byte, most DB keys, and may
* values, will fit inside. */ * values, will fit inside. */
#define REDIS_RDB_6BITLEN 0 #define REDIS_RDB_6BITLEN 0
#define REDIS_RDB_14BITLEN 1 #define REDIS_RDB_14BITLEN 1
...@@ -133,7 +133,7 @@ typedef struct { ...@@ -133,7 +133,7 @@ typedef struct {
char success; char success;
} entry; } entry;
/* Global vars that are actally used as constants. The following double /* Global vars that are actually used as constants. The following double
* values are used for double on-disk serialization, and are initialized * values are used for double on-disk serialization, and are initialized
* at runtime to avoid strange compiler optimizations. */ * at runtime to avoid strange compiler optimizations. */
static double R_Zero, R_PosInf, R_NegInf, R_Nan; static double R_Zero, R_PosInf, R_NegInf, R_Nan;
......
...@@ -308,7 +308,7 @@ static int cliSelect() { ...@@ -308,7 +308,7 @@ static int cliSelect() {
return REDIS_ERR; return REDIS_ERR;
} }
/* Connect to the client. If force is not zero the connection is performed /* Connect to the server. If force is not zero the connection is performed
* even if there is already a connected socket. */ * even if there is already a connected socket. */
static int cliConnect(int force) { static int cliConnect(int force) {
if (context == NULL || force) { if (context == NULL || force) {
...@@ -976,7 +976,7 @@ static void slaveMode(void) { ...@@ -976,7 +976,7 @@ static void slaveMode(void) {
char buf[1024]; char buf[1024];
fprintf(stderr,"SYNC with master, discarding %llu " fprintf(stderr,"SYNC with master, discarding %llu "
"bytes of bulk tranfer...\n", payload); "bytes of bulk transfer...\n", payload);
/* Discard the payload. */ /* Discard the payload. */
while(payload) { while(payload) {
...@@ -1141,7 +1141,7 @@ static void pipeMode(void) { ...@@ -1141,7 +1141,7 @@ static void pipeMode(void) {
int j; int j;
eof = 1; eof = 1;
/* Everything transfered, so we queue a special /* Everything transferred, so we queue a special
* ECHO command that we can match in the replies * ECHO command that we can match in the replies
* to make sure everything was read from the server. */ * to make sure everything was read from the server. */
for (j = 0; j < 20; j++) for (j = 0; j < 20; j++)
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
# TODO (temporary here, we'll move this into the Github issues once # TODO (temporary here, we'll move this into the Github issues once
# redis-trib initial implementation is complted). # redis-trib initial implementation is completed).
# #
# - Make sure that if the rehashing fails in the middle redis-trib will try # - Make sure that if the rehashing fails in the middle redis-trib will try
# to recover. # to recover.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
# 1) If there is a node that pretend to receive a slot, or to migrate a # 1) If there is a node that pretend to receive a slot, or to migrate a
# slot, but has no entries in that slot, fix it. # slot, but has no entries in that slot, fix it.
# 2) If there is a node having keys in slots that are not owned by it # 2) If there is a node having keys in slots that are not owned by it
# fix this condiiton moving the entries in the same node. # fix this condition moving the entries in the same node.
# 3) Perform more possibly slow tests about the state of the cluster. # 3) Perform more possibly slow tests about the state of the cluster.
# 4) When aborted slot migration is detected, fix it. # 4) When aborted slot migration is detected, fix it.
...@@ -168,12 +168,12 @@ class ClusterNode ...@@ -168,12 +168,12 @@ class ClusterNode
# for instance: [1,2,3,4,5,8,9,20,21,22,23,24,25,30] # for instance: [1,2,3,4,5,8,9,20,21,22,23,24,25,30]
slots = @info[:slots].keys.sort slots = @info[:slots].keys.sort
# As we want to aggregate adiacent slots we convert all the # As we want to aggregate adjacent slots we convert all the
# slot integers into ranges (with just one element) # slot integers into ranges (with just one element)
# So we have something like [1..1,2..2, ... and so forth. # So we have something like [1..1,2..2, ... and so forth.
slots.map!{|x| x..x} slots.map!{|x| x..x}
# Finally we group ranges with adiacent elements. # Finally we group ranges with adjacent elements.
slots = slots.reduce([]) {|a,b| slots = slots.reduce([]) {|a,b|
if !a.empty? && b.first == (a[-1].last)+1 if !a.empty? && b.first == (a[-1].last)+1
a[0..-2] + [(a[-1].first)..(b.last)] a[0..-2] + [(a[-1].first)..(b.last)]
...@@ -313,7 +313,7 @@ class RedisTrib ...@@ -313,7 +313,7 @@ class RedisTrib
def compute_reshard_table(sources,numslots) def compute_reshard_table(sources,numslots)
moved = [] moved = []
# Sort from bigger to smaller instance, for two reasons: # Sort from bigger to smaller instance, for two reasons:
# 1) If we take less slots than instanes it is better to start getting from # 1) If we take less slots than instances it is better to start getting from
# the biggest instances. # the biggest instances.
# 2) We take one slot more from the first instance in the case of not perfect # 2) We take one slot more from the first instance in the case of not perfect
# divisibility. Like we have 3 nodes and need to get 10 slots, we take # divisibility. Like we have 3 nodes and need to get 10 slots, we take
......
...@@ -99,7 +99,7 @@ struct redisCommand *commandTable; ...@@ -99,7 +99,7 @@ struct redisCommand *commandTable;
* m: may increase memory usage once called. Don't allow if out of memory. * m: may increase memory usage once called. Don't allow if out of memory.
* a: admin command, like SAVE or SHUTDOWN. * a: admin command, like SAVE or SHUTDOWN.
* p: Pub/Sub related command. * p: Pub/Sub related command.
* f: force replication of this command, regarless of server.dirty. * f: force replication of this command, regardless of server.dirty.
* s: command not allowed in scripts. * s: command not allowed in scripts.
* R: random command. Command is not deterministic, that is, the same command * R: random command. Command is not deterministic, that is, the same command
* with the same arguments, with the same key space, may have different * with the same arguments, with the same key space, may have different
...@@ -290,7 +290,7 @@ void redisLogRaw(int level, const char *msg) { ...@@ -290,7 +290,7 @@ void redisLogRaw(int level, const char *msg) {
if (server.syslog_enabled) syslog(syslogLevelMap[level], "%s", msg); if (server.syslog_enabled) syslog(syslogLevelMap[level], "%s", msg);
} }
/* Like redisLogRaw() but with printf-alike support. This is the funciton that /* Like redisLogRaw() but with printf-alike support. This is the function that
* is used across the code. The raw version is only used in order to dump * is used across the code. The raw version is only used in order to dump
* the INFO output on crash. */ * the INFO output on crash. */
void redisLog(int level, const char *fmt, ...) { void redisLog(int level, const char *fmt, ...) {
...@@ -365,7 +365,7 @@ void exitFromChild(int retcode) { ...@@ -365,7 +365,7 @@ void exitFromChild(int retcode) {
/*====================== Hash table type implementation ==================== */ /*====================== Hash table type implementation ==================== */
/* This is an hash table type that uses the SDS dynamic strings libary as /* This is an hash table type that uses the SDS dynamic strings library as
* keys and radis objects as values (objects can hold SDS strings, * keys and radis objects as values (objects can hold SDS strings,
* lists, sets). */ * lists, sets). */
...@@ -539,7 +539,7 @@ dictType commandTableDictType = { ...@@ -539,7 +539,7 @@ dictType commandTableDictType = {
NULL /* val destructor */ NULL /* val destructor */
}; };
/* Hash type hash table (note that small hashes are represented with zimpaps) */ /* Hash type hash table (note that small hashes are represented with zipmaps) */
dictType hashDictType = { dictType hashDictType = {
dictEncObjHash, /* hash function */ dictEncObjHash, /* hash function */
NULL, /* key dup */ NULL, /* key dup */
...@@ -761,7 +761,7 @@ int clientsCronHandleTimeout(redisClient *c) { ...@@ -761,7 +761,7 @@ int clientsCronHandleTimeout(redisClient *c) {
/* The client query buffer is an sds.c string that can end with a lot of /* The client query buffer is an sds.c string that can end with a lot of
* free space not used, this function reclaims space if needed. * free space not used, this function reclaims space if needed.
* *
* The funciton always returns 0 as it never terminates the client. */ * The function always returns 0 as it never terminates the client. */
int clientsCronResizeQueryBuffer(redisClient *c) { int clientsCronResizeQueryBuffer(redisClient *c) {
size_t querybuf_size = sdsAllocSize(c->querybuf); size_t querybuf_size = sdsAllocSize(c->querybuf);
time_t idletime = server.unixtime - c->lastinteraction; time_t idletime = server.unixtime - c->lastinteraction;
...@@ -819,11 +819,11 @@ void clientsCron(void) { ...@@ -819,11 +819,11 @@ void clientsCron(void) {
* *
* - Active expired keys collection (it is also performed in a lazy way on * - Active expired keys collection (it is also performed in a lazy way on
* lookup). * lookup).
* - Software watchdong. * - Software watchdog.
* - Update some statistic. * - Update some statistic.
* - Incremental rehashing of the DBs hash tables. * - Incremental rehashing of the DBs hash tables.
* - Triggering BGSAVE / AOF rewrite, and handling of terminated children. * - Triggering BGSAVE / AOF rewrite, and handling of terminated children.
* - Clients timeout of differnet kinds. * - Clients timeout of different kinds.
* - Replication reconnection. * - Replication reconnection.
* - Many more... * - Many more...
* *
...@@ -852,7 +852,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { ...@@ -852,7 +852,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
/* We have just 22 bits per object for LRU information. /* We have just 22 bits per object for LRU information.
* So we use an (eventually wrapping) LRU clock with 10 seconds resolution. * So we use an (eventually wrapping) LRU clock with 10 seconds resolution.
* 2^22 bits with 10 seconds resoluton is more or less 1.5 years. * 2^22 bits with 10 seconds resolution is more or less 1.5 years.
* *
* Note that even if this will wrap after 1.5 years it's not a problem, * Note that even if this will wrap after 1.5 years it's not a problem,
* everything will still work but just some object will appear younger * everything will still work but just some object will appear younger
...@@ -890,7 +890,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { ...@@ -890,7 +890,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
} }
} }
/* We don't want to resize the hash tables while a bacground saving /* We don't want to resize the hash tables while a background saving
* is in progress: the saving child is created using fork() that is * is in progress: the saving child is created using fork() that is
* implemented with a copy-on-write semantic in most modern systems, so * implemented with a copy-on-write semantic in most modern systems, so
* if we resize the HT while there is the saving child at work actually * if we resize the HT while there is the saving child at work actually
...@@ -1215,7 +1215,7 @@ void initServerConfig() { ...@@ -1215,7 +1215,7 @@ void initServerConfig() {
R_NegInf = -1.0/R_Zero; R_NegInf = -1.0/R_Zero;
R_Nan = R_Zero/R_Zero; R_Nan = R_Zero/R_Zero;
/* Command table -- we intiialize it here as it is part of the /* Command table -- we initiialize it here as it is part of the
* initial configuration, since command names may be changed via * initial configuration, since command names may be changed via
* redis.conf using the rename-command directive. */ * redis.conf using the rename-command directive. */
server.commands = dictCreate(&commandTableDictType,NULL); server.commands = dictCreate(&commandTableDictType,NULL);
...@@ -1526,7 +1526,7 @@ void call(redisClient *c, int flags) { ...@@ -1526,7 +1526,7 @@ void call(redisClient *c, int flags) {
long long dirty, start = ustime(), duration; long long dirty, start = ustime(), duration;
/* Sent the command to clients in MONITOR mode, only if the commands are /* Sent the command to clients in MONITOR mode, only if the commands are
* not geneated from reading an AOF. */ * not generated from reading an AOF. */
if (listLength(server.monitors) && if (listLength(server.monitors) &&
!server.loading && !server.loading &&
!(c->cmd->flags & REDIS_CMD_SKIP_MONITOR)) !(c->cmd->flags & REDIS_CMD_SKIP_MONITOR))
...@@ -1588,8 +1588,8 @@ void call(redisClient *c, int flags) { ...@@ -1588,8 +1588,8 @@ void call(redisClient *c, int flags) {
* server for a bulk read from the client. * server for a bulk read from the client.
* *
* If 1 is returned the client is still alive and valid and * If 1 is returned the client is still alive and valid and
* and other operations can be performed by the caller. Otherwise * other operations can be performed by the caller. Otherwise
* if 0 is returned the client was destroied (i.e. after QUIT). */ * if 0 is returned the client was destroyed (i.e. after QUIT). */
int processCommand(redisClient *c) { int processCommand(redisClient *c) {
/* The QUIT command is handled separately. Normal command procs will /* The QUIT command is handled separately. Normal command procs will
* go through checking for replication and QUIT will cause trouble * go through checking for replication and QUIT will cause trouble
...@@ -1865,7 +1865,7 @@ void echoCommand(redisClient *c) { ...@@ -1865,7 +1865,7 @@ void echoCommand(redisClient *c) {
void timeCommand(redisClient *c) { void timeCommand(redisClient *c) {
struct timeval tv; struct timeval tv;
/* gettimeofday() can only fail if &tv is a bad addresss so we /* gettimeofday() can only fail if &tv is a bad address so we
* don't check for errors. */ * don't check for errors. */
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
addReplyMultiBulkLen(c,2); addReplyMultiBulkLen(c,2);
......
...@@ -144,12 +144,12 @@ ...@@ -144,12 +144,12 @@
* *
* 00|000000 => if the two MSB are 00 the len is the 6 bits of this byte * 00|000000 => if the two MSB are 00 the len is the 6 bits of this byte
* 01|000000 00000000 => 01, the len is 14 byes, 6 bits + 8 bits of next byte * 01|000000 00000000 => 01, the len is 14 byes, 6 bits + 8 bits of next byte
* 10|000000 [32 bit integer] => if it's 01, a full 32 bit len will follow * 10|000000 [32 bit integer] => if it's 10, a full 32 bit len will follow
* 11|000000 this means: specially encoded object will follow. The six bits * 11|000000 this means: specially encoded object will follow. The six bits
* number specify the kind of object that follows. * number specify the kind of object that follows.
* See the REDIS_RDB_ENC_* defines. * See the REDIS_RDB_ENC_* defines.
* *
* Lenghts up to 63 are stored using a single byte, most DB keys, and may * Lengths up to 63 are stored using a single byte, most DB keys, and may
* values, will fit inside. */ * values, will fit inside. */
#define REDIS_RDB_6BITLEN 0 #define REDIS_RDB_6BITLEN 0
#define REDIS_RDB_14BITLEN 1 #define REDIS_RDB_14BITLEN 1
...@@ -319,7 +319,7 @@ typedef struct redisObject { ...@@ -319,7 +319,7 @@ typedef struct redisObject {
void *ptr; void *ptr;
} robj; } robj;
/* Macro used to initalize a Redis object allocated on the stack. /* Macro used to initialize a Redis object allocated on the stack.
* Note that this macro is taken near the structure definition to make sure * Note that this macro is taken near the structure definition to make sure
* we'll update it when the structure is changed, to avoid bugs like * we'll update it when the structure is changed, to avoid bugs like
* bug #85 introduced exactly in this way. */ * bug #85 introduced exactly in this way. */
...@@ -376,7 +376,7 @@ typedef struct readyList { ...@@ -376,7 +376,7 @@ typedef struct readyList {
robj *key; robj *key;
} readyList; } readyList;
/* With multiplexing we need to take per-clinet state. /* With multiplexing we need to take per-client state.
* Clients are taken in a liked list. */ * Clients are taken in a liked list. */
typedef struct redisClient { typedef struct redisClient {
int fd; int fd;
...@@ -554,14 +554,14 @@ typedef struct { ...@@ -554,14 +554,14 @@ typedef struct {
/* Redis cluster messages header */ /* Redis cluster messages header */
/* Note that the PING, PONG and MEET messages are actually the same exact /* Note that the PING, PONG and MEET messages are actually the same exact
* kind of packet. PONG is the reply to ping, in the extact format as a PING, * kind of packet. PONG is the reply to ping, in the exact format as a PING,
* while MEET is a special PING that forces the receiver to add the sender * while MEET is a special PING that forces the receiver to add the sender
* as a node (if it is not already in the list). */ * as a node (if it is not already in the list). */
#define CLUSTERMSG_TYPE_PING 0 /* Ping */ #define CLUSTERMSG_TYPE_PING 0 /* Ping */
#define CLUSTERMSG_TYPE_PONG 1 /* Pong (reply to Ping) */ #define CLUSTERMSG_TYPE_PONG 1 /* Pong (reply to Ping) */
#define CLUSTERMSG_TYPE_MEET 2 /* Meet "let's join" message */ #define CLUSTERMSG_TYPE_MEET 2 /* Meet "let's join" message */
#define CLUSTERMSG_TYPE_FAIL 3 /* Mark node xxx as failing */ #define CLUSTERMSG_TYPE_FAIL 3 /* Mark node xxx as failing */
#define CLUSTERMSG_TYPE_PUBLISH 4 /* Pub/Sub Publish propatagion */ #define CLUSTERMSG_TYPE_PUBLISH 4 /* Pub/Sub Publish propagation */
/* Initially we don't know our "name", but we'll find it once we connect /* Initially we don't know our "name", but we'll find it once we connect
* to the first node, using the getsockname() function. Then we'll use this * to the first node, using the getsockname() function. Then we'll use this
...@@ -645,7 +645,7 @@ struct redisServer { ...@@ -645,7 +645,7 @@ struct redisServer {
mode_t unixsocketperm; /* UNIX socket permission */ mode_t unixsocketperm; /* UNIX socket permission */
int ipfd; /* TCP socket file descriptor */ int ipfd; /* TCP socket file descriptor */
int sofd; /* Unix socket file descriptor */ int sofd; /* Unix socket file descriptor */
int cfd; /* Cluster bus lisetning socket */ int cfd; /* Cluster bus listening socket */
list *clients; /* List of active clients */ list *clients; /* List of active clients */
list *clients_to_close; /* Clients to close asynchronously */ list *clients_to_close; /* Clients to close asynchronously */
list *slaves, *monitors; /* List of slaves and MONITORs */ list *slaves, *monitors; /* List of slaves and MONITORs */
...@@ -669,7 +669,7 @@ struct redisServer { ...@@ -669,7 +669,7 @@ struct redisServer {
long long stat_keyspace_hits; /* Number of successful lookups of keys */ long long stat_keyspace_hits; /* Number of successful lookups of keys */
long long stat_keyspace_misses; /* Number of failed lookups of keys */ long long stat_keyspace_misses; /* Number of failed lookups of keys */
size_t stat_peak_memory; /* Max used memory record */ size_t stat_peak_memory; /* Max used memory record */
long long stat_fork_time; /* Time needed to perform latets fork() */ long long stat_fork_time; /* Time needed to perform latest fork() */
long long stat_rejected_conn; /* Clients rejected because of maxclients */ long long stat_rejected_conn; /* Clients rejected because of maxclients */
list *slowlog; /* SLOWLOG list of commands */ list *slowlog; /* SLOWLOG list of commands */
long long slowlog_entry_id; /* SLOWLOG current entry ID */ long long slowlog_entry_id; /* SLOWLOG current entry ID */
...@@ -718,7 +718,7 @@ struct redisServer { ...@@ -718,7 +718,7 @@ struct redisServer {
char *rdb_filename; /* Name of RDB file */ char *rdb_filename; /* Name of RDB file */
int rdb_compression; /* Use compression in RDB? */ int rdb_compression; /* Use compression in RDB? */
int rdb_checksum; /* Use RDB checksum? */ int rdb_checksum; /* Use RDB checksum? */
time_t lastsave; /* Unix time of last save succeeede */ time_t lastsave; /* Unix time of last successful save */
time_t rdb_save_time_last; /* Time used by last RDB save run. */ time_t rdb_save_time_last; /* Time used by last RDB save run. */
time_t rdb_save_time_start; /* Current RDB save start time. */ time_t rdb_save_time_start; /* Current RDB save start time. */
int lastbgsave_status; /* REDIS_OK or REDIS_ERR */ int lastbgsave_status; /* REDIS_OK or REDIS_ERR */
...@@ -753,7 +753,7 @@ struct redisServer { ...@@ -753,7 +753,7 @@ struct redisServer {
/* Limits */ /* Limits */
unsigned int maxclients; /* Max number of simultaneous clients */ unsigned int maxclients; /* Max number of simultaneous clients */
unsigned long long maxmemory; /* Max number of memory bytes to use */ unsigned long long maxmemory; /* Max number of memory bytes to use */
int maxmemory_policy; /* Policy for key evition */ int maxmemory_policy; /* Policy for key eviction */
int maxmemory_samples; /* Pricision of random sampling */ int maxmemory_samples; /* Pricision of random sampling */
/* Blocked clients */ /* Blocked clients */
unsigned int bpop_blocked_clients; /* Number of clients blocked by lists */ unsigned int bpop_blocked_clients; /* Number of clients blocked by lists */
...@@ -793,7 +793,7 @@ struct redisServer { ...@@ -793,7 +793,7 @@ struct redisServer {
int lua_timedout; /* True if we reached the time limit for script int lua_timedout; /* True if we reached the time limit for script
execution. */ execution. */
int lua_kill; /* Kill the script if true. */ int lua_kill; /* Kill the script if true. */
/* Assert & bug reportign */ /* Assert & bug reporting */
char *assert_failed; char *assert_failed;
char *assert_file; char *assert_file;
int assert_line; int assert_line;
...@@ -812,14 +812,14 @@ struct redisCommand { ...@@ -812,14 +812,14 @@ struct redisCommand {
char *name; char *name;
redisCommandProc *proc; redisCommandProc *proc;
int arity; int arity;
char *sflags; /* Flags as string represenation, one char per flag. */ char *sflags; /* Flags as string representation, one char per flag. */
int flags; /* The actual flags, obtained from the 'sflags' field. */ int flags; /* The actual flags, obtained from the 'sflags' field. */
/* Use a function to determine keys arguments in a command line. /* Use a function to determine keys arguments in a command line.
* Used for Redis Cluster redirect. */ * Used for Redis Cluster redirect. */
redisGetKeysProc *getkeys_proc; redisGetKeysProc *getkeys_proc;
/* What keys should be loaded in background when calling this command? */ /* What keys should be loaded in background when calling this command? */
int firstkey; /* The first argument that's a key (0 = no keys) */ int firstkey; /* The first argument that's a key (0 = no keys) */
int lastkey; /* THe last argument that's a key */ int lastkey; /* The last argument that's a key */
int keystep; /* The step between first and last key */ int keystep; /* The step between first and last key */
long long microseconds, calls; long long microseconds, calls;
}; };
...@@ -866,7 +866,7 @@ typedef struct { ...@@ -866,7 +866,7 @@ typedef struct {
dictIterator *di; dictIterator *di;
} setTypeIterator; } setTypeIterator;
/* Structure to hold hash iteration abstration. Note that iteration over /* Structure to hold hash iteration abstraction. Note that iteration over
* hashes involves both fields and values. Because it is possible that * hashes involves both fields and values. Because it is possible that
* not both are required, store pointers in the iterator to avoid * not both are required, store pointers in the iterator to avoid
* unnecessary memory allocation for fields/values. */ * unnecessary memory allocation for fields/values. */
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* Every time the Redis Git SHA1 or Dirty status changes only this file /* Every time the Redis Git SHA1 or Dirty status changes only this small
* small file is recompiled, as we access this information in all the other * file is recompiled, as we access this information in all the other
* files using this functions. */ * files using this functions. */
#include <string.h> #include <string.h>
......
...@@ -52,7 +52,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) { ...@@ -52,7 +52,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) continue; if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START) continue;
/* Feed slaves that are waiting for the initial SYNC (so these commands /* Feed slaves that are waiting for the initial SYNC (so these commands
* are queued in the output buffer until the intial SYNC completes), * are queued in the output buffer until the initial SYNC completes),
* or are already in sync with the master. */ * or are already in sync with the master. */
if (slave->slaveseldb != dictid) { if (slave->slaveseldb != dictid) {
robj *selectcmd; robj *selectcmd;
...@@ -115,7 +115,7 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj ** ...@@ -115,7 +115,7 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **
} }
void syncCommand(redisClient *c) { void syncCommand(redisClient *c) {
/* ignore SYNC if aleady slave or in monitor mode */ /* ignore SYNC if already slave or in monitor mode */
if (c->flags & REDIS_SLAVE) return; if (c->flags & REDIS_SLAVE) return;
/* Refuse SYNC requests if we are a slave but the link with our master /* Refuse SYNC requests if we are a slave but the link with our master
...@@ -229,7 +229,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -229,7 +229,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
if (slave->repldboff == 0) { if (slave->repldboff == 0) {
/* Write the bulk write count before to transfer the DB. In theory here /* Write the bulk write count before to transfer the DB. In theory here
* we don't know how much room there is in the output buffer of the * we don't know how much room there is in the output buffer of the
* socket, but in pratice SO_SNDLOWAT (the minimum count for output * socket, but in practice SO_SNDLOWAT (the minimum count for output
* operations) will never be smaller than the few bytes we need. */ * operations) will never be smaller than the few bytes we need. */
sds bulkcount; sds bulkcount;
...@@ -272,7 +272,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -272,7 +272,7 @@ void sendBulkToSlave(aeEventLoop *el, int fd, void *privdata, int mask) {
} }
} }
/* This function is called at the end of every backgrond saving. /* This function is called at the end of every background saving.
* The argument bgsaveerr is REDIS_OK if the background saving succeeded * The argument bgsaveerr is REDIS_OK if the background saving succeeded
* otherwise REDIS_ERR is passed to the function. * otherwise REDIS_ERR is passed to the function.
* *
...@@ -451,7 +451,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -451,7 +451,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
stopAppendOnly(); stopAppendOnly();
while (retry-- && startAppendOnly() == REDIS_ERR) { while (retry-- && startAppendOnly() == REDIS_ERR) {
redisLog(REDIS_WARNING,"Failed enabling the AOF after successful master synchrnization! Trying it again in one second."); redisLog(REDIS_WARNING,"Failed enabling the AOF after successful master synchronization! Trying it again in one second.");
sleep(1); sleep(1);
} }
if (!retry) { if (!retry) {
......
...@@ -48,7 +48,7 @@ void sha1hex(char *digest, char *script, size_t len); ...@@ -48,7 +48,7 @@ void sha1hex(char *digest, char *script, size_t len);
/* Take a Redis reply in the Redis protocol format and convert it into a /* Take a Redis reply in the Redis protocol format and convert it into a
* Lua type. Thanks to this function, and the introduction of not connected * Lua type. Thanks to this function, and the introduction of not connected
* clients, it is trvial to implement the redis() lua function. * clients, it is trivial to implement the redis() lua function.
* *
* Basically we take the arguments, execute the Redis command in the context * Basically we take the arguments, execute the Redis command in the context
* of a non connected client, then take the generated reply and convert it * of a non connected client, then take the generated reply and convert it
...@@ -58,7 +58,7 @@ void sha1hex(char *digest, char *script, size_t len); ...@@ -58,7 +58,7 @@ void sha1hex(char *digest, char *script, size_t len);
* *
* Note: in this function we do not do any sanity check as the reply is * Note: in this function we do not do any sanity check as the reply is
* generated by Redis directly. This allows us to go faster. * generated by Redis directly. This allows us to go faster.
* The reply string can be altered during the parsing as it is discared * The reply string can be altered during the parsing as it is discarded
* after the conversion is completed. * after the conversion is completed.
* *
* Errors are returned as a table with a single 'err' field set to the * Errors are returned as a table with a single 'err' field set to the
...@@ -597,7 +597,7 @@ void scriptingInit(void) { ...@@ -597,7 +597,7 @@ void scriptingInit(void) {
lua_setglobal(lua,"math"); lua_setglobal(lua,"math");
/* Add a helper funciton that we use to sort the multi bulk output of non /* Add a helper function that we use to sort the multi bulk output of non
* deterministic commands, when containing 'false' elements. */ * deterministic commands, when containing 'false' elements. */
{ {
char *compare_func = "function __redis__compare_helper(a,b)\n" char *compare_func = "function __redis__compare_helper(a,b)\n"
...@@ -638,7 +638,7 @@ void scriptingReset(void) { ...@@ -638,7 +638,7 @@ void scriptingReset(void) {
scriptingInit(); scriptingInit();
} }
/* Perform the SHA1 of the input string. We use this both for hasing script /* Perform the SHA1 of the input string. We use this both for hashing script
* bodies in order to obtain the Lua function name, and in the implementation * bodies in order to obtain the Lua function name, and in the implementation
* of redis.sha1(). * of redis.sha1().
* *
...@@ -677,7 +677,7 @@ void luaReplyToRedisReply(redisClient *c, lua_State *lua) { ...@@ -677,7 +677,7 @@ void luaReplyToRedisReply(redisClient *c, lua_State *lua) {
case LUA_TTABLE: case LUA_TTABLE:
/* We need to check if it is an array, an error, or a status reply. /* We need to check if it is an array, an error, or a status reply.
* Error are returned as a single element table with 'err' field. * Error are returned as a single element table with 'err' field.
* Status replies are returned as single elment table with 'ok' field */ * Status replies are returned as single element table with 'ok' field */
lua_pushstring(lua,"err"); lua_pushstring(lua,"err");
lua_gettable(lua,-2); lua_gettable(lua,-2);
t = lua_type(lua,-1); t = lua_type(lua,-1);
...@@ -834,7 +834,7 @@ void evalGenericCommand(redisClient *c, int evalsha) { ...@@ -834,7 +834,7 @@ void evalGenericCommand(redisClient *c, int evalsha) {
if (lua_isnil(lua,1)) { if (lua_isnil(lua,1)) {
lua_pop(lua,1); /* remove the nil from the stack */ lua_pop(lua,1); /* remove the nil from the stack */
/* Function not defined... let's define it if we have the /* Function not defined... let's define it if we have the
* body of the funciton. If this is an EVALSHA call we can just * body of the function. If this is an EVALSHA call we can just
* return an error. */ * return an error. */
if (evalsha) { if (evalsha) {
addReply(c, shared.noscripterr); addReply(c, shared.noscripterr);
......
...@@ -141,7 +141,7 @@ size_t sdsAllocSize(sds s) { ...@@ -141,7 +141,7 @@ size_t sdsAllocSize(sds s) {
* right-trim the string. * right-trim the string.
* *
* Using sdsIncrLen() and sdsMakeRoomFor() it is possible to mount the * Using sdsIncrLen() and sdsMakeRoomFor() it is possible to mount the
* following schema to cat bytes coming from the kerenl to the end of an * following schema to cat bytes coming from the kernel to the end of an
* sds string new things without copying into an intermediate buffer: * sds string new things without copying into an intermediate buffer:
* *
* oldlen = sdslen(s); * oldlen = sdslen(s);
...@@ -596,7 +596,7 @@ void sdssplitargs_free(sds *argv, int argc) { ...@@ -596,7 +596,7 @@ void sdssplitargs_free(sds *argv, int argc) {
} }
/* Modify the string substituting all the occurrences of the set of /* Modify the string substituting all the occurrences of the set of
* characters specifed in the 'from' string to the corresponding character * characters specified in the 'from' string to the corresponding character
* in the 'to' array. * in the 'to' array.
* *
* For instance: sdsmapchars(mystring, "ho", "01", 2) * For instance: sdsmapchars(mystring, "ho", "01", 2)
......
...@@ -969,9 +969,9 @@ const char *sentinelRedisInstanceTypeStr(sentinelRedisInstance *ri) { ...@@ -969,9 +969,9 @@ const char *sentinelRedisInstanceTypeStr(sentinelRedisInstance *ri) {
* a master's Sentinels dictionary, we want to be very sure about not * a master's Sentinels dictionary, we want to be very sure about not
* having duplicated instances for any reason. This is so important because * having duplicated instances for any reason. This is so important because
* we use those other sentinels in order to run our quorum protocol to * we use those other sentinels in order to run our quorum protocol to
* understand if it's time to proceeed with the fail over. * understand if it's time to proceed with the fail over.
* *
* Making sure no duplication is possible we greately improve the robustness * Making sure no duplication is possible we greatly improve the robustness
* of the quorum (otherwise we may end counting the same instance multiple * of the quorum (otherwise we may end counting the same instance multiple
* times for some reason). * times for some reason).
* *
...@@ -1238,7 +1238,7 @@ void sentinelKillLink(sentinelRedisInstance *ri, redisAsyncContext *c) { ...@@ -1238,7 +1238,7 @@ void sentinelKillLink(sentinelRedisInstance *ri, redisAsyncContext *c) {
* cleanup needed. * cleanup needed.
* *
* Note: we don't free the hiredis context as hiredis will do it for us * Note: we don't free the hiredis context as hiredis will do it for us
* for async conenctions. */ * for async connections. */
void sentinelDisconnectInstanceFromContext(const redisAsyncContext *c) { void sentinelDisconnectInstanceFromContext(const redisAsyncContext *c) {
sentinelRedisInstance *ri = c->data; sentinelRedisInstance *ri = c->data;
int pubsub; int pubsub;
...@@ -1647,7 +1647,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd ...@@ -1647,7 +1647,7 @@ void sentinelReceiveHelloMessages(redisAsyncContext *c, void *reply, void *privd
/* Update the last activity in the pubsub channel. Note that since we /* Update the last activity in the pubsub channel. Note that since we
* receive our messages as well this timestamp can be used to detect * receive our messages as well this timestamp can be used to detect
* if the link is probably diconnected even if it seems otherwise. */ * if the link is probably disconnected even if it seems otherwise. */
ri->pc_last_activity = mstime(); ri->pc_last_activity = mstime();
/* Sanity check in the reply we expect, so that the code that follows /* Sanity check in the reply we expect, so that the code that follows
...@@ -1939,7 +1939,7 @@ void addReplySentinelRedisInstance(redisClient *c, sentinelRedisInstance *ri) { ...@@ -1939,7 +1939,7 @@ void addReplySentinelRedisInstance(redisClient *c, sentinelRedisInstance *ri) {
setDeferredMultiBulkLength(c,mbl,fields*2); setDeferredMultiBulkLength(c,mbl,fields*2);
} }
/* Output a number of instances contanined inside a dictionary as /* Output a number of instances contained inside a dictionary as
* Redis protocol. */ * Redis protocol. */
void addReplyDictOfRedisInstances(redisClient *c, dict *instances) { void addReplyDictOfRedisInstances(redisClient *c, dict *instances) {
dictIterator *di; dictIterator *di;
...@@ -2535,7 +2535,7 @@ void sentinelStartFailoverIfNeeded(sentinelRedisInstance *master) { ...@@ -2535,7 +2535,7 @@ void sentinelStartFailoverIfNeeded(sentinelRedisInstance *master) {
* 3) info_refresh more recent than SENTINEL_INFO_VALIDITY_TIME. * 3) info_refresh more recent than SENTINEL_INFO_VALIDITY_TIME.
* 4) master_link_down_time no more than: * 4) master_link_down_time no more than:
* (now - master->s_down_since_time) + (master->down_after_period * 10). * (now - master->s_down_since_time) + (master->down_after_period * 10).
* 5) Slave priority can't be zero, otherwise the slave is discareded. * 5) Slave priority can't be zero, otherwise the slave is discarded.
* *
* Among all the slaves matching the above conditions we select the slave * Among all the slaves matching the above conditions we select the slave
* with lower slave_priority. If priority is the same we select the slave * with lower slave_priority. If priority is the same we select the slave
...@@ -2611,10 +2611,10 @@ void sentinelFailoverWaitStart(sentinelRedisInstance *ri) { ...@@ -2611,10 +2611,10 @@ void sentinelFailoverWaitStart(sentinelRedisInstance *ri) {
/* If we in "wait start" but the master is no longer in ODOWN nor in /* If we in "wait start" but the master is no longer in ODOWN nor in
* SDOWN condition we abort the failover. This is important as it * SDOWN condition we abort the failover. This is important as it
* prevents a useless failover in a a notable case of netsplit, where * prevents a useless failover in a a notable case of netsplit, where
* the senitnels are split from the redis instances. In this case * the sentinels are split from the redis instances. In this case
* the failover will not start while there is the split because no * the failover will not start while there is the split because no
* good slave can be reached. However when the split is resolved, we * good slave can be reached. However when the split is resolved, we
* can go to waitstart if the slave is back rechable a few milliseconds * can go to waitstart if the slave is back reachable a few milliseconds
* before the master is. In that case when the master is back online * before the master is. In that case when the master is back online
* we cancel the failover. */ * we cancel the failover. */
if ((ri->flags & (SRI_S_DOWN|SRI_O_DOWN|SRI_FORCE_FAILOVER)) == 0) { if ((ri->flags & (SRI_S_DOWN|SRI_O_DOWN|SRI_FORCE_FAILOVER)) == 0) {
...@@ -3026,13 +3026,13 @@ void sentinelHandleDictOfRedisInstances(dict *instances) { ...@@ -3026,13 +3026,13 @@ void sentinelHandleDictOfRedisInstances(dict *instances) {
* following conditions happen: * following conditions happen:
* *
* 1) The Sentiel process for some time is blocked, for every kind of * 1) The Sentiel process for some time is blocked, for every kind of
* random reason: the load is huge, the computer was freezed for some time * random reason: the load is huge, the computer was frozen for some time
* in I/O or alike, the process was stopped by a signal. Everything. * in I/O or alike, the process was stopped by a signal. Everything.
* 2) The system clock was altered significantly. * 2) The system clock was altered significantly.
* *
* Under both this conditions we'll see everything as timed out and failing * Under both this conditions we'll see everything as timed out and failing
* without good reasons. Instead we enter the TILT mode and wait * without good reasons. Instead we enter the TILT mode and wait
* for SENTIENL_TILT_PERIOD to elapse before starting to act again. * for SENTINEL_TILT_PERIOD to elapse before starting to act again.
* *
* During TILT time we still collect information, we just do not act. */ * During TILT time we still collect information, we just do not act. */
void sentinelCheckTiltCondition(void) { void sentinelCheckTiltCondition(void) {
......
...@@ -57,13 +57,13 @@ A million repetitions of "a" ...@@ -57,13 +57,13 @@ A million repetitions of "a"
void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]) void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64])
{ {
u_int32_t a, b, c, d, e; u_int32_t a, b, c, d, e;
typedef union { typedef union {
unsigned char c[64]; unsigned char c[64];
u_int32_t l[16]; u_int32_t l[16];
} CHAR64LONG16; } CHAR64LONG16;
#ifdef SHA1HANDSOFF #ifdef SHA1HANDSOFF
CHAR64LONG16 block[1]; /* use array to appear as a pointer */ CHAR64LONG16 block[1]; /* use array to appear as a pointer */
memcpy(block, buffer, 64); memcpy(block, buffer, 64);
#else #else
/* The following had better never be used because it causes the /* The following had better never be used because it causes the
...@@ -71,7 +71,7 @@ CHAR64LONG16 block[1]; /* use array to appear as a pointer */ ...@@ -71,7 +71,7 @@ CHAR64LONG16 block[1]; /* use array to appear as a pointer */
* And the result is written through. I threw a "const" in, hoping * And the result is written through. I threw a "const" in, hoping
* this will cause a diagnostic. * this will cause a diagnostic.
*/ */
CHAR64LONG16* block = (const CHAR64LONG16*)buffer; CHAR64LONG16* block = (const CHAR64LONG16*)buffer;
#endif #endif
/* Copy context->state[] to working vars */ /* Copy context->state[] to working vars */
a = state[0]; a = state[0];
...@@ -132,8 +132,7 @@ void SHA1Init(SHA1_CTX* context) ...@@ -132,8 +132,7 @@ void SHA1Init(SHA1_CTX* context)
void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len) void SHA1Update(SHA1_CTX* context, const unsigned char* data, u_int32_t len)
{ {
u_int32_t i; u_int32_t i, j;
u_int32_t j;
j = context->count[0]; j = context->count[0];
if ((context->count[0] += len << 3) < j) if ((context->count[0] += len << 3) < j)
...@@ -157,9 +156,9 @@ u_int32_t j; ...@@ -157,9 +156,9 @@ u_int32_t j;
void SHA1Final(unsigned char digest[20], SHA1_CTX* context) void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{ {
unsigned i; unsigned i;
unsigned char finalcount[8]; unsigned char finalcount[8];
unsigned char c; unsigned char c;
#if 0 /* untested "improvement" by DHR */ #if 0 /* untested "improvement" by DHR */
/* Convert context->count to a sequence of bytes /* Convert context->count to a sequence of bytes
...@@ -175,7 +174,7 @@ unsigned char c; ...@@ -175,7 +174,7 @@ unsigned char c;
int j; int j;
for (j = 0; j < 4; t >>= 8, j++) for (j = 0; j < 4; t >>= 8, j++)
*--fcp = (unsigned char) t *--fcp = (unsigned char) t;
} }
#else #else
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -226,3 +225,4 @@ main(int argc, char **argv) ...@@ -226,3 +225,4 @@ main(int argc, char **argv)
} }
#endif #endif
...@@ -45,7 +45,7 @@ redisSortOperation *createSortOperation(int type, robj *pattern) { ...@@ -45,7 +45,7 @@ redisSortOperation *createSortOperation(int type, robj *pattern) {
/* Return the value associated to the key with a name obtained using /* Return the value associated to the key with a name obtained using
* the following rules: * the following rules:
* *
* 1) The first occurence of '*' in 'pattern' is substituted with 'subst'. * 1) The first occurrence of '*' in 'pattern' is substituted with 'subst'.
* *
* 2) If 'pattern' matches the "->" string, everything on the left of * 2) If 'pattern' matches the "->" string, everything on the left of
* the arrow is treated as the name of an hash field, and the part on the * the arrow is treated as the name of an hash field, and the part on the
...@@ -147,7 +147,7 @@ int sortCompare(const void *s1, const void *s2) { ...@@ -147,7 +147,7 @@ int sortCompare(const void *s1, const void *s2) {
cmp = -1; cmp = -1;
} else { } else {
/* Objects have the same score, but we don't want the comparison /* Objects have the same score, but we don't want the comparison
* to be undefined, so we compare objects lexicographycally. * to be undefined, so we compare objects lexicographically.
* This way the result of SORT is deterministic. */ * This way the result of SORT is deterministic. */
cmp = compareStringObjects(so1->obj,so2->obj); cmp = compareStringObjects(so1->obj,so2->obj);
} }
...@@ -205,7 +205,7 @@ void sortCommand(redisClient *c) { ...@@ -205,7 +205,7 @@ void sortCommand(redisClient *c) {
/* Now we need to protect sortval incrementing its count, in the future /* Now we need to protect sortval incrementing its count, in the future
* SORT may have options able to overwrite/delete keys during the sorting * SORT may have options able to overwrite/delete keys during the sorting
* and the sorted key itself may get destroied */ * and the sorted key itself may get destroyed */
if (sortval) if (sortval)
incrRefCount(sortval); incrRefCount(sortval);
else else
......
...@@ -45,10 +45,10 @@ void listTypeTryConversion(robj *subject, robj *value) { ...@@ -45,10 +45,10 @@ void listTypeTryConversion(robj *subject, robj *value) {
listTypeConvert(subject,REDIS_ENCODING_LINKEDLIST); listTypeConvert(subject,REDIS_ENCODING_LINKEDLIST);
} }
/* The function pushes an elmenet to the specified list object 'subject', /* The function pushes an element to the specified list object 'subject',
* at head or tail position as specified by 'where'. * at head or tail position as specified by 'where'.
* *
* There is no need for the caller to incremnet the refcount of 'value' as * There is no need for the caller to increment the refcount of 'value' as
* the function takes care of it if needed. */ * the function takes care of it if needed. */
void listTypePush(robj *subject, robj *value, int where) { void listTypePush(robj *subject, robj *value, int where) {
/* Check if we need to convert the ziplist */ /* Check if we need to convert the ziplist */
...@@ -825,7 +825,7 @@ void unblockClientWaitingData(redisClient *c) { ...@@ -825,7 +825,7 @@ void unblockClientWaitingData(redisClient *c) {
/* If the specified key has clients blocked waiting for list pushes, this /* If the specified key has clients blocked waiting for list pushes, this
* function will put the key reference into the server.ready_keys list. * function will put the key reference into the server.ready_keys list.
* Note that db->ready_keys is an hash table that allows us to avoid putting * Note that db->ready_keys is an hash table that allows us to avoid putting
* the same key agains and again in the list in case of multiple pushes * the same key again and again in the list in case of multiple pushes
* made by a script or in the context of MULTI/EXEC. * made by a script or in the context of MULTI/EXEC.
* *
* The list will be finally processed by handleClientsBlockedOnLists() */ * The list will be finally processed by handleClientsBlockedOnLists() */
...@@ -858,7 +858,7 @@ void signalListAsReady(redisClient *c, robj *key) { ...@@ -858,7 +858,7 @@ void signalListAsReady(redisClient *c, robj *key) {
* *
* 1) Provide the client with the 'value' element. * 1) Provide the client with the 'value' element.
* 2) If the dstkey is not NULL (we are serving a BRPOPLPUSH) also push the * 2) If the dstkey is not NULL (we are serving a BRPOPLPUSH) also push the
* 'value' element on the destionation list (the LPUSH side of the command). * 'value' element on the destination list (the LPUSH side of the command).
* 3) Propagate the resulting BRPOP, BLPOP and additional LPUSH if any into * 3) Propagate the resulting BRPOP, BLPOP and additional LPUSH if any into
* the AOF and replication channel. * the AOF and replication channel.
* *
...@@ -868,7 +868,7 @@ void signalListAsReady(redisClient *c, robj *key) { ...@@ -868,7 +868,7 @@ void signalListAsReady(redisClient *c, robj *key) {
* *
* The function returns REDIS_OK if we are able to serve the client, otherwise * The function returns REDIS_OK if we are able to serve the client, otherwise
* REDIS_ERR is returned to signal the caller that the list POP operation * REDIS_ERR is returned to signal the caller that the list POP operation
* should be undoed as the client was not served: This only happens for * should be undone as the client was not served: This only happens for
* BRPOPLPUSH that fails to push the value to the destination key as it is * BRPOPLPUSH that fails to push the value to the destination key as it is
* of the wrong type. */ * of the wrong type. */
int serveClientBlockedOnList(redisClient *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where) int serveClientBlockedOnList(redisClient *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where)
......
...@@ -188,7 +188,7 @@ robj *setTypeNextObject(setTypeIterator *si) { ...@@ -188,7 +188,7 @@ robj *setTypeNextObject(setTypeIterator *si) {
* The caller provides both pointers to be populated with the right * The caller provides both pointers to be populated with the right
* object. The return value of the function is the object->encoding * object. The return value of the function is the object->encoding
* field of the object and is used by the caller to check if the * field of the object and is used by the caller to check if the
* int64_t pointer or the redis object pointere was populated. * int64_t pointer or the redis object pointer was populated.
* *
* When an object is returned (the set was a real set) the ref count * When an object is returned (the set was a real set) the ref count
* of the object is not incremented so this function can be considered * of the object is not incremented so this function can be considered
...@@ -606,7 +606,7 @@ void sinterGenericCommand(redisClient *c, robj **setkeys, unsigned long setnum, ...@@ -606,7 +606,7 @@ void sinterGenericCommand(redisClient *c, robj **setkeys, unsigned long setnum,
sets[j] = setobj; sets[j] = setobj;
} }
/* Sort sets from the smallest to largest, this will improve our /* Sort sets from the smallest to largest, this will improve our
* algorithm's performace */ * algorithm's performance */
qsort(sets,setnum,sizeof(robj*),qsortCompareSetsByCardinality); qsort(sets,setnum,sizeof(robj*),qsortCompareSetsByCardinality);
/* The first thing we should output is the total number of elements... /* The first thing we should output is the total number of elements...
......
...@@ -43,7 +43,7 @@ static int checkStringLength(redisClient *c, long long size) { ...@@ -43,7 +43,7 @@ static int checkStringLength(redisClient *c, long long size) {
} }
void setGenericCommand(redisClient *c, int nx, robj *key, robj *val, robj *expire, int unit) { void setGenericCommand(redisClient *c, int nx, robj *key, robj *val, robj *expire, int unit) {
long long milliseconds = 0; /* initialized to avoid an harmness warning */ long long milliseconds = 0; /* initialized to avoid any harmness warning */
if (expire) { if (expire) {
if (getLongLongFromObjectOrReply(c, expire, &milliseconds, NULL) != REDIS_OK) if (getLongLongFromObjectOrReply(c, expire, &milliseconds, NULL) != REDIS_OK)
...@@ -340,7 +340,7 @@ void incrbyfloatCommand(redisClient *c) { ...@@ -340,7 +340,7 @@ void incrbyfloatCommand(redisClient *c) {
addReplyBulk(c,new); addReplyBulk(c,new);
/* Always replicate INCRBYFLOAT as a SET command with the final value /* Always replicate INCRBYFLOAT as a SET command with the final value
* in order to make sure that differences in float pricision or formatting * in order to make sure that differences in float prrcision or formatting
* will not create differences in replicas or after an AOF restart. */ * will not create differences in replicas or after an AOF restart. */
aux = createStringObject("SET",3); aux = createStringObject("SET",3);
rewriteClientCommandArgument(c,0,aux); rewriteClientCommandArgument(c,0,aux);
......
...@@ -125,7 +125,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) { ...@@ -125,7 +125,7 @@ zskiplistNode *zslInsert(zskiplist *zsl, double score, robj *obj) {
} }
/* we assume the key is not already inside, since we allow duplicated /* we assume the key is not already inside, since we allow duplicated
* scores, and the re-insertion of score and redis object should never * scores, and the re-insertion of score and redis object should never
* happpen since the caller of zslInsert() should test in the hash table * happen since the caller of zslInsert() should test in the hash table
* if the element is already inside or not. */ * if the element is already inside or not. */
level = zslRandomLevel(); level = zslRandomLevel();
if (level > zsl->level) { if (level > zsl->level) {
...@@ -285,7 +285,7 @@ zskiplistNode *zslLastInRange(zskiplist *zsl, zrangespec range) { ...@@ -285,7 +285,7 @@ zskiplistNode *zslLastInRange(zskiplist *zsl, zrangespec range) {
} }
/* Delete all the elements with score between min and max from the skiplist. /* Delete all the elements with score between min and max from the skiplist.
* Min and mx are inclusive, so a score >= min || score <= max is deleted. * Min and max are inclusive, so a score >= min || score <= max is deleted.
* Note that this function takes the reference to the hash table view of the * Note that this function takes the reference to the hash table view of the
* sorted set, in order to remove the elements from the hash table too. */ * sorted set, in order to remove the elements from the hash table too. */
unsigned long zslDeleteRangeByScore(zskiplist *zsl, zrangespec range, dict *dict) { unsigned long zslDeleteRangeByScore(zskiplist *zsl, zrangespec range, dict *dict) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment