Unverified Commit 0bfccc55 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fixed some typos, add a spell check ci and others minor fix (#8890)

This PR adds a spell checker CI action that will fail future PRs if they introduce typos and spelling mistakes.
This spell checker is based on blacklist of common spelling mistakes, so it will not catch everything,
but at least it is also unlikely to cause false positives.

Besides that, the PR also fixes many spelling mistakes and types, not all are a result of the spell checker we use.

Here's a summary of other changes:
1. Scanned the entire source code and fixes all sorts of typos and spelling mistakes (including missing or extra spaces).
2. Outdated function / variable / argument names in comments
3. Fix outdated keyspace masks error log when we check `config.notify-keyspace-events` in loadServerConfigFromString.
4. Trim the white space at the end of line in `module.c`. Check: https://github.com/redis/redis/pull/7751
5. Some outdated https link URLs.
6. Fix some outdated comment. Such as:
    - In README: about the rdb, we used to said create a `thread`, change to `process`
    - dbRandomKey function coment (about the dictGetRandomKey, change to dictGetFairRandomKey)
    - notifyKeyspaceEvent fucntion comment (add type arg)
    - Some others minor fix in comment (Most of them are incorrectly quoted by variable names)
7. Modified the error log so that users can easily distinguish between TCP and TLS in `changeBindAddr`
parent 8a86bca5
......@@ -310,7 +310,7 @@ static size_t rioFdWrite(rio *r, const void *buf, size_t len) {
if (!doflush)
return 1;
}
/* Flusing the buffered data. set 'p' and 'len' accordintly. */
/* Flushing the buffered data. set 'p' and 'len' accordingly. */
p = (unsigned char*) r->io.fd.buf;
len = sdslen(r->io.fd.buf);
}
......
......@@ -1667,7 +1667,7 @@ void evalGenericCommand(client *c, int evalsha) {
* To do so we use a cache of SHA1s of scripts that we already propagated
* as full EVAL, that's called the Replication Script Cache.
*
* For replication, everytime a new slave attaches to the master, we need to
* For replication, every time a new slave attaches to the master, we need to
* flush our cache of scripts that can be replicated as EVALSHA, while
* for AOF we need to do so every time we rewrite the AOF file. */
if (evalsha && !server.lua_replicate_commands) {
......@@ -2275,7 +2275,7 @@ sds ldbCatStackValue(sds s, lua_State *lua, int idx) {
}
/* Produce a debugger log entry representing the value of the Lua object
* currently on the top of the stack. The element is ot popped nor modified.
* currently on the top of the stack. The element is not popped nor modified.
* Check ldbCatStackValue() for the actual implementation. */
void ldbLogStackValue(lua_State *lua, char *prefix) {
sds s = sdsnew(prefix);
......
......@@ -92,7 +92,7 @@ static inline size_t sdsTypeMaxSize(char type) {
* If NULL is used for 'init' the string is initialized with zero bytes.
* If SDS_NOINIT is used, the buffer is left uninitialized;
*
* The string is always null-termined (all the sds strings are, always) so
* The string is always null-terminated (all the sds strings are, always) so
* even if you create an sds string with:
*
* mystring = sdsnewlen("abc",3);
......@@ -469,7 +469,7 @@ sds sdscpylen(sds s, const char *t, size_t len) {
return s;
}
/* Like sdscpylen() but 't' must be a null-termined string so that the length
/* Like sdscpylen() but 't' must be a null-terminated string so that the length
* of the string is obtained with strlen(). */
sds sdscpy(sds s, const char *t) {
return sdscpylen(s, t, strlen(t));
......@@ -731,7 +731,7 @@ sds sdscatfmt(sds s, char const *fmt, ...) {
}
/* Remove the part of the string from left and from right composed just of
* contiguous characters found in 'cset', that is a null terminted C string.
* contiguous characters found in 'cset', that is a null terminated C string.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call.
......@@ -1179,7 +1179,7 @@ sds sdstemplate(const char *template, sdstemplate_callback_t cb_func, void *cb_a
res = sdscat(res, p);
break;
} else if (sv > p) {
/* Found: copy anything up to the begining of the variable */
/* Found: copy anything up to the beginning of the variable */
res = sdscatlen(res, p, sv - p);
}
......
......@@ -1422,7 +1422,7 @@ sentinelRedisInstance *sentinelRedisInstanceLookupSlave(
/* We need to handle a slave_addr that is potentially a hostname.
* If that is the case, depending on configuration we either resolve
* it and use the IP addres or fail.
* it and use the IP address or fail.
*/
addr = createSentinelAddr(slave_addr, port);
if (!addr) return NULL;
......@@ -3550,7 +3550,7 @@ void sentinelCommand(client *c) {
"SENTINELS <master-name>",
" Show a list of Sentinel instances for this master and their state.",
"SET <master-name> <option> <value>",
" Set configuration paramters for certain masters.",
" Set configuration parameters for certain masters.",
"SIMULATE-FAILURE (CRASH-AFTER-ELECTION|CRASH-AFTER-PROMOTION|HELP)",
" Simulate a Sentinel crash.",
NULL
......@@ -3990,7 +3990,7 @@ void sentinelSetCommand(client *c) {
int old_j = j; /* Used to know what to log as an event. */
if (!strcasecmp(option,"down-after-milliseconds") && moreargs > 0) {
/* down-after-millisecodns <milliseconds> */
/* down-after-milliseconds <milliseconds> */
robj *o = c->argv[++j];
if (getLongLongFromObject(o,&ll) == C_ERR || ll <= 0) {
badarg = j;
......
......@@ -1759,7 +1759,7 @@ int clientsCronTrackExpansiveClients(client *c, int time_idx) {
/* Iterating all the clients in getMemoryOverheadData() is too slow and
* in turn would make the INFO command too slow. So we perform this
* computation incrementally and track the (not instantaneous but updated
* to the second) total memory used by clients using clinetsCron() in
* to the second) total memory used by clients using clientsCron() in
* a more incremental way (depending on server.hz). */
int clientsCronTrackClientsMemUsage(client *c) {
size_t mem = 0;
......@@ -2203,7 +2203,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
}
}
}
/* Just for the sake of defensive programming, to avoid forgeting to
/* Just for the sake of defensive programming, to avoid forgetting to
* call this function when need. */
updateDictResizePolicy();
......@@ -2482,7 +2482,7 @@ void afterSleep(struct aeEventLoop *eventLoop) {
/* Do NOT add anything above moduleAcquireGIL !!! */
/* Aquire the modules GIL so that their threads won't touch anything. */
/* Acquire the modules GIL so that their threads won't touch anything. */
if (!ProcessingEventsWhileBlocked) {
if (moduleCount()) moduleAcquireGIL();
}
......@@ -2637,7 +2637,7 @@ void createSharedObjects(void) {
shared.bulkhdr[j] = createObject(OBJ_STRING,
sdscatprintf(sdsempty(),"$%d\r\n",j));
}
/* The following two shared objects, minstring and maxstrings, are not
/* The following two shared objects, minstring and maxstring, are not
* actually used for their value but as a special object meaning
* respectively the minimum possible string and the maximum possible
* string in string comparisons for the ZRANGEBYLEX command. */
......@@ -2829,7 +2829,7 @@ int restartServer(int flags, mstime_t delay) {
return C_ERR;
}
/* Close all file descriptors, with the exception of stdin, stdout, strerr
/* Close all file descriptors, with the exception of stdin, stdout, stderr
* which are useful if we restart a Redis server which is not daemonized. */
for (j = 3; j < (int)server.maxclients + 1024; j++) {
/* Test the descriptor validity before closing it, otherwise
......@@ -3596,7 +3596,7 @@ void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
execCommandPropagateMulti(dbid);
/* This needs to be unreachable since the dataset should be fixed during
* client pause, otherwise data may be lossed during a failover. */
* client pause, otherwise data may be lost during a failover. */
serverAssert(!(areClientsPaused() && !server.client_pause_in_transaction));
if (server.aof_state != AOF_OFF && flags & PROPAGATE_AOF)
......@@ -3912,7 +3912,7 @@ void call(client *c, int flags) {
}
/* Used when a command that is ready for execution needs to be rejected, due to
* varios pre-execution checks. it returns the appropriate error to the client.
* various pre-execution checks. it returns the appropriate error to the client.
* If there's a transaction is flags it as dirty, and if the command is EXEC,
* it aborts the transaction.
* Note: 'reply' is expected to end with \r\n */
......@@ -4230,7 +4230,7 @@ int processCommand(client *c) {
* The main objective here is to prevent abuse of client pause check
* from which replicas are exempt. */
if ((c->flags & CLIENT_SLAVE) && (is_may_replicate_command || is_write_command || is_read_command)) {
rejectCommandFormat(c, "Replica can't interract with the keyspace");
rejectCommandFormat(c, "Replica can't interact with the keyspace");
return C_OK;
}
......@@ -4322,7 +4322,7 @@ int prepareForShutdown(int flags) {
/* Note that, in killRDBChild normally has backgroundSaveDoneHandler
* doing it's cleanup, but in this case this code will not be reached,
* so we need to call rdbRemoveTempFile which will close fd(in order
* to unlink file actully) in background thread.
* to unlink file actually) in background thread.
* The temp rdb file fd may won't be closed when redis exits quickly,
* but OS will close this fd when process exits. */
rdbRemoveTempFile(server.child_pid, 0);
......@@ -5691,12 +5691,12 @@ int changeBindAddr(sds *addrlist, int addrlist_len) {
/* Re-Listen TCP and TLS */
server.ipfd.count = 0;
if (server.port != 0 && listenToPort(server.port, &server.ipfd) != C_OK) {
serverPanic("Failed to restore old listening sockets.");
serverPanic("Failed to restore old listening TCP socket.");
}
server.tlsfd.count = 0;
if (server.tls_port != 0 && listenToPort(server.tls_port, &server.tlsfd) != C_OK) {
serverPanic("Failed to restore old listening sockets.");
serverPanic("Failed to restore old listening TLS socket.");
}
result = C_ERR;
......@@ -5959,7 +5959,7 @@ void loadDataFromDisk(void) {
memcpy(server.replid,rsi.repl_id,sizeof(server.replid));
server.master_repl_offset = rsi.repl_offset;
/* If we are a slave, create a cached master from this
* information, in order to allow partial resynchronizations
* information, in order to allow partial resynchronization
* with masters. */
replicationCacheMasterUsingMyself();
selectDb(server.cached_master,rsi.repl_stream_db);
......
......@@ -314,7 +314,7 @@ typedef enum {
REPL_STATE_CONNECTING, /* Connecting to master */
/* --- Handshake states, must be ordered --- */
REPL_STATE_RECEIVE_PING_REPLY, /* Wait for PING reply */
REPL_STATE_SEND_HANDSHAKE, /* Send handshake sequance to master */
REPL_STATE_SEND_HANDSHAKE, /* Send handshake sequence to master */
REPL_STATE_RECEIVE_AUTH_REPLY, /* Wait for AUTH reply */
REPL_STATE_RECEIVE_PORT_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_IP_REPLY, /* Wait for REPLCONF reply */
......@@ -963,7 +963,7 @@ typedef struct client {
/* In clientsCronTrackClientsMemUsage() we track the memory usage of
* each client and add it to the sum of all the clients of a given type,
* however we need to remember what was the old contribution of each
* client, and in which categoty the client was, in order to remove it
* client, and in which category the client was, in order to remove it
* before adding it the new value. */
uint64_t client_cron_last_memory_usage;
int client_cron_last_memory_type;
......@@ -1291,7 +1291,7 @@ struct redisServer {
long long stat_numconnections; /* Number of connections received */
long long stat_expiredkeys; /* Number of expired keys */
double stat_expired_stale_perc; /* Percentage of keys probably expired */
long long stat_expired_time_cap_reached_count; /* Early expire cylce stops.*/
long long stat_expired_time_cap_reached_count; /* Early expire cycle stops.*/
long long stat_expire_cycle_time_used; /* Cumulative microseconds used. */
long long stat_evictedkeys; /* Number of evicted keys (maxmemory) */
long long stat_keyspace_hits; /* Number of successful lookups of keys */
......@@ -1348,7 +1348,7 @@ struct redisServer {
int active_expire_effort; /* From 1 (default) to 10, active effort. */
int active_defrag_enabled;
int sanitize_dump_payload; /* Enables deep sanitization for ziplist and listpack in RDB and RESTORE. */
int skip_checksum_validation; /* Disables checksum validateion for RDB and RESTORE payload. */
int skip_checksum_validation; /* Disable checksum validation for RDB and RESTORE payload. */
int jemalloc_bg_thread; /* Enable jemalloc background thread */
size_t active_defrag_ignore_bytes; /* minimum amount of fragmentation waste to start active defrag */
int active_defrag_threshold_lower; /* minimum percentage of fragmentation to start active defrag */
......@@ -1433,10 +1433,10 @@ struct redisServer {
int rdb_pipe_bufflen; /* that was read from the the rdb pipe. */
int rdb_key_save_delay; /* Delay in microseconds between keys while
* writing the RDB. (for testings). negative
* value means fractions of microsecons (on average). */
* value means fractions of microseconds (on average). */
int key_load_delay; /* Delay in microseconds between keys while
* loading aof or rdb. (for testings). negative
* value means fractions of microsecons (on average). */
* value means fractions of microseconds (on average). */
/* Pipe and data structures for child -> parent info sharing. */
int child_info_pipe[2]; /* Pipe used to write the child_info_data. */
int child_info_nread; /* Num of bytes of the last read from pipe */
......@@ -1649,7 +1649,7 @@ struct redisServer {
struct sentinelConfig *sentinel_config; /* sentinel config to load at startup time. */
/* Coordinate failover info */
mstime_t failover_end_time; /* Deadline for failover command. */
int force_failover; /* If true then failover will be foreced at the
int force_failover; /* If true then failover will be forced at the
* deadline, otherwise failover is aborted. */
char *target_replica_host; /* Failover target host. If null during a
* failover then any replica can be used. */
......
......@@ -312,7 +312,7 @@ void sortCommand(client *c) {
if (sortval->type == OBJ_ZSET)
zsetConvert(sortval, OBJ_ENCODING_SKIPLIST);
/* Objtain the length of the object to sort. */
/* Obtain the length of the object to sort. */
switch(sortval->type) {
case OBJ_LIST: vectorlen = listTypeLength(sortval); break;
case OBJ_SET: vectorlen = setTypeSize(sortval); break;
......
......@@ -86,7 +86,7 @@ typedef struct streamNACK {
in the last delivery. */
} streamNACK;
/* Stream propagation informations, passed to functions in order to propagate
/* Stream propagation information, passed to functions in order to propagate
* XCLAIM commands to AOF and slaves. */
typedef struct streamPropInfo {
robj *keyname;
......
......@@ -626,7 +626,7 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
lp_count += 3; /* Add the 3 fixed fields flags + ms-diff + seq-diff. */
if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) {
/* If the item is not compressed, it also has the fields other than
* the values, and an additional num-fileds field. */
* the values, and an additional num-fields field. */
lp_count += numfields+1;
}
lp = lpAppendInteger(lp,lp_count);
......@@ -968,7 +968,7 @@ static int streamParseAddOrTrimArgsOrReply(client *c, streamAddTrimArgs *args, i
}
if (c == server.master || c->id == CLIENT_ID_AOF) {
/* If command cam from master or from AOF we must not enforce maxnodes
/* If command came from master or from AOF we must not enforce maxnodes
* (The maxlen/minid argument was re-written to make sure there's no
* inconsistency). */
args->limit = 0;
......@@ -1365,7 +1365,7 @@ void streamPropagateXCLAIM(client *c, robj *key, streamCG *group, robj *groupnam
argv[12] = shared.lastid;
argv[13] = createObjectFromStreamID(&group->last_id);
/* We use progagate() because this code path is not always called from
/* We use propagate() because this code path is not always called from
* the command execution context. Moreover this will just alter the
* consumer group state, and we don't need MULTI/EXEC wrapping because
* there is no message state cross-message atomicity required. */
......@@ -1390,7 +1390,7 @@ void streamPropagateGroupID(client *c, robj *key, streamCG *group, robj *groupna
argv[3] = groupname;
argv[4] = createObjectFromStreamID(&group->last_id);
/* We use progagate() because this code path is not always called from
/* We use propagate() because this code path is not always called from
* the command execution context. Moreover this will just alter the
* consumer group state, and we don't need MULTI/EXEC wrapping because
* there is no message state cross-message atomicity required. */
......@@ -1412,7 +1412,7 @@ void streamPropagateConsumerCreation(client *c, robj *key, robj *groupname, sds
argv[3] = groupname;
argv[4] = createObject(OBJ_STRING,sdsdup(consumername));
/* We use progagate() because this code path is not always called from
/* We use propagate() because this code path is not always called from
* the command execution context. Moreover this will just alter the
* consumer group state, and we don't need MULTI/EXEC wrapping because
* there is no message state cross-message atomicity required. */
......@@ -1576,7 +1576,7 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end
return arraylen;
}
/* This is an helper function for streamReplyWithRange() when called with
/* This is a helper function for streamReplyWithRange() when called with
* group and consumer arguments, but with a range that is referring to already
* delivered messages. In this case we just emit messages that are already
* in the history of the consumer, fetching the IDs from its PEL.
......@@ -1944,7 +1944,7 @@ void xreadCommand(client *c) {
if (c->flags & CLIENT_LUA) {
/*
* Although the CLIENT_DENY_BLOCKING flag should protect from blocking the client
* on Lua/MULTI/RM_Call we want special treatment for Lua to keep backword compatibility.
* on Lua/MULTI/RM_Call we want special treatment for Lua to keep backward compatibility.
* There is no sense to use BLOCK option within Lua. */
addReplyErrorFormat(c, "%s command is not allowed with BLOCK option from scripts", (char *)c->argv[0]->ptr);
return;
......@@ -2506,7 +2506,7 @@ void xsetidCommand(client *c) {
/* XACK <key> <group> <id> <id> ... <id>
*
* Acknowledge a message as processed. In practical terms we just check the
* pendine entries list (PEL) of the group, and delete the PEL entry both from
* pending entries list (PEL) of the group, and delete the PEL entry both from
* the group and the consumer (pending messages are referenced in both places).
*
* Return value of the command is the number of messages successfully
......@@ -2572,7 +2572,7 @@ cleanup:
* delivery time and so forth. */
void xpendingCommand(client *c) {
int justinfo = c->argc == 3; /* Without the range just outputs general
informations about the PEL. */
information about the PEL. */
robj *key = c->argv[1];
robj *groupname = c->argv[2];
robj *consumername = NULL;
......@@ -2928,7 +2928,7 @@ void xclaimCommand(client *c) {
streamNACK *nack = raxFind(group->pel,buf,sizeof(buf));
/* If FORCE is passed, let's check if at least the entry
* exists in the Stream. In such case, we'll crate a new
* exists in the Stream. In such case, we'll create a new
* entry in the PEL from scratch, so that XCLAIM can also
* be used to create entries in the PEL. Useful for AOF
* and replication of consumer groups. */
......@@ -3548,7 +3548,7 @@ NULL
}
/* Validate the integrity stream listpack entries structure. Both in term of a
* valid listpack, but also that the structure of the entires matches a valid
* valid listpack, but also that the structure of the entries matches a valid
* stream. return 1 if valid 0 if not valid. */
int streamValidateListpackIntegrity(unsigned char *lp, size_t size, int deep) {
int valid_record;
......
......@@ -594,7 +594,7 @@ int zslParseLexRangeItem(robj *item, sds *dest, int *ex) {
}
}
/* Free a lex range structure, must be called only after zelParseLexRange()
/* Free a lex range structure, must be called only after zslParseLexRange()
* populated the structure with success (C_OK returned). */
void zslFreeLexRange(zlexrangespec *spec) {
if (spec->min != shared.minstring &&
......@@ -806,7 +806,7 @@ void zzlNext(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
}
/* Move to the previous entry based on the values in eptr and sptr. Both are
* set to NULL when there is no next entry. */
* set to NULL when there is no prev entry. */
void zzlPrev(unsigned char *zl, unsigned char **eptr, unsigned char **sptr) {
unsigned char *_eptr, *_sptr;
serverAssert(*eptr != NULL && *sptr != NULL);
......@@ -1610,7 +1610,7 @@ robj *zsetDup(robj *o) {
return zobj;
}
/* callback for to check the ziplist doesn't have duplicate recoreds */
/* callback for to check the ziplist doesn't have duplicate records */
static int _zsetZiplistValidateIntegrity(unsigned char *p, void *userdata) {
struct {
long count;
......@@ -2481,7 +2481,7 @@ static void zdiffAlgorithm2(zsetopsrc *src, long setnum, zset *dstzset, size_t *
if (cardinality == 0) break;
}
/* Redize dict if needed after removing multiple elements */
/* Resize dict if needed after removing multiple elements */
if (htNeedsResize(dstzset->dict)) dictResize(dstzset->dict);
/* Using this algorithm, we can't calculate the max element as we go,
......@@ -3600,7 +3600,7 @@ void zrangeGenericCommand(zrange_result_handler *handler, int argc_start, int st
}
}
/* Use defaults if not overriden by arguments. */
/* Use defaults if not overridden by arguments. */
if (direction == ZRANGE_DIRECTION_AUTO)
direction = ZRANGE_DIRECTION_FORWARD;
if (rangetype == ZRANGE_AUTO)
......
......@@ -475,7 +475,7 @@ static void tlsEventHandler(struct aeEventLoop *el, int fd, void *clientData, in
/* Process the return code received from OpenSSL>
* Update the want parameter with expected I/O.
* Update the connection's error state if a real error has occured.
* Update the connection's error state if a real error has occurred.
* Returns an SSL error code, or 0 if no further handling is required.
*/
static int handleSSLReturnCode(tls_connection *conn, int ret_value, WantIOType *want) {
......
......@@ -249,7 +249,7 @@ void trackingRememberKeys(client *c) {
/* Given a key name, this function sends an invalidation message in the
* proper channel (depending on RESP version: PubSub or Push message) and
* to the proper client (in case fo redirection), in the context of the
* to the proper client (in case of redirection), in the context of the
* client 'c' with tracking enabled.
*
* In case the 'proto' argument is non zero, the function will assume that
......@@ -448,7 +448,7 @@ void trackingInvalidateKeysOnFlush(int async) {
*
* So Redis allows the user to configure a maximum number of keys for the
* invalidation table. This function makes sure that we don't go over the
* specified fill rate: if we are over, we can just evict informations about
* specified fill rate: if we are over, we can just evict information about
* a random key, and send invalidation messages to clients like if the key was
* modified. */
void trackingLimitUsedSlots(void) {
......@@ -493,7 +493,7 @@ void trackingLimitUsedSlots(void) {
* include keys that were modified the last time by this client, in order
* to implement the NOLOOP option.
*
* If the resultin array would be empty, NULL is returned instead. */
* If the resulting array would be empty, NULL is returned instead. */
sds trackingBuildBroadcastReply(client *c, rax *keys) {
raxIterator ri;
uint64_t count;
......
......@@ -38,7 +38,7 @@
* This should be the size of the buffer given to ld2string */
#define MAX_LONG_DOUBLE_CHARS 5*1024
/* long double to string convertion options */
/* long double to string conversion options */
typedef enum {
LD_STR_AUTO, /* %.17Lg */
LD_STR_HUMAN, /* %.17Lf + Trimming of trailing zeros */
......
......@@ -54,7 +54,7 @@
*
* The length of the previous entry, <prevlen>, is encoded in the following way:
* If this length is smaller than 254 bytes, it will only consume a single
* byte representing the length as an unsinged 8 bit integer. When the length
* byte representing the length as an unsigned 8 bit integer. When the length
* is greater than or equal to 254, it will consume 5 bytes. The first byte is
* set to 254 (FE) to indicate a larger value is following. The remaining 4
* bytes take the length of the previous entry as value.
......@@ -620,7 +620,7 @@ static inline int zipEntrySafe(unsigned char* zl, size_t zlbytes, unsigned char
unsigned char *zllast = zl + zlbytes - ZIPLIST_END_SIZE;
#define OUT_OF_RANGE(p) (unlikely((p) < zlfirst || (p) > zllast))
/* If threre's no possibility for the header to reach outside the ziplist,
/* If there's no possibility for the header to reach outside the ziplist,
* take the fast path. (max lensize and prevrawlensize are both 5 bytes) */
if (p >= zlfirst && p + 10 < zllast) {
ZIP_DECODE_PREVLEN(p, e->prevrawlensize, e->prevrawlen);
......@@ -631,16 +631,16 @@ static inline int zipEntrySafe(unsigned char* zl, size_t zlbytes, unsigned char
/* We didn't call ZIP_ASSERT_ENCODING, so we check lensize was set to 0. */
if (unlikely(e->lensize == 0))
return 0;
/* Make sure the entry doesn't rech outside the edge of the ziplist */
/* Make sure the entry doesn't reach outside the edge of the ziplist */
if (OUT_OF_RANGE(p + e->headersize + e->len))
return 0;
/* Make sure prevlen doesn't rech outside the edge of the ziplist */
/* Make sure prevlen doesn't reach outside the edge of the ziplist */
if (validate_prevlen && OUT_OF_RANGE(p - e->prevrawlen))
return 0;
return 1;
}
/* Make sure the pointer doesn't rech outside the edge of the ziplist */
/* Make sure the pointer doesn't reach outside the edge of the ziplist */
if (OUT_OF_RANGE(p))
return 0;
......@@ -664,11 +664,11 @@ static inline int zipEntrySafe(unsigned char* zl, size_t zlbytes, unsigned char
ZIP_DECODE_LENGTH(p + e->prevrawlensize, e->encoding, e->lensize, e->len);
e->headersize = e->prevrawlensize + e->lensize;
/* Make sure the entry doesn't rech outside the edge of the ziplist */
/* Make sure the entry doesn't reach outside the edge of the ziplist */
if (OUT_OF_RANGE(p + e->headersize + e->len))
return 0;
/* Make sure prevlen doesn't rech outside the edge of the ziplist */
/* Make sure prevlen doesn't reach outside the edge of the ziplist */
if (validate_prevlen && OUT_OF_RANGE(p - e->prevrawlen))
return 0;
......@@ -827,7 +827,7 @@ unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p) {
/* An entry's prevlen can only increment 4 bytes. */
zipStorePrevEntryLength(p, cur.prevrawlen+delta);
}
/* Foward to previous entry. */
/* Forward to previous entry. */
prevoffset -= cur.prevrawlen;
cnt--;
}
......
......@@ -399,7 +399,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) {
while(*p != ZIPMAP_END) {
/* read the field name length encoding type */
s = zipmapGetEncodedLengthSize(p);
/* make sure the entry length doesn't rech outside the edge of the zipmap */
/* make sure the entry length doesn't reach outside the edge of the zipmap */
if (OUT_OF_RANGE(p+s))
return 0;
......@@ -408,13 +408,13 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) {
p += s; /* skip the encoded field size */
p += l; /* skip the field */
/* make sure the entry doesn't rech outside the edge of the zipmap */
/* make sure the entry doesn't reach outside the edge of the zipmap */
if (OUT_OF_RANGE(p))
return 0;
/* read the value length encoding type */
s = zipmapGetEncodedLengthSize(p);
/* make sure the entry length doesn't rech outside the edge of the zipmap */
/* make sure the entry length doesn't reach outside the edge of the zipmap */
if (OUT_OF_RANGE(p+s))
return 0;
......@@ -425,7 +425,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) {
p += l+e; /* skip the value and free space */
count++;
/* make sure the entry doesn't rech outside the edge of the zipmap */
/* make sure the entry doesn't reach outside the edge of the zipmap */
if (OUT_OF_RANGE(p))
return 0;
}
......
# Failover stress test.
# In this test a different node is killed in a loop for N
# iterations. The test checks that certain properties
# are preseved across iterations.
# are preserved across iterations.
source "../tests/includes/init-tests.tcl"
......
# Test UPDATE messages sent by other nodes when the currently authorirative
# master is unavaialble. The test is performed in the following steps:
# master is unavailable. The test is performed in the following steps:
#
# 1) Master goes down.
# 2) Slave failover and becomes new master.
# 3) New master is partitoned away.
# 3) New master is partitioned away.
# 4) Old master returns.
# 5) At this point we expect the old master to turn into a slave ASAP because
# of the UPDATE messages it will receive from the other nodes when its
......
......@@ -53,7 +53,7 @@ test "Wait cluster to be stable" {
}
}
test "Master #0 stil should have its replicas" {
test "Master #0 still should have its replicas" {
assert { [llength [lindex [R 0 role] 2]] >= 2 }
}
......
......@@ -13,7 +13,7 @@ test "Cluster should start ok" {
set primary [Rn 0]
set replica [Rn 1]
test "Cant read from replica without READONLY" {
test "Can't read from replica without READONLY" {
$primary SET a 1
wait_for_ofs_sync $primary $replica
catch {$replica GET a} err
......@@ -25,7 +25,7 @@ test "Can read from replica after READONLY" {
assert {[$replica GET a] eq {1}}
}
test "Can preform HSET primary and HGET from replica" {
test "Can perform HSET primary and HGET from replica" {
$primary HSET h a 1
$primary HSET h b 2
$primary HSET h c 3
......
......@@ -13,12 +13,12 @@ test "Cluster should start ok" {
set primary1 [Rn 0]
set primary2 [Rn 1]
proc cmdstat {instace cmd} {
return [cmdrstat $cmd $instace]
proc cmdstat {instance cmd} {
return [cmdrstat $cmd $instance]
}
proc errorstat {instace cmd} {
return [errorrstat $cmd $instace]
proc errorstat {instance cmd} {
return [errorrstat $cmd $instance]
}
test "errorstats: rejected call due to MOVED Redirection" {
......
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