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
...@@ -216,7 +216,7 @@ GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash) { ...@@ -216,7 +216,7 @@ GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash) {
return bits; return bits;
} }
/* Calculate distance using haversin great circle distance formula. */ /* Calculate distance using haversine great circle distance formula. */
double geohashGetDistance(double lon1d, double lat1d, double lon2d, double lat2d) { double geohashGetDistance(double lon1d, double lat1d, double lon2d, double lat2d) {
double lat1r, lon1r, lat2r, lon2r, u, v; double lat1r, lon1r, lat2r, lon2r, u, v;
lat1r = deg_rad(lat1d); lat1r = deg_rad(lat1d);
......
...@@ -899,7 +899,7 @@ promote: /* Promote to dense representation. */ ...@@ -899,7 +899,7 @@ promote: /* Promote to dense representation. */
* the element belongs to is incremented if needed. * the element belongs to is incremented if needed.
* *
* This function is actually a wrapper for hllSparseSet(), it only performs * This function is actually a wrapper for hllSparseSet(), it only performs
* the hashshing of the element to obtain the index and zeros run length. */ * the hashing of the element to obtain the index and zeros run length. */
int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) { int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
long index; long index;
uint8_t count = hllPatLen(ele,elesize,&index); uint8_t count = hllPatLen(ele,elesize,&index);
......
...@@ -306,7 +306,7 @@ int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) { ...@@ -306,7 +306,7 @@ int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) {
return 0; return 0;
} }
/* check that the size matchies (all records are inside the buffer). */ /* check that the size matches (all records are inside the buffer). */
uint32_t count = intrev32ifbe(is->length); uint32_t count = intrev32ifbe(is->length);
if (sizeof(*is) + count*record_size != size) if (sizeof(*is) + count*record_size != size)
return 0; return 0;
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
(p)[5] = ((v)>>8)&0xff; \ (p)[5] = ((v)>>8)&0xff; \
} while(0) } while(0)
/* Validates that 'p' is not ouside the listpack. /* Validates that 'p' is not outside the listpack.
* All function that return a pointer to an element in the listpack will assert * All function that return a pointer to an element in the listpack will assert
* that this element is valid, so it can be freely used. * that this element is valid, so it can be freely used.
* Generally functions such lpNext and lpDelete assume the input pointer is * Generally functions such lpNext and lpDelete assume the input pointer is
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
assert((p) >= (lp)+LP_HDR_SIZE && (p) < (lp)+lpGetTotalBytes((lp))); \ assert((p) >= (lp)+LP_HDR_SIZE && (p) < (lp)+lpGetTotalBytes((lp))); \
} while (0) } while (0)
/* Similar to the above, but validates the entire element lenth rather than just /* Similar to the above, but validates the entire element length rather than just
* it's pointer. */ * it's pointer. */
#define ASSERT_INTEGRITY_LEN(lp, p, len) do { \ #define ASSERT_INTEGRITY_LEN(lp, p, len) do { \
assert((p) >= (lp)+LP_HDR_SIZE && (p)+(len) < (lp)+lpGetTotalBytes((lp))); \ assert((p) >= (lp)+LP_HDR_SIZE && (p)+(len) < (lp)+lpGetTotalBytes((lp))); \
...@@ -218,7 +218,7 @@ int lpStringToInt64(const char *s, unsigned long slen, int64_t *value) { ...@@ -218,7 +218,7 @@ int lpStringToInt64(const char *s, unsigned long slen, int64_t *value) {
/* Create a new, empty listpack. /* Create a new, empty listpack.
* On success the new listpack is returned, otherwise an error is returned. * On success the new listpack is returned, otherwise an error is returned.
* Pre-allocate at least `capacity` bytes of memory, * Pre-allocate at least `capacity` bytes of memory,
* over-allocated memory can be shrinked by `lpShrinkToFit`. * over-allocated memory can be shrunk by `lpShrinkToFit`.
* */ * */
unsigned char *lpNew(size_t capacity) { unsigned char *lpNew(size_t capacity) {
unsigned char *lp = lp_malloc(capacity > LP_HDR_SIZE+1 ? capacity : LP_HDR_SIZE+1); unsigned char *lp = lp_malloc(capacity > LP_HDR_SIZE+1 ? capacity : LP_HDR_SIZE+1);
...@@ -416,7 +416,7 @@ uint32_t lpCurrentEncodedSizeUnsafe(unsigned char *p) { ...@@ -416,7 +416,7 @@ uint32_t lpCurrentEncodedSizeUnsafe(unsigned char *p) {
} }
/* Return bytes needed to encode the length of the listpack element pointed by 'p'. /* Return bytes needed to encode the length of the listpack element pointed by 'p'.
* This includes just the encodign byte, and the bytes needed to encode the length * This includes just the encoding byte, and the bytes needed to encode the length
* of the element (excluding the element data itself) * of the element (excluding the element data itself)
* If the element encoding is wrong then 0 is returned. */ * If the element encoding is wrong then 0 is returned. */
uint32_t lpCurrentEncodedSizeBytes(unsigned char *p) { uint32_t lpCurrentEncodedSizeBytes(unsigned char *p) {
...@@ -641,7 +641,7 @@ unsigned char *lpGet(unsigned char *p, int64_t *count, unsigned char *intbuf) { ...@@ -641,7 +641,7 @@ unsigned char *lpGet(unsigned char *p, int64_t *count, unsigned char *intbuf) {
* *
* If 'newp' is not NULL, at the end of a successful call '*newp' will be set * If 'newp' is not NULL, at the end of a successful call '*newp' will be set
* to the address of the element just added, so that it will be possible to * to the address of the element just added, so that it will be possible to
* continue an interation with lpNext() and lpPrev(). * continue an interaction with lpNext() and lpPrev().
* *
* For deletion operations ('ele' set to NULL) 'newp' is set to the next * For deletion operations ('ele' set to NULL) 'newp' is set to the next
* element, on the right of the deleted one, or to NULL if the deleted element * element, on the right of the deleted one, or to NULL if the deleted element
...@@ -879,7 +879,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) { ...@@ -879,7 +879,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) {
if (!lenbytes) if (!lenbytes)
return 0; return 0;
/* make sure the encoded entry length doesn't rech outside the edge of the listpack */ /* make sure the encoded entry length doesn't reach outside the edge of the listpack */
if (OUT_OF_RANGE(p + lenbytes)) if (OUT_OF_RANGE(p + lenbytes))
return 0; return 0;
...@@ -888,7 +888,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) { ...@@ -888,7 +888,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) {
unsigned long encodedBacklen = lpEncodeBacklen(NULL,entrylen); unsigned long encodedBacklen = lpEncodeBacklen(NULL,entrylen);
entrylen += encodedBacklen; entrylen += encodedBacklen;
/* make sure the entry doesn't rech outside the edge of the listpack */ /* make sure the entry doesn't reach outside the edge of the listpack */
if (OUT_OF_RANGE(p + entrylen)) if (OUT_OF_RANGE(p + entrylen))
return 0; return 0;
...@@ -925,7 +925,7 @@ int lpValidateIntegrity(unsigned char *lp, size_t size, int deep){ ...@@ -925,7 +925,7 @@ int lpValidateIntegrity(unsigned char *lp, size_t size, int deep){
if (!deep) if (!deep)
return 1; return 1;
/* Validate the invividual entries. */ /* Validate the individual entries. */
uint32_t count = 0; uint32_t count = 0;
unsigned char *p = lpFirst(lp); unsigned char *p = lpFirst(lp);
while(p) { while(p) {
......
...@@ -84,7 +84,7 @@ void lolwutCommand(client *c) { ...@@ -84,7 +84,7 @@ void lolwutCommand(client *c) {
} }
} }
/* ========================== LOLWUT Canvase =============================== /* ========================== LOLWUT Canvas ===============================
* Many LOLWUT versions will likely print some computer art to the screen. * Many LOLWUT versions will likely print some computer art to the screen.
* This is the case with LOLWUT 5 and LOLWUT 6, so here there is a generic * This is the case with LOLWUT 5 and LOLWUT 6, so here there is a generic
* canvas implementation that can be reused. */ * canvas implementation that can be reused. */
......
...@@ -102,7 +102,7 @@ lwCanvas *lwDrawSchotter(int console_cols, int squares_per_row, int squares_per_ ...@@ -102,7 +102,7 @@ lwCanvas *lwDrawSchotter(int console_cols, int squares_per_row, int squares_per_
} }
/* Converts the canvas to an SDS string representing the UTF8 characters to /* Converts the canvas to an SDS string representing the UTF8 characters to
* print to the terminal in order to obtain a graphical representaiton of the * print to the terminal in order to obtain a graphical representation of the
* logical canvas. The actual returned string will require a terminal that is * logical canvas. The actual returned string will require a terminal that is
* width/2 large and height/4 tall in order to hold the whole image without * width/2 large and height/4 tall in order to hold the whole image without
* overflowing or scrolling, since each Barille character is 2x4. */ * overflowing or scrolling, since each Barille character is 2x4. */
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* fun and interesting, and should be replaced by a new implementation at * fun and interesting, and should be replaced by a new implementation at
* each new version of Redis. * each new version of Redis.
* *
* Thanks to Michele Hiki Falcone for the original image that ispired * Thanks to Michele Hiki Falcone for the original image that inspired
* the image, part of his game, Plaguemon. * the image, part of his game, Plaguemon.
* *
* Thanks to the Shhh computer art collective for the help in tuning the * Thanks to the Shhh computer art collective for the help in tuning the
...@@ -180,7 +180,7 @@ void lolwut6Command(client *c) { ...@@ -180,7 +180,7 @@ void lolwut6Command(client *c) {
return; return;
/* Limits. We want LOLWUT to be always reasonably fast and cheap to execute /* Limits. We want LOLWUT to be always reasonably fast and cheap to execute
* so we have maximum number of columns, rows, and output resulution. */ * so we have maximum number of columns, rows, and output resolution. */
if (cols < 1) cols = 1; if (cols < 1) cols = 1;
if (cols > 1000) cols = 1000; if (cols > 1000) cols = 1000;
if (rows < 1) rows = 1; if (rows < 1) rows = 1;
......
...@@ -962,7 +962,7 @@ long long RM_Milliseconds(void) { ...@@ -962,7 +962,7 @@ long long RM_Milliseconds(void) {
* the elapsed execution time when RM_BlockedClientMeasureTimeEnd() is called. * the elapsed execution time when RM_BlockedClientMeasureTimeEnd() is called.
* Within the same command, you can call multiple times * Within the same command, you can call multiple times
* RM_BlockedClientMeasureTimeStart() and RM_BlockedClientMeasureTimeEnd() * RM_BlockedClientMeasureTimeStart() and RM_BlockedClientMeasureTimeEnd()
* to accummulate indepedent time intervals to the background duration. * to accumulate independent time intervals to the background duration.
* This method always return REDISMODULE_OK. */ * This method always return REDISMODULE_OK. */
int RM_BlockedClientMeasureTimeStart(RedisModuleBlockedClient *bc) { int RM_BlockedClientMeasureTimeStart(RedisModuleBlockedClient *bc) {
elapsedStart(&(bc->background_timer)); elapsedStart(&(bc->background_timer));
...@@ -1902,7 +1902,7 @@ RedisModuleString *RM_GetClientUserNameById(RedisModuleCtx *ctx, uint64_t id) { ...@@ -1902,7 +1902,7 @@ RedisModuleString *RM_GetClientUserNameById(RedisModuleCtx *ctx, uint64_t id) {
return str; return str;
} }
/* This is an helper for RM_GetClientInfoById() and other functions: given /* This is a helper for RM_GetClientInfoById() and other functions: given
* a client, it populates the client info structure with the appropriate * a client, it populates the client info structure with the appropriate
* fields depending on the version provided. If the version is not valid * fields depending on the version provided. If the version is not valid
* then REDISMODULE_ERR is returned. Otherwise the function returns * then REDISMODULE_ERR is returned. Otherwise the function returns
...@@ -1935,7 +1935,7 @@ int modulePopulateClientInfoStructure(void *ci, client *client, int structver) { ...@@ -1935,7 +1935,7 @@ int modulePopulateClientInfoStructure(void *ci, client *client, int structver) {
return REDISMODULE_OK; return REDISMODULE_OK;
} }
/* This is an helper for moduleFireServerEvent() and other functions: /* This is a helper for moduleFireServerEvent() and other functions:
* It populates the replication info structure with the appropriate * It populates the replication info structure with the appropriate
* fields depending on the version provided. If the version is not valid * fields depending on the version provided. If the version is not valid
* then REDISMODULE_ERR is returned. Otherwise the function returns * then REDISMODULE_ERR is returned. Otherwise the function returns
...@@ -3093,7 +3093,7 @@ int RM_ZsetRangePrev(RedisModuleKey *key) { ...@@ -3093,7 +3093,7 @@ int RM_ZsetRangePrev(RedisModuleKey *key) {
* *
* The number of fields existing in the hash prior to the call, which have been * The number of fields existing in the hash prior to the call, which have been
* updated (its old value has been replaced by a new value) or deleted. If the * updated (its old value has been replaced by a new value) or deleted. If the
* flag REDISMODULE_HASH_COUNT_ALL is set, insterted fields not previously * flag REDISMODULE_HASH_COUNT_ALL is set, inserted fields not previously
* existing in the hash are also counted. * existing in the hash are also counted.
* *
* If the return value is zero, `errno` is set (since Redis 6.2) as follows: * If the return value is zero, `errno` is set (since Redis 6.2) as follows:
...@@ -3333,7 +3333,7 @@ int RM_StreamAdd(RedisModuleKey *key, int flags, RedisModuleStreamID *id, RedisM ...@@ -3333,7 +3333,7 @@ int RM_StreamAdd(RedisModuleKey *key, int flags, RedisModuleStreamID *id, RedisM
return REDISMODULE_ERR; return REDISMODULE_ERR;
} }
/* Create key if necessery */ /* Create key if necessary */
int created = 0; int created = 0;
if (key->value == NULL) { if (key->value == NULL) {
moduleCreateEmptyKey(key, REDISMODULE_KEYTYPE_STREAM); moduleCreateEmptyKey(key, REDISMODULE_KEYTYPE_STREAM);
...@@ -4470,7 +4470,7 @@ robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) { ...@@ -4470,7 +4470,7 @@ robj *moduleTypeDupOrReply(client *c, robj *fromkey, robj *tokey, robj *value) {
* to have significant internal complexity. To determine this, the defrag mechanism * to have significant internal complexity. To determine this, the defrag mechanism
* uses the free_effort callback and the 'active-defrag-max-scan-fields' config directive. * uses the free_effort callback and the 'active-defrag-max-scan-fields' config directive.
* NOTE: The value is passed as a `void**` and the function is expected to update the * NOTE: The value is passed as a `void**` and the function is expected to update the
* pointer if the top-level value pointer is defragmented and consequentially changes. * pointer if the top-level value pointer is defragmented and consequently changes.
* *
* Note: the module name "AAAAAAAAA" is reserved and produces an error, it * Note: the module name "AAAAAAAAA" is reserved and produces an error, it
* happens to be pretty lame as well. * happens to be pretty lame as well.
...@@ -4925,7 +4925,7 @@ ssize_t rdbSaveModulesAux(rio *rdb, int when) { ...@@ -4925,7 +4925,7 @@ ssize_t rdbSaveModulesAux(rio *rdb, int when) {
* foreach key,value { * foreach key,value {
* AddElement(key); * AddElement(key);
* AddElement(value); * AddElement(value);
* EndSquence(); * EndSequence();
* } * }
* *
* Because the key and value will be always in the above order, while instead * Because the key and value will be always in the above order, while instead
...@@ -6058,13 +6058,13 @@ int RM_SendClusterMessage(RedisModuleCtx *ctx, char *target_id, uint8_t type, un ...@@ -6058,13 +6058,13 @@ int RM_SendClusterMessage(RedisModuleCtx *ctx, char *target_id, uint8_t type, un
} }
/* Return an array of string pointers, each string pointer points to a cluster /* Return an array of string pointers, each string pointer points to a cluster
* node ID of exactly REDISMODULE_NODE_ID_SIZE bytes (without any null term). * node ID of exactly REDISMODULE_NODE_ID_LEN bytes (without any null term).
* The number of returned node IDs is stored into `*numnodes`. * The number of returned node IDs is stored into `*numnodes`.
* However if this function is called by a module not running an a Redis * However if this function is called by a module not running an a Redis
* instance with Redis Cluster enabled, NULL is returned instead. * instance with Redis Cluster enabled, NULL is returned instead.
* *
* The IDs returned can be used with RedisModule_GetClusterNodeInfo() in order * The IDs returned can be used with RedisModule_GetClusterNodeInfo() in order
* to get more information about single nodes. * to get more information about single node.
* *
* The array returned by this function must be freed using the function * The array returned by this function must be freed using the function
* RedisModule_FreeClusterNodesList(). * RedisModule_FreeClusterNodesList().
...@@ -6074,7 +6074,7 @@ int RM_SendClusterMessage(RedisModuleCtx *ctx, char *target_id, uint8_t type, un ...@@ -6074,7 +6074,7 @@ int RM_SendClusterMessage(RedisModuleCtx *ctx, char *target_id, uint8_t type, un
* size_t count, j; * size_t count, j;
* char **ids = RedisModule_GetClusterNodesList(ctx,&count); * char **ids = RedisModule_GetClusterNodesList(ctx,&count);
* for (j = 0; j < count; j++) { * for (j = 0; j < count; j++) {
* RedisModule_Log("notice","Node %.*s", * RedisModule_Log(ctx,"notice","Node %.*s",
* REDISMODULE_NODE_ID_LEN,ids[j]); * REDISMODULE_NODE_ID_LEN,ids[j]);
* } * }
* RedisModule_FreeClusterNodesList(ids); * RedisModule_FreeClusterNodesList(ids);
...@@ -6568,7 +6568,7 @@ int RM_AuthenticateClientWithACLUser(RedisModuleCtx *ctx, const char *name, size ...@@ -6568,7 +6568,7 @@ int RM_AuthenticateClientWithACLUser(RedisModuleCtx *ctx, const char *name, size
/* Deauthenticate and close the client. The client resources will not be /* Deauthenticate and close the client. The client resources will not be
* be immediately freed, but will be cleaned up in a background job. This is * be immediately freed, but will be cleaned up in a background job. This is
* the recommended way to deauthenicate a client since most clients can't * the recommended way to deauthenticate a client since most clients can't
* handle users becoming deauthenticated. Returns REDISMODULE_ERR when the * handle users becoming deauthenticated. Returns REDISMODULE_ERR when the
* client doesn't exist and REDISMODULE_OK when the operation was successful. * client doesn't exist and REDISMODULE_OK when the operation was successful.
* *
...@@ -6598,7 +6598,7 @@ int RM_DeauthenticateAndCloseClient(RedisModuleCtx *ctx, uint64_t client_id) { ...@@ -6598,7 +6598,7 @@ int RM_DeauthenticateAndCloseClient(RedisModuleCtx *ctx, uint64_t client_id) {
* *
* - Connection ID does not exist * - Connection ID does not exist
* - Connection is not a TLS connection * - Connection is not a TLS connection
* - Connection is a TLS connection but no client ceritifcate was used * - Connection is a TLS connection but no client certificate was used
*/ */
RedisModuleString *RM_GetClientCertificate(RedisModuleCtx *ctx, uint64_t client_id) { RedisModuleString *RM_GetClientCertificate(RedisModuleCtx *ctx, uint64_t client_id) {
client *c = lookupClientByID(client_id); client *c = lookupClientByID(client_id);
...@@ -6698,7 +6698,7 @@ void *RM_DictGet(RedisModuleDict *d, RedisModuleString *key, int *nokey) { ...@@ -6698,7 +6698,7 @@ void *RM_DictGet(RedisModuleDict *d, RedisModuleString *key, int *nokey) {
} }
/* Remove the specified key from the dictionary, returning REDISMODULE_OK if /* Remove the specified key from the dictionary, returning REDISMODULE_OK if
* the key was found and delted, or REDISMODULE_ERR if instead there was * the key was found and deleted, or REDISMODULE_ERR if instead there was
* no such key in the dictionary. When the operation is successful, if * no such key in the dictionary. When the operation is successful, if
* 'oldval' is not NULL, then '*oldval' is set to the value stored at the * 'oldval' is not NULL, then '*oldval' is set to the value stored at the
* key before it was deleted. Using this feature it is possible to get * key before it was deleted. Using this feature it is possible to get
...@@ -6720,7 +6720,7 @@ int RM_DictDel(RedisModuleDict *d, RedisModuleString *key, void *oldval) { ...@@ -6720,7 +6720,7 @@ int RM_DictDel(RedisModuleDict *d, RedisModuleString *key, void *oldval) {
* operators available are: * operators available are:
* *
* * `^` -- Seek the first (lexicographically smaller) key. * * `^` -- Seek the first (lexicographically smaller) key.
* * `$` -- Seek the last (lexicographically biffer) key. * * `$` -- Seek the last (lexicographically bigger) key.
* * `>` -- Seek the first element greater than the specified key. * * `>` -- Seek the first element greater than the specified key.
* * `>=` -- Seek the first element greater or equal than the specified key. * * `>=` -- Seek the first element greater or equal than the specified key.
* * `<` -- Seek the first element smaller than the specified key. * * `<` -- Seek the first element smaller than the specified key.
...@@ -6806,7 +6806,7 @@ void *RM_DictNextC(RedisModuleDictIter *di, size_t *keylen, void **dataptr) { ...@@ -6806,7 +6806,7 @@ void *RM_DictNextC(RedisModuleDictIter *di, size_t *keylen, void **dataptr) {
/* This function is exactly like RedisModule_DictNext() but after returning /* This function is exactly like RedisModule_DictNext() but after returning
* the currently selected element in the iterator, it selects the previous * the currently selected element in the iterator, it selects the previous
* element (laxicographically smaller) instead of the next one. */ * element (lexicographically smaller) instead of the next one. */
void *RM_DictPrevC(RedisModuleDictIter *di, size_t *keylen, void **dataptr) { void *RM_DictPrevC(RedisModuleDictIter *di, size_t *keylen, void **dataptr) {
if (!raxPrev(&di->ri)) return NULL; if (!raxPrev(&di->ri)) return NULL;
if (keylen) *keylen = di->ri.key_len; if (keylen) *keylen = di->ri.key_len;
...@@ -6829,7 +6829,7 @@ RedisModuleString *RM_DictNext(RedisModuleCtx *ctx, RedisModuleDictIter *di, voi ...@@ -6829,7 +6829,7 @@ RedisModuleString *RM_DictNext(RedisModuleCtx *ctx, RedisModuleDictIter *di, voi
} }
/* Like RedisModule_DictNext() but after returning the currently selected /* Like RedisModule_DictNext() but after returning the currently selected
* element in the iterator, it selects the previous element (laxicographically * element in the iterator, it selects the previous element (lexicographically
* smaller) instead of the next one. */ * smaller) instead of the next one. */
RedisModuleString *RM_DictPrev(RedisModuleCtx *ctx, RedisModuleDictIter *di, void **dataptr) { RedisModuleString *RM_DictPrev(RedisModuleCtx *ctx, RedisModuleDictIter *di, void **dataptr) {
size_t keylen; size_t keylen;
...@@ -6841,7 +6841,7 @@ RedisModuleString *RM_DictPrev(RedisModuleCtx *ctx, RedisModuleDictIter *di, voi ...@@ -6841,7 +6841,7 @@ RedisModuleString *RM_DictPrev(RedisModuleCtx *ctx, RedisModuleDictIter *di, voi
/* Compare the element currently pointed by the iterator to the specified /* Compare the element currently pointed by the iterator to the specified
* element given by key/keylen, according to the operator 'op' (the set of * element given by key/keylen, according to the operator 'op' (the set of
* valid operators are the same valid for RedisModule_DictIteratorStart). * valid operators are the same valid for RedisModule_DictIteratorStart).
* If the comparision is successful the command returns REDISMODULE_OK * If the comparison is successful the command returns REDISMODULE_OK
* otherwise REDISMODULE_ERR is returned. * otherwise REDISMODULE_ERR is returned.
* *
* This is useful when we want to just emit a lexicographical range, so * This is useful when we want to just emit a lexicographical range, so
...@@ -7614,7 +7614,7 @@ void RM_ScanCursorDestroy(RedisModuleScanCursor *cursor) { ...@@ -7614,7 +7614,7 @@ void RM_ScanCursorDestroy(RedisModuleScanCursor *cursor) {
* RedisModule_ScanCursorDestroy(c); * RedisModule_ScanCursorDestroy(c);
* *
* It is also possible to use this API from another thread while the lock * It is also possible to use this API from another thread while the lock
* is acquired during the actuall call to RM_Scan: * is acquired during the actual call to RM_Scan:
* *
* RedisModuleCursor *c = RedisModule_ScanCursorCreate(); * RedisModuleCursor *c = RedisModule_ScanCursorCreate();
* RedisModule_ThreadSafeContextLock(ctx); * RedisModule_ThreadSafeContextLock(ctx);
...@@ -7711,7 +7711,7 @@ static void moduleScanKeyCallback(void *privdata, const dictEntry *de) { ...@@ -7711,7 +7711,7 @@ static void moduleScanKeyCallback(void *privdata, const dictEntry *de) {
* RedisModule_ScanCursorDestroy(c); * RedisModule_ScanCursorDestroy(c);
* *
* It is also possible to use this API from another thread while the lock is acquired during * It is also possible to use this API from another thread while the lock is acquired during
* the actuall call to RM_ScanKey, and re-opening the key each time: * the actual call to RM_ScanKey, and re-opening the key each time:
* *
* RedisModuleCursor *c = RedisModule_ScanCursorCreate(); * RedisModuleCursor *c = RedisModule_ScanCursorCreate();
* RedisModule_ThreadSafeContextLock(ctx); * RedisModule_ThreadSafeContextLock(ctx);
...@@ -7813,7 +7813,7 @@ int RM_ScanKey(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleSc ...@@ -7813,7 +7813,7 @@ int RM_ScanKey(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleSc
* ## Module fork API * ## Module fork API
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/* Create a background child process with the current frozen snaphost of the /* Create a background child process with the current frozen snapshot of the
* main process where you can do some processing in the background without * main process where you can do some processing in the background without
* affecting / freezing the traffic and no need for threads and GIL locking. * affecting / freezing the traffic and no need for threads and GIL locking.
* Note that Redis allows for only one concurrent fork. * Note that Redis allows for only one concurrent fork.
...@@ -7973,7 +7973,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) { ...@@ -7973,7 +7973,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) {
* The above events are triggered not just when the user calls the * The above events are triggered not just when the user calls the
* relevant commands like BGSAVE, but also when a saving operation * relevant commands like BGSAVE, but also when a saving operation
* or AOF rewriting occurs because of internal server triggers. * or AOF rewriting occurs because of internal server triggers.
* The SYNC_RDB_START sub events are happening in the forground due to * The SYNC_RDB_START sub events are happening in the foreground due to
* SAVE command, FLUSHALL, or server shutdown, and the other RDB and * SAVE command, FLUSHALL, or server shutdown, and the other RDB and
* AOF sub events are executed in a background fork child, so any * AOF sub events are executed in a background fork child, so any
* action the module takes can only affect the generated AOF or RDB, * action the module takes can only affect the generated AOF or RDB,
...@@ -8001,7 +8001,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) { ...@@ -8001,7 +8001,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) {
* int32_t dbnum; // Flushed database number, -1 for all the DBs * int32_t dbnum; // Flushed database number, -1 for all the DBs
* // in the case of the FLUSHALL operation. * // in the case of the FLUSHALL operation.
* *
* The start event is called *before* the operation is initated, thus * The start event is called *before* the operation is initiated, thus
* allowing the callback to call DBSIZE or other operation on the * allowing the callback to call DBSIZE or other operation on the
* yet-to-free keyspace. * yet-to-free keyspace.
* *
...@@ -8093,7 +8093,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) { ...@@ -8093,7 +8093,7 @@ void ModuleForkDoneHandler(int exitcode, int bysignal) {
* *
* This event is called repeatedly called while an RDB or AOF file * This event is called repeatedly called while an RDB or AOF file
* is being loaded. * is being loaded.
* The following sub events are availble: * The following sub events are available:
* *
* * `REDISMODULE_SUBEVENT_LOADING_PROGRESS_RDB` * * `REDISMODULE_SUBEVENT_LOADING_PROGRESS_RDB`
* * `REDISMODULE_SUBEVENT_LOADING_PROGRESS_AOF` * * `REDISMODULE_SUBEVENT_LOADING_PROGRESS_AOF`
...@@ -8219,7 +8219,7 @@ int RM_IsSubEventSupported(RedisModuleEvent event, int64_t subevent) { ...@@ -8219,7 +8219,7 @@ int RM_IsSubEventSupported(RedisModuleEvent event, int64_t subevent) {
} }
/* This is called by the Redis internals every time we want to fire an /* This is called by the Redis internals every time we want to fire an
* event that can be interceppted by some module. The pointer 'data' is useful * event that can be intercepted by some module. The pointer 'data' is useful
* in order to populate the event-specific structure when needed, in order * in order to populate the event-specific structure when needed, in order
* to return the structure with more information to the callback. * to return the structure with more information to the callback.
* *
...@@ -8963,11 +8963,11 @@ int RM_ModuleTypeReplaceValue(RedisModuleKey *key, moduleType *mt, void *new_val ...@@ -8963,11 +8963,11 @@ int RM_ModuleTypeReplaceValue(RedisModuleKey *key, moduleType *mt, void *new_val
/* For a specified command, parse its arguments and return an array that /* For a specified command, parse its arguments and return an array that
* contains the indexes of all key name arguments. This function is * contains the indexes of all key name arguments. This function is
* essnetially a more efficient way to do COMMAND GETKEYS. * essentially a more efficient way to do COMMAND GETKEYS.
* *
* A NULL return value indicates the specified command has no keys, or * A NULL return value indicates the specified command has no keys, or
* an error condition. Error conditions are indicated by setting errno * an error condition. Error conditions are indicated by setting errno
* as folllows: * as follows:
* *
* * ENOENT: Specified command does not exist. * * ENOENT: Specified command does not exist.
* * EINVAL: Invalid command arity specified. * * EINVAL: Invalid command arity specified.
......
...@@ -88,7 +88,7 @@ int cmd_KEYRANGE(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { ...@@ -88,7 +88,7 @@ int cmd_KEYRANGE(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
/* Reply with the matching items. */ /* Reply with the matching items. */
char *key; char *key;
size_t keylen; size_t keylen;
long long replylen = 0; /* Keep track of the amitted array len. */ long long replylen = 0; /* Keep track of the emitted array len. */
RedisModule_ReplyWithArray(ctx,REDISMODULE_POSTPONED_ARRAY_LEN); RedisModule_ReplyWithArray(ctx,REDISMODULE_POSTPONED_ARRAY_LEN);
while((key = RedisModule_DictNextC(iter,&keylen,NULL)) != NULL) { while((key = RedisModule_DictNextC(iter,&keylen,NULL)) != NULL) {
if (replylen >= count) break; if (replylen >= count) break;
......
...@@ -229,7 +229,7 @@ void HelloBlock_FreeData(RedisModuleCtx *ctx, void *privdata) { ...@@ -229,7 +229,7 @@ void HelloBlock_FreeData(RedisModuleCtx *ctx, void *privdata) {
RedisModule_Free(privdata); RedisModule_Free(privdata);
} }
/* HELLOTYPE.BRANGE key first count timeout -- This is a blocking verison of /* HELLOTYPE.BRANGE key first count timeout -- This is a blocking version of
* the RANGE operation, in order to show how to use the API * the RANGE operation, in order to show how to use the API
* RedisModule_BlockClientOnKeys(). */ * RedisModule_BlockClientOnKeys(). */
int HelloTypeBRange_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { int HelloTypeBRange_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
......
...@@ -302,7 +302,7 @@ void _addReplyProtoToList(client *c, const char *s, size_t len) { ...@@ -302,7 +302,7 @@ void _addReplyProtoToList(client *c, const char *s, size_t len) {
/* Note that 'tail' may be NULL even if we have a tail node, because when /* Note that 'tail' may be NULL even if we have a tail node, because when
* addReplyDeferredLen() is used, it sets a dummy node to NULL just * addReplyDeferredLen() is used, it sets a dummy node to NULL just
* fo fill it later, when the size of the bulk length is set. */ * to fill it later, when the size of the bulk length is set. */
/* Append to tail string when possible. */ /* Append to tail string when possible. */
if (tail) { if (tail) {
...@@ -1752,7 +1752,7 @@ int processInlineBuffer(client *c) { ...@@ -1752,7 +1752,7 @@ int processInlineBuffer(client *c) {
/* Masters should never send us inline protocol to run actual /* Masters should never send us inline protocol to run actual
* commands. If this happens, it is likely due to a bug in Redis where * commands. If this happens, it is likely due to a bug in Redis where
* we got some desynchronization in the protocol, for example * we got some desynchronization in the protocol, for example
* beause of a PSYNC gone bad. * because of a PSYNC gone bad.
* *
* However the is an exception: masters may send us just a newline * However the is an exception: masters may send us just a newline
* to keep the connection active. */ * to keep the connection active. */
...@@ -1783,7 +1783,7 @@ int processInlineBuffer(client *c) { ...@@ -1783,7 +1783,7 @@ int processInlineBuffer(client *c) {
return C_OK; return C_OK;
} }
/* Helper function. Record protocol erro details in server log, /* Helper function. Record protocol error details in server log,
* and set the client as CLIENT_CLOSE_AFTER_REPLY and * and set the client as CLIENT_CLOSE_AFTER_REPLY and
* CLIENT_PROTOCOL_ERROR. */ * CLIENT_PROTOCOL_ERROR. */
#define PROTO_DUMP_LEN 128 #define PROTO_DUMP_LEN 128
...@@ -2367,7 +2367,7 @@ sds getAllClientsInfoString(int type) { ...@@ -2367,7 +2367,7 @@ sds getAllClientsInfoString(int type) {
/* This function implements CLIENT SETNAME, including replying to the /* This function implements CLIENT SETNAME, including replying to the
* user with an error if the charset is wrong (in that case C_ERR is * user with an error if the charset is wrong (in that case C_ERR is
* returned). If the function succeeeded C_OK is returned, and it's up * returned). If the function succeeded C_OK is returned, and it's up
* to the caller to send a reply if needed. * to the caller to send a reply if needed.
* *
* Setting an empty string as name has the effect of unsetting the * Setting an empty string as name has the effect of unsetting the
...@@ -2484,7 +2484,7 @@ void clientCommand(client *c) { ...@@ -2484,7 +2484,7 @@ void clientCommand(client *c) {
"UNPAUSE", "UNPAUSE",
" Stop the current client pause, resuming traffic.", " Stop the current client pause, resuming traffic.",
"PAUSE <timeout> [WRITE|ALL]", "PAUSE <timeout> [WRITE|ALL]",
" Suspend all, or just write, clients for <timout> milliseconds.", " Suspend all, or just write, clients for <timeout> milliseconds.",
"REPLY (ON|OFF|SKIP)", "REPLY (ON|OFF|SKIP)",
" Control the replies sent to the current connection.", " Control the replies sent to the current connection.",
"SETNAME <name>", "SETNAME <name>",
...@@ -3312,7 +3312,7 @@ void flushSlavesOutputBuffers(void) { ...@@ -3312,7 +3312,7 @@ void flushSlavesOutputBuffers(void) {
* *
* A main use case of this function is to allow pausing replication traffic * A main use case of this function is to allow pausing replication traffic
* so that a failover without data loss to occur. Replicas will continue to receive * so that a failover without data loss to occur. Replicas will continue to receive
* traffic to faciliate this functionality. * traffic to facilitate this functionality.
* *
* This function is also internally used by Redis Cluster for the manual * This function is also internally used by Redis Cluster for the manual
* failover procedure implemented by CLUSTER FAILOVER. * failover procedure implemented by CLUSTER FAILOVER.
...@@ -3401,7 +3401,7 @@ void processEventsWhileBlocked(void) { ...@@ -3401,7 +3401,7 @@ void processEventsWhileBlocked(void) {
AE_FILE_EVENTS|AE_DONT_WAIT| AE_FILE_EVENTS|AE_DONT_WAIT|
AE_CALL_BEFORE_SLEEP|AE_CALL_AFTER_SLEEP); AE_CALL_BEFORE_SLEEP|AE_CALL_AFTER_SLEEP);
/* Note that server.events_processed_while_blocked will also get /* Note that server.events_processed_while_blocked will also get
* incremeted by callbacks called by the event loop handlers. */ * incremented by callbacks called by the event loop handlers. */
server.events_processed_while_blocked += ae_events; server.events_processed_while_blocked += ae_events;
long long events = server.events_processed_while_blocked - startval; long long events = server.events_processed_while_blocked - startval;
if (!events) break; if (!events) break;
......
...@@ -93,8 +93,9 @@ sds keyspaceEventsFlagsToString(int flags) { ...@@ -93,8 +93,9 @@ sds keyspaceEventsFlagsToString(int flags) {
/* The API provided to the rest of the Redis core is a simple function: /* The API provided to the rest of the Redis core is a simple function:
* *
* notifyKeyspaceEvent(char *event, robj *key, int dbid); * notifyKeyspaceEvent(int type, char *event, robj *key, int dbid);
* *
* 'type' is the notification class we define in `server.h`.
* 'event' is a C string representing the event name. * 'event' is a C string representing the event name.
* 'key' is a Redis object representing the key name. * 'key' is a Redis object representing the key name.
* 'dbid' is the database ID where the key lives. */ * 'dbid' is the database ID where the key lives. */
......
...@@ -762,7 +762,7 @@ char *strEncoding(int encoding) { ...@@ -762,7 +762,7 @@ char *strEncoding(int encoding) {
/* =========================== Memory introspection ========================= */ /* =========================== Memory introspection ========================= */
/* This is an helper function with the goal of estimating the memory /* This is a helper function with the goal of estimating the memory
* size of a radix tree that is used to store Stream IDs. * size of a radix tree that is used to store Stream IDs.
* *
* Note: to guess the size of the radix tree is not trivial, so we * Note: to guess the size of the radix tree is not trivial, so we
...@@ -1208,9 +1208,9 @@ int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle, ...@@ -1208,9 +1208,9 @@ int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle,
* below statement will expand to lru_idle*1000/1000. */ * below statement will expand to lru_idle*1000/1000. */
lru_idle = lru_idle*lru_multiplier/LRU_CLOCK_RESOLUTION; lru_idle = lru_idle*lru_multiplier/LRU_CLOCK_RESOLUTION;
long lru_abs = lru_clock - lru_idle; /* Absolute access time. */ long lru_abs = lru_clock - lru_idle; /* Absolute access time. */
/* If the LRU field underflows (since LRU it is a wrapping /* If the LRU field underflow (since LRU it is a wrapping
* clock), the best we can do is to provide a large enough LRU * clock), the best we can do is to provide a large enough LRU
* that is half-way in the circlular LRU clock we use: this way * that is half-way in the circular LRU clock we use: this way
* the computed idle time for this object will stay high for quite * the computed idle time for this object will stay high for quite
* some time. */ * some time. */
if (lru_abs < 0) if (lru_abs < 0)
......
...@@ -344,7 +344,7 @@ void subscribeCommand(client *c) { ...@@ -344,7 +344,7 @@ void subscribeCommand(client *c) {
* expect a reply per command and so can not execute subscribe. * expect a reply per command and so can not execute subscribe.
* *
* Notice that we have a special treatment for multi because of * Notice that we have a special treatment for multi because of
* backword compatibility * backward compatibility
*/ */
addReplyError(c, "SUBSCRIBE isn't allowed for a DENY BLOCKING client"); addReplyError(c, "SUBSCRIBE isn't allowed for a DENY BLOCKING client");
return; return;
...@@ -377,7 +377,7 @@ void psubscribeCommand(client *c) { ...@@ -377,7 +377,7 @@ void psubscribeCommand(client *c) {
* expect a reply per command and so can not execute subscribe. * expect a reply per command and so can not execute subscribe.
* *
* Notice that we have a special treatment for multi because of * Notice that we have a special treatment for multi because of
* backword compatibility * backward compatibility
*/ */
addReplyError(c, "PSUBSCRIBE isn't allowed for a DENY BLOCKING client"); addReplyError(c, "PSUBSCRIBE isn't allowed for a DENY BLOCKING client");
return; return;
......
...@@ -182,7 +182,7 @@ static inline void raxStackFree(raxStack *ts) { ...@@ -182,7 +182,7 @@ static inline void raxStackFree(raxStack *ts) {
) )
/* Allocate a new non compressed node with the specified number of children. /* Allocate a new non compressed node with the specified number of children.
* If datafiled is true, the allocation is made large enough to hold the * If datafield is true, the allocation is made large enough to hold the
* associated data pointer. * associated data pointer.
* Returns the new node pointer. On out of memory NULL is returned. */ * Returns the new node pointer. On out of memory NULL is returned. */
raxNode *raxNewNode(size_t children, int datafield) { raxNode *raxNewNode(size_t children, int datafield) {
...@@ -259,7 +259,7 @@ raxNode *raxAddChild(raxNode *n, unsigned char c, raxNode **childptr, raxNode ** ...@@ -259,7 +259,7 @@ raxNode *raxAddChild(raxNode *n, unsigned char c, raxNode **childptr, raxNode **
size_t curlen = raxNodeCurrentLength(n); size_t curlen = raxNodeCurrentLength(n);
n->size++; n->size++;
size_t newlen = raxNodeCurrentLength(n); size_t newlen = raxNodeCurrentLength(n);
n->size--; /* For now restore the orignal size. We'll update it only on n->size--; /* For now restore the original size. We'll update it only on
success at the end. */ success at the end. */
/* Alloc the new child we will link to 'n'. */ /* Alloc the new child we will link to 'n'. */
...@@ -352,8 +352,8 @@ raxNode *raxAddChild(raxNode *n, unsigned char c, raxNode **childptr, raxNode ** ...@@ -352,8 +352,8 @@ raxNode *raxAddChild(raxNode *n, unsigned char c, raxNode **childptr, raxNode **
* we don't need to do anything if there was already some padding to use. In * we don't need to do anything if there was already some padding to use. In
* that case the final destination of the pointers will be the same, however * that case the final destination of the pointers will be the same, however
* in our example there was no pre-existing padding, so we added one byte * in our example there was no pre-existing padding, so we added one byte
* plus thre bytes of padding. After the next memmove() things will look * plus there bytes of padding. After the next memmove() things will look
* like thata: * like that:
* *
* [HDR*][abde][....][Aptr][Bptr][....][Dptr][Eptr]|AUXP| * [HDR*][abde][....][Aptr][Bptr][....][Dptr][Eptr]|AUXP|
*/ */
...@@ -653,7 +653,7 @@ int raxGenericInsert(rax *rax, unsigned char *s, size_t len, void *data, void ** ...@@ -653,7 +653,7 @@ int raxGenericInsert(rax *rax, unsigned char *s, size_t len, void *data, void **
* Let $SPLITPOS be the zero-based index at which, in the * Let $SPLITPOS be the zero-based index at which, in the
* compressed node array of characters, we stopped iterating because * compressed node array of characters, we stopped iterating because
* there were no more keys character to match. So in the example of * there were no more keys character to match. So in the example of
* the node "ANNIBALE", addig the string "ANNI", the $SPLITPOS is 4. * the node "ANNIBALE", adding the string "ANNI", the $SPLITPOS is 4.
* *
* 1. Save the current compressed node $NEXT pointer (the pointer to the * 1. Save the current compressed node $NEXT pointer (the pointer to the
* child element, that is always present in compressed nodes). * child element, that is always present in compressed nodes).
...@@ -666,7 +666,7 @@ int raxGenericInsert(rax *rax, unsigned char *s, size_t len, void *data, void ** ...@@ -666,7 +666,7 @@ int raxGenericInsert(rax *rax, unsigned char *s, size_t len, void *data, void **
* *
* 3. Trim the current node to contain the first $SPLITPOS characters. * 3. Trim the current node to contain the first $SPLITPOS characters.
* As usually if the new node length is just 1, set iscompr to 0. * As usually if the new node length is just 1, set iscompr to 0.
* Take the iskey / associated value as it was in the orignal node. * Take the iskey / associated value as it was in the original node.
* Fix the parent's reference. * Fix the parent's reference.
* *
* 4. Set the postfix node as the only child pointer of the trimmed * 4. Set the postfix node as the only child pointer of the trimmed
...@@ -1102,9 +1102,9 @@ int raxRemove(rax *rax, unsigned char *s, size_t len, void **old) { ...@@ -1102,9 +1102,9 @@ int raxRemove(rax *rax, unsigned char *s, size_t len, void **old) {
* We try to navigate upward till there are other nodes that can be * We try to navigate upward till there are other nodes that can be
* compressed, when we reach the upper node which is not a key and has * compressed, when we reach the upper node which is not a key and has
* a single child, we scan the chain of children to collect the * a single child, we scan the chain of children to collect the
* compressable part of the tree, and replace the current node with the * compressible part of the tree, and replace the current node with the
* new one, fixing the child pointer to reference the first non * new one, fixing the child pointer to reference the first non
* compressable node. * compressible node.
* *
* Example of case "1". A tree stores the keys "FOO" = 1 and * Example of case "1". A tree stores the keys "FOO" = 1 and
* "FOOBAR" = 2: * "FOOBAR" = 2:
...@@ -1341,7 +1341,7 @@ int raxIteratorNextStep(raxIterator *it, int noup) { ...@@ -1341,7 +1341,7 @@ int raxIteratorNextStep(raxIterator *it, int noup) {
if (it->node_cb && it->node_cb(&it->node)) if (it->node_cb && it->node_cb(&it->node))
memcpy(cp,&it->node,sizeof(it->node)); memcpy(cp,&it->node,sizeof(it->node));
/* For "next" step, stop every time we find a key along the /* For "next" step, stop every time we find a key along the
* way, since the key is lexicograhically smaller compared to * way, since the key is lexicographically smaller compared to
* what follows in the sub-children. */ * what follows in the sub-children. */
if (it->node->iskey) { if (it->node->iskey) {
it->data = raxGetData(it->node); it->data = raxGetData(it->node);
...@@ -1409,7 +1409,7 @@ int raxIteratorNextStep(raxIterator *it, int noup) { ...@@ -1409,7 +1409,7 @@ int raxIteratorNextStep(raxIterator *it, int noup) {
} }
/* Seek the greatest key in the subtree at the current node. Return 0 on /* Seek the greatest key in the subtree at the current node. Return 0 on
* out of memory, otherwise 1. This is an helper function for different * out of memory, otherwise 1. This is a helper function for different
* iteration functions below. */ * iteration functions below. */
int raxSeekGreatest(raxIterator *it) { int raxSeekGreatest(raxIterator *it) {
while(it->node->size) { while(it->node->size) {
......
...@@ -699,7 +699,7 @@ int rdbLoadObjectType(rio *rdb) { ...@@ -699,7 +699,7 @@ int rdbLoadObjectType(rio *rdb) {
/* This helper function serializes a consumer group Pending Entries List (PEL) /* This helper function serializes a consumer group Pending Entries List (PEL)
* into the RDB file. The 'nacks' argument tells the function if also persist * into the RDB file. The 'nacks' argument tells the function if also persist
* the informations about the not acknowledged message, or if to persist * the information about the not acknowledged message, or if to persist
* just the IDs: this is useful because for the global consumer group PEL * just the IDs: this is useful because for the global consumer group PEL
* we serialized the NACKs as well, but when serializing the local consumer * we serialized the NACKs as well, but when serializing the local consumer
* PELs we just add the ID, that will be resolved inside the global PEL to * PELs we just add the ID, that will be resolved inside the global PEL to
...@@ -1452,7 +1452,7 @@ void rdbRemoveTempFile(pid_t childpid, int from_signal) { ...@@ -1452,7 +1452,7 @@ void rdbRemoveTempFile(pid_t childpid, int from_signal) {
char tmpfile[256]; char tmpfile[256];
char pid[32]; char pid[32];
/* Generate temp rdb file name using aync-signal safe functions. */ /* Generate temp rdb file name using async-signal safe functions. */
int pid_len = ll2string(pid, sizeof(pid), childpid); int pid_len = ll2string(pid, sizeof(pid), childpid);
strcpy(tmpfile, "temp-"); strcpy(tmpfile, "temp-");
strncpy(tmpfile+5, pid, pid_len); strncpy(tmpfile+5, pid, pid_len);
...@@ -1614,7 +1614,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) { ...@@ -1614,7 +1614,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key) {
} }
} }
} else if (rdbtype == RDB_TYPE_ZSET_2 || rdbtype == RDB_TYPE_ZSET) { } else if (rdbtype == RDB_TYPE_ZSET_2 || rdbtype == RDB_TYPE_ZSET) {
/* Read list/set value. */ /* Read sorted set value. */
uint64_t zsetlen; uint64_t zsetlen;
size_t maxelelen = 0; size_t maxelelen = 0;
zset *zs; zset *zs;
...@@ -2625,7 +2625,7 @@ eoferr: ...@@ -2625,7 +2625,7 @@ eoferr:
* to do the actual loading. Moreover the ETA displayed in the INFO * to do the actual loading. Moreover the ETA displayed in the INFO
* output is initialized and finalized. * output is initialized and finalized.
* *
* If you pass an 'rsi' structure initialied with RDB_SAVE_OPTION_INIT, the * If you pass an 'rsi' structure initialized with RDB_SAVE_OPTION_INIT, the
* loading code will fill the information fields in the structure. */ * loading code will fill the information fields in the structure. */
int rdbLoad(char *filename, rdbSaveInfo *rsi, int rdbflags) { int rdbLoad(char *filename, rdbSaveInfo *rsi, int rdbflags) {
FILE *fp; FILE *fp;
...@@ -2901,7 +2901,7 @@ void bgsaveCommand(client *c) { ...@@ -2901,7 +2901,7 @@ void bgsaveCommand(client *c) {
* information inside the RDB file. Currently the structure explicitly * information inside the RDB file. Currently the structure explicitly
* contains just the currently selected DB from the master stream, however * contains just the currently selected DB from the master stream, however
* if the rdbSave*() family functions receive a NULL rsi structure also * if the rdbSave*() family functions receive a NULL rsi structure also
* the Replication ID/offset is not saved. The function popultes 'rsi' * the Replication ID/offset is not saved. The function populates 'rsi'
* that is normally stack-allocated in the caller, returns the populated * that is normally stack-allocated in the caller, returns the populated
* pointer if the instance has a valid master client, otherwise NULL * pointer if the instance has a valid master client, otherwise NULL
* is returned, and the RDB saving will not persist any replication related * is returned, and the RDB saving will not persist any replication related
......
...@@ -1466,7 +1466,7 @@ int parseOptions(int argc, const char **argv) { ...@@ -1466,7 +1466,7 @@ int parseOptions(int argc, const char **argv) {
config.idlemode = 1; config.idlemode = 1;
} else if (!strcmp(argv[i],"-e")) { } else if (!strcmp(argv[i],"-e")) {
printf("WARNING: -e option has been deprecated. " printf("WARNING: -e option has been deprecated. "
"We now immediatly exit on error to avoid false results.\n"); "We now immediately exit on error to avoid false results.\n");
} else if (!strcmp(argv[i],"-t")) { } else if (!strcmp(argv[i],"-t")) {
if (lastarg) goto invalid; if (lastarg) goto invalid;
/* We get the list of tests to run as a string in the form /* We get the list of tests to run as a string in the form
...@@ -1586,11 +1586,11 @@ usage: ...@@ -1586,11 +1586,11 @@ usage:
" --insecure Allow insecure TLS connection by skipping cert validation.\n" " --insecure Allow insecure TLS connection by skipping cert validation.\n"
" --cert <file> Client certificate to authenticate with.\n" " --cert <file> Client certificate to authenticate with.\n"
" --key <file> Private key file to authenticate with.\n" " --key <file> Private key file to authenticate with.\n"
" --tls-ciphers <list> Sets the list of prefered ciphers (TLSv1.2 and below)\n" " --tls-ciphers <list> Sets the list of preferred ciphers (TLSv1.2 and below)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about the syntax of this string.\n" " See the ciphers(1ssl) manpage for more information about the syntax of this string.\n"
#ifdef TLS1_3_VERSION #ifdef TLS1_3_VERSION
" --tls-ciphersuites <list> Sets the list of prefered ciphersuites (TLSv1.3)\n" " --tls-ciphersuites <list> Sets the list of preferred ciphersuites (TLSv1.3)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about the syntax of this string,\n" " See the ciphers(1ssl) manpage for more information about the syntax of this string,\n"
" and specifically for TLSv1.3 ciphersuites.\n" " and specifically for TLSv1.3 ciphersuites.\n"
......
...@@ -128,7 +128,7 @@ void rdbCheckError(const char *fmt, ...) { ...@@ -128,7 +128,7 @@ void rdbCheckError(const char *fmt, ...) {
rdbShowGenericInfo(); rdbShowGenericInfo();
} }
/* Print informations during RDB checking. */ /* Print information during RDB checking. */
void rdbCheckInfo(const char *fmt, ...) { void rdbCheckInfo(const char *fmt, ...) {
char msg[1024]; char msg[1024];
va_list ap; va_list ap;
...@@ -265,7 +265,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { ...@@ -265,7 +265,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) {
} else if (type == RDB_OPCODE_AUX) { } else if (type == RDB_OPCODE_AUX) {
/* AUX: generic string-string fields. Use to add state to RDB /* AUX: generic string-string fields. Use to add state to RDB
* which is backward compatible. Implementations of RDB loading * which is backward compatible. Implementations of RDB loading
* are requierd to skip AUX fields they don't understand. * are required to skip AUX fields they don't understand.
* *
* An AUX field is composed of two strings: key and value. */ * An AUX field is composed of two strings: key and value. */
robj *auxkey, *auxval; robj *auxkey, *auxval;
......
...@@ -1893,11 +1893,11 @@ static void usage(void) { ...@@ -1893,11 +1893,11 @@ static void usage(void) {
" --insecure Allow insecure TLS connection by skipping cert validation.\n" " --insecure Allow insecure TLS connection by skipping cert validation.\n"
" --cert <file> Client certificate to authenticate with.\n" " --cert <file> Client certificate to authenticate with.\n"
" --key <file> Private key file to authenticate with.\n" " --key <file> Private key file to authenticate with.\n"
" --tls-ciphers <list> Sets the list of prefered ciphers (TLSv1.2 and below)\n" " --tls-ciphers <list> Sets the list of preferred ciphers (TLSv1.2 and below)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about the syntax of this string.\n" " See the ciphers(1ssl) manpage for more information about the syntax of this string.\n"
#ifdef TLS1_3_VERSION #ifdef TLS1_3_VERSION
" --tls-ciphersuites <list> Sets the list of prefered ciphersuites (TLSv1.3)\n" " --tls-ciphersuites <list> Sets the list of preferred ciphersuites (TLSv1.3)\n"
" in order of preference from highest to lowest separated by colon (\":\").\n" " in order of preference from highest to lowest separated by colon (\":\").\n"
" See the ciphers(1ssl) manpage for more information about the syntax of this string,\n" " See the ciphers(1ssl) manpage for more information about the syntax of this string,\n"
" and specifically for TLSv1.3 ciphersuites.\n" " and specifically for TLSv1.3 ciphersuites.\n"
...@@ -1909,7 +1909,7 @@ static void usage(void) { ...@@ -1909,7 +1909,7 @@ static void usage(void) {
" --quoted-input Force input to be handled as quoted strings.\n" " --quoted-input Force input to be handled as quoted strings.\n"
" --csv Output in CSV format.\n" " --csv Output in CSV format.\n"
" --show-pushes <yn> Whether to print RESP3 PUSH messages. Enabled by default when\n" " --show-pushes <yn> Whether to print RESP3 PUSH messages. Enabled by default when\n"
" STDOUT is a tty but can be overriden with --show-pushes no.\n" " STDOUT is a tty but can be overridden with --show-pushes no.\n"
" --stat Print rolling stats about server: mem, clients, ...\n" " --stat Print rolling stats about server: mem, clients, ...\n"
" --latency Enter a special mode continuously sampling latency.\n" " --latency Enter a special mode continuously sampling latency.\n"
" If you use this mode in an interactive session it runs\n" " If you use this mode in an interactive session it runs\n"
...@@ -2639,7 +2639,7 @@ static int parseClusterNodeAddress(char *addr, char **ip_ptr, int *port_ptr, ...@@ -2639,7 +2639,7 @@ static int parseClusterNodeAddress(char *addr, char **ip_ptr, int *port_ptr,
* been provided it must be in the form of 'ip:port', elsewhere * been provided it must be in the form of 'ip:port', elsewhere
* the first argument must be the ip and the second one the port. * the first argument must be the ip and the second one the port.
* If host and port can be detected, it returns 1 and it stores host and * If host and port can be detected, it returns 1 and it stores host and
* port into variables referenced by'ip_ptr' and 'port_ptr' pointers, * port into variables referenced by 'ip_ptr' and 'port_ptr' pointers,
* elsewhere it returns 0. */ * elsewhere it returns 0. */
static int getClusterHostFromCmdArgs(int argc, char **argv, static int getClusterHostFromCmdArgs(int argc, char **argv,
char **ip_ptr, int *port_ptr) { char **ip_ptr, int *port_ptr) {
...@@ -2992,7 +2992,7 @@ result: ...@@ -2992,7 +2992,7 @@ result:
* So a greater score means a worse anti-affinity level, while zero * So a greater score means a worse anti-affinity level, while zero
* means perfect anti-affinity. * means perfect anti-affinity.
* *
* The anti affinity optimizator will try to get a score as low as * The anti affinity optimization will try to get a score as low as
* possible. Since we do not want to sacrifice the fact that slaves should * possible. Since we do not want to sacrifice the fact that slaves should
* not be in the same host as the master, we assign 10000 times the score * not be in the same host as the master, we assign 10000 times the score
* to this violation, so that we'll optimize for the second factor only * to this violation, so that we'll optimize for the second factor only
...@@ -8183,7 +8183,7 @@ static void LRUTestMode(void) { ...@@ -8183,7 +8183,7 @@ static void LRUTestMode(void) {
} }
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Intrisic latency mode. * Intrinsic latency mode.
* *
* Measure max latency of a running process that does not result from * Measure max latency of a running process that does not result from
* syscalls. Basically this software should provide a hint about how much * syscalls. Basically this software should provide a hint about how much
......
...@@ -789,7 +789,7 @@ void syncCommand(client *c) { ...@@ -789,7 +789,7 @@ void syncCommand(client *c) {
/* Increment stats for failed PSYNCs, but only if the /* Increment stats for failed PSYNCs, but only if the
* replid is not "?", as this is used by slaves to force a full * replid is not "?", as this is used by slaves to force a full
* resync on purpose when they are not albe to partially * resync on purpose when they are not able to partially
* resync. */ * resync. */
if (master_replid[0] != '?') server.stat_sync_partial_err++; if (master_replid[0] != '?') server.stat_sync_partial_err++;
} }
...@@ -870,7 +870,7 @@ void syncCommand(client *c) { ...@@ -870,7 +870,7 @@ void syncCommand(client *c) {
* in order to synchronize. */ * in order to synchronize. */
serverLog(LL_NOTICE,"Current BGSAVE has socket target. Waiting for next BGSAVE for SYNC"); serverLog(LL_NOTICE,"Current BGSAVE has socket target. Waiting for next BGSAVE for SYNC");
/* CASE 3: There is no BGSAVE is progress. */ /* CASE 3: There is no BGSAVE is in progress. */
} else { } else {
if (server.repl_diskless_sync && (c->slave_capa & SLAVE_CAPA_EOF) && if (server.repl_diskless_sync && (c->slave_capa & SLAVE_CAPA_EOF) &&
server.repl_diskless_sync_delay) server.repl_diskless_sync_delay)
...@@ -1234,7 +1234,7 @@ void rdbPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *clientData, ...@@ -1234,7 +1234,7 @@ void rdbPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *clientData,
} }
serverLog(LL_WARNING,"Diskless rdb transfer, done reading from pipe, %d replicas still up.", stillUp); serverLog(LL_WARNING,"Diskless rdb transfer, done reading from pipe, %d replicas still up.", stillUp);
/* Now that the replicas have finished reading, notify the child that it's safe to exit. /* Now that the replicas have finished reading, notify the child that it's safe to exit.
* When the server detectes the child has exited, it can mark the replica as online, and * When the server detects the child has exited, it can mark the replica as online, and
* start streaming the replication buffers. */ * start streaming the replication buffers. */
close(server.rdb_child_exit_pipe); close(server.rdb_child_exit_pipe);
server.rdb_child_exit_pipe = -1; server.rdb_child_exit_pipe = -1;
...@@ -1336,7 +1336,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { ...@@ -1336,7 +1336,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
* *
* So things work like that: * So things work like that:
* *
* 1. We end trasnferring the RDB file via socket. * 1. We end transferring the RDB file via socket.
* 2. The replica is put ONLINE but the write handler * 2. The replica is put ONLINE but the write handler
* is not installed. * is not installed.
* 3. The replica however goes really online, and pings us * 3. The replica however goes really online, and pings us
...@@ -1351,7 +1351,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { ...@@ -1351,7 +1351,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
* in advance). Detecting such final EOF string is much * in advance). Detecting such final EOF string is much
* simpler and less CPU intensive if no more data is sent * simpler and less CPU intensive if no more data is sent
* after such final EOF. So we don't want to glue the end of * after such final EOF. So we don't want to glue the end of
* the RDB trasfer with the start of the other replication * the RDB transfer with the start of the other replication
* data. */ * data. */
slave->replstate = SLAVE_STATE_ONLINE; slave->replstate = SLAVE_STATE_ONLINE;
slave->repl_put_online_on_ack = 1; slave->repl_put_online_on_ack = 1;
...@@ -1717,7 +1717,7 @@ void readSyncBulkPayload(connection *conn) { ...@@ -1717,7 +1717,7 @@ void readSyncBulkPayload(connection *conn) {
* such case we want just to read the RDB file in memory. */ * such case we want just to read the RDB file in memory. */
serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Flushing old data"); serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Flushing old data");
/* We need to stop any AOF rewriting child before flusing and parsing /* We need to stop any AOF rewriting child before flushing and parsing
* the RDB, otherwise we'll create a copy-on-write disaster. */ * the RDB, otherwise we'll create a copy-on-write disaster. */
if (server.aof_state != AOF_OFF) stopAppendOnly(); if (server.aof_state != AOF_OFF) stopAppendOnly();
...@@ -2408,7 +2408,7 @@ void syncWithMaster(connection *conn) { ...@@ -2408,7 +2408,7 @@ void syncWithMaster(connection *conn) {
server.repl_state = REPL_STATE_SEND_PSYNC; server.repl_state = REPL_STATE_SEND_PSYNC;
} }
/* Try a partial resynchonization. If we don't have a cached master /* Try a partial resynchronization. If we don't have a cached master
* slaveTryPartialResynchronization() will at least try to use PSYNC * slaveTryPartialResynchronization() will at least try to use PSYNC
* to start a full resynchronization so that we get the master replid * to start a full resynchronization so that we get the master replid
* and the global offset, to try a partial resync at the next * and the global offset, to try a partial resync at the next
...@@ -2901,7 +2901,7 @@ void replicationCacheMaster(client *c) { ...@@ -2901,7 +2901,7 @@ void replicationCacheMaster(client *c) {
unlinkClient(c); unlinkClient(c);
/* Reset the master client so that's ready to accept new commands: /* Reset the master client so that's ready to accept new commands:
* we want to discard te non processed query buffers and non processed * we want to discard the non processed query buffers and non processed
* offsets, including pending transactions, already populated arguments, * offsets, including pending transactions, already populated arguments,
* pending outputs to the master. */ * pending outputs to the master. */
sdsclear(server.master->querybuf); sdsclear(server.master->querybuf);
...@@ -2935,13 +2935,13 @@ void replicationCacheMaster(client *c) { ...@@ -2935,13 +2935,13 @@ void replicationCacheMaster(client *c) {
replicationHandleMasterDisconnection(); replicationHandleMasterDisconnection();
} }
/* This function is called when a master is turend into a slave, in order to /* This function is called when a master is turned into a slave, in order to
* create from scratch a cached master for the new client, that will allow * create from scratch a cached master for the new client, that will allow
* to PSYNC with the slave that was promoted as the new master after a * to PSYNC with the slave that was promoted as the new master after a
* failover. * failover.
* *
* Assuming this instance was previously the master instance of the new master, * Assuming this instance was previously the master instance of the new master,
* the new master will accept its replication ID, and potentiall also the * the new master will accept its replication ID, and potential also the
* current offset if no data was lost during the failover. So we use our * current offset if no data was lost during the failover. So we use our
* current replication ID and offset in order to synthesize a cached master. */ * current replication ID and offset in order to synthesize a cached master. */
void replicationCacheMasterUsingMyself(void) { void replicationCacheMasterUsingMyself(void) {
......
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