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
[codespell]
quiet-level = 2
count =
skip = ./deps,./src/crc16_slottable.h
ignore-words = ./.github/wordlist.txt
...@@ -14,7 +14,7 @@ Paste the complete crash log between the quotes below. Please include a few line ...@@ -14,7 +14,7 @@ Paste the complete crash log between the quotes below. Please include a few line
``` ```
``` ```
**Aditional information** **Additional information**
1. OS distribution and version 1. OS distribution and version
2. Steps to reproduce (if any) 2. Steps to reproduce (if any)
ake
bale
fle
fo
gameboy
mutli
nd
nees
oll
optin
ot
smove
te
tre
cancelability
\ No newline at end of file
# A CI action that using codespell to check spell.
# .github/.codespellrc is a config file.
# .github/wordlist.txt is a list of words that will ignore word checks.
# More details please check the following link:
# https://github.com/codespell-project/codespell
name: Spellcheck
on:
push:
pull_request:
jobs:
build:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install prerequisites
run: sudo pip install codespell==2.0.0
- name: Spell check
run: codespell --config=./.github/.codespellrc
...@@ -18,7 +18,7 @@ all the support in the mailing list. ...@@ -18,7 +18,7 @@ all the support in the mailing list.
There is also an active community of Redis users at Stack Overflow: There is also an active community of Redis users at Stack Overflow:
http://stackoverflow.com/questions/tagged/redis https://stackoverflow.com/questions/tagged/redis
Issues and pull requests for documentation belong on the redis-doc repo: Issues and pull requests for documentation belong on the redis-doc repo:
...@@ -38,10 +38,10 @@ Here you'll see if there is consensus about your idea. ...@@ -38,10 +38,10 @@ Here you'll see if there is consensus about your idea.
2. If in step 1 you get an acknowledgment from the project leaders, use the 2. If in step 1 you get an acknowledgment from the project leaders, use the
following procedure to submit a patch: following procedure to submit a patch:
a. Fork Redis on github ( http://help.github.com/fork-a-repo/ ) a. Fork Redis on github ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo )
b. Create a topic branch (git checkout -b my_branch) b. Create a topic branch (git checkout -b my_branch)
c. Push to your branch (git push origin my_branch) c. Push to your branch (git push origin my_branch)
d. Initiate a pull request on github ( https://help.github.com/articles/creating-a-pull-request/ ) d. Initiate a pull request on github ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request )
e. Done :) e. Done :)
3. Keep in mind that we are very overloaded, so issues and PRs sometimes wait 3. Keep in mind that we are very overloaded, so issues and PRs sometimes wait
......
...@@ -380,8 +380,8 @@ aof.c and rdb.c ...@@ -380,8 +380,8 @@ aof.c and rdb.c
As you can guess from the names, these files implement the RDB and AOF As you can guess from the names, these files implement the RDB and AOF
persistence for Redis. Redis uses a persistence model based on the `fork()` persistence for Redis. Redis uses a persistence model based on the `fork()`
system call in order to create a thread with the same (shared) memory system call in order to create a process with the same (shared) memory
content of the main Redis thread. This secondary thread dumps the content content of the main Redis process. This secondary process dumps the content
of the memory on disk. This is used by `rdb.c` to create the snapshots of the memory on disk. This is used by `rdb.c` to create the snapshots
on disk and by `aof.c` in order to perform the AOF rewrite when the on disk and by `aof.c` in order to perform the AOF rewrite when the
append only file gets too big. append only file gets too big.
......
...@@ -178,7 +178,7 @@ acllog-max-len 128 ...@@ -178,7 +178,7 @@ acllog-max-len 128
# incoming connections (via ACL), and for outgoing connections (via # incoming connections (via ACL), and for outgoing connections (via
# sentinel-user and sentinel-pass) # sentinel-user and sentinel-pass)
# #
# The requirepass is not compatable with aclfile option and the ACL LOAD # The requirepass is not compatible with aclfile option and the ACL LOAD
# command, these will cause requirepass to be ignored. # command, these will cause requirepass to be ignored.
# sentinel sentinel-user <username> # sentinel sentinel-user <username>
......
...@@ -1363,7 +1363,7 @@ int ACLCheckPubsubPerm(client *c, int idx, int count, int literal, int *idxptr) ...@@ -1363,7 +1363,7 @@ int ACLCheckPubsubPerm(client *c, int idx, int count, int literal, int *idxptr)
} }
/* Check whether the command is ready to be exceuted by ACLCheckCommandPerm. /* Check whether the command is ready to be executed by ACLCheckCommandPerm.
* If check passes, then check whether pub/sub channels of the command is * If check passes, then check whether pub/sub channels of the command is
* ready to be executed by ACLCheckPubsubPerm */ * ready to be executed by ACLCheckPubsubPerm */
int ACLCheckAllPerm(client *c, int *idxptr) { int ACLCheckAllPerm(client *c, int *idxptr) {
...@@ -2254,8 +2254,8 @@ void authCommand(client *c) { ...@@ -2254,8 +2254,8 @@ void authCommand(client *c) {
* will just use "default" as username. */ * will just use "default" as username. */
robj *username, *password; robj *username, *password;
if (c->argc == 2) { if (c->argc == 2) {
/* Mimic the old behavior of giving an error for the two commands /* Mimic the old behavior of giving an error for the two argument
* from if no password is configured. */ * form if no password is configured. */
if (DefaultUser->flags & USER_FLAG_NOPASS) { if (DefaultUser->flags & USER_FLAG_NOPASS) {
addReplyError(c,"AUTH <password> called without any password " addReplyError(c,"AUTH <password> called without any password "
"configured for the default user. Are you sure " "configured for the default user. Are you sure "
......
...@@ -419,7 +419,7 @@ void flushAppendOnlyFile(int force) { ...@@ -419,7 +419,7 @@ void flushAppendOnlyFile(int force) {
* than two seconds this is still ok. Postpone again. */ * than two seconds this is still ok. Postpone again. */
return; return;
} }
/* Otherwise fall trough, and go write since we can't wait /* Otherwise fall through, and go write since we can't wait
* over two seconds. */ * over two seconds. */
server.aof_delayed_fsync++; server.aof_delayed_fsync++;
serverLog(LL_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis."); serverLog(LL_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.");
...@@ -1745,7 +1745,7 @@ int rewriteAppendOnlyFileBackground(void) { ...@@ -1745,7 +1745,7 @@ int rewriteAppendOnlyFileBackground(void) {
server.aof_rewrite_scheduled = 0; server.aof_rewrite_scheduled = 0;
server.aof_rewrite_time_start = time(NULL); server.aof_rewrite_time_start = time(NULL);
/* We set appendseldb to -1 in order to force the next call to the /* We set aof_selected_db to -1 in order to force the next call to the
* feedAppendOnlyFile() to issue a SELECT command, so the differences * feedAppendOnlyFile() to issue a SELECT command, so the differences
* accumulated by the parent into server.aof_rewrite_buf will start * accumulated by the parent into server.aof_rewrite_buf will start
* with a SELECT statement and it will be safe to merge. */ * with a SELECT statement and it will be safe to merge. */
...@@ -1885,7 +1885,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) { ...@@ -1885,7 +1885,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
oldfd = open(server.aof_filename,O_RDONLY|O_NONBLOCK); oldfd = open(server.aof_filename,O_RDONLY|O_NONBLOCK);
} else { } else {
/* AOF enabled */ /* AOF enabled */
oldfd = -1; /* We'll set this to the current AOF filedes later. */ oldfd = -1; /* We'll set this to the current AOF file descriptor later. */
} }
/* Rename the temporary file. This will not unlink the target file if /* Rename the temporary file. This will not unlink the target file if
......
...@@ -472,7 +472,7 @@ int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) { ...@@ -472,7 +472,7 @@ int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) {
return C_OK; return C_OK;
} }
/* This is an helper function for commands implementations that need to write /* This is a helper function for commands implementations that need to write
* bits to a string object. The command creates or pad with zeroes the string * bits to a string object. The command creates or pad with zeroes the string
* so that the 'maxbit' bit can be addressed. The object is finally * so that the 'maxbit' bit can be addressed. The object is finally
* returned. Otherwise if the key holds a wrong type NULL is returned and * returned. Otherwise if the key holds a wrong type NULL is returned and
...@@ -1025,7 +1025,7 @@ void bitfieldGeneric(client *c, int flags) { ...@@ -1025,7 +1025,7 @@ void bitfieldGeneric(client *c, int flags) {
return; return;
} }
/* Lookup by making room up to the farest bit reached by /* Lookup by making room up to the farthest bit reached by
* this operation. */ * this operation. */
if ((o = lookupStringForBitCommand(c, if ((o = lookupStringForBitCommand(c,
highest_write_offset)) == NULL) { highest_write_offset)) == NULL) {
......
...@@ -166,7 +166,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len) ...@@ -166,7 +166,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len)
* *
* Do we still have data that was there prior to our buf? If so, * Do we still have data that was there prior to our buf? If so,
* restore buffer to it's original state and report no new data was * restore buffer to it's original state and report no new data was
* writen. * written.
*/ */
if (sdslen(c->obuf) > buf_len) { if (sdslen(c->obuf) > buf_len) {
sdsrange(c->obuf, 0, -(buf_len+1)); sdsrange(c->obuf, 0, -(buf_len+1));
......
...@@ -16,9 +16,9 @@ typedef struct cliSSLconfig { ...@@ -16,9 +16,9 @@ typedef struct cliSSLconfig {
char *cert; char *cert;
/* Private key file to authenticate with, or NULL */ /* Private key file to authenticate with, or NULL */
char *key; char *key;
/* Prefered cipher list, or NULL (applies only to <= TLSv1.2) */ /* Preferred cipher list, or NULL (applies only to <= TLSv1.2) */
char* ciphers; char* ciphers;
/* Prefered ciphersuites list, or NULL (applies only to TLSv1.3) */ /* Preferred ciphersuites list, or NULL (applies only to TLSv1.3) */
char* ciphersuites; char* ciphersuites;
} cliSSLconfig; } cliSSLconfig;
......
...@@ -1185,7 +1185,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) { ...@@ -1185,7 +1185,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
* CLUSTER nodes blacklist * CLUSTER nodes blacklist
* *
* The nodes blacklist is just a way to ensure that a given node with a given * The nodes blacklist is just a way to ensure that a given node with a given
* Node ID is not readded before some time elapsed (this time is specified * Node ID is not re-added before some time elapsed (this time is specified
* in seconds in CLUSTER_BLACKLIST_TTL). * in seconds in CLUSTER_BLACKLIST_TTL).
* *
* This is useful when we want to remove a node from the cluster completely: * This is useful when we want to remove a node from the cluster completely:
...@@ -4203,7 +4203,7 @@ sds clusterGenNodeDescription(clusterNode *node, int use_pport) { ...@@ -4203,7 +4203,7 @@ sds clusterGenNodeDescription(clusterNode *node, int use_pport) {
"connected" : "disconnected"); "connected" : "disconnected");
/* Slots served by this instance. If we already have slots info, /* Slots served by this instance. If we already have slots info,
* append it diretly, otherwise, generate slots only if it has. */ * append it directly, otherwise, generate slots only if it has. */
if (node->slots_info) { if (node->slots_info) {
ci = sdscatsds(ci, node->slots_info); ci = sdscatsds(ci, node->slots_info);
} else if (node->numslots > 0) { } else if (node->numslots > 0) {
......
...@@ -581,7 +581,7 @@ void loadServerConfigFromString(char *config) { ...@@ -581,7 +581,7 @@ void loadServerConfigFromString(char *config) {
int flags = keyspaceEventsStringToFlags(argv[1]); int flags = keyspaceEventsStringToFlags(argv[1]);
if (flags == -1) { if (flags == -1) {
err = "Invalid event class character. Use 'g$lshzxeA'."; err = "Invalid event class character. Use 'Ag$lshzxeKEtmd'.";
goto loaderr; goto loaderr;
} }
server.notify_keyspace_events = flags; server.notify_keyspace_events = flags;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* of connections from within a handler. * of connections from within a handler.
*/ */
/* Incremenet connection references. /* Increment connection references.
* *
* Inside a connection handler, we guarantee refs >= 1 so it is always * Inside a connection handler, we guarantee refs >= 1 so it is always
* safe to connClose(). * safe to connClose().
......
...@@ -248,7 +248,7 @@ uint16_t crcspeed16big(uint16_t big_table[8][256], uint16_t crc_in, void *buf, ...@@ -248,7 +248,7 @@ uint16_t crcspeed16big(uint16_t big_table[8][256], uint16_t crc_in, void *buf,
/* Return the CRC of buf[0..len-1] with initial crc, processing eight bytes /* Return the CRC of buf[0..len-1] with initial crc, processing eight bytes
at a time using passed-in lookup table. at a time using passed-in lookup table.
This selects one of two routines depending on the endianess of This selects one of two routines depending on the endianness of
the architecture. */ the architecture. */
uint64_t crcspeed64native(uint64_t table[8][256], uint64_t crc, void *buf, uint64_t crcspeed64native(uint64_t table[8][256], uint64_t crc, void *buf,
size_t len) { size_t len) {
......
...@@ -295,7 +295,7 @@ robj *dbRandomKey(redisDb *db) { ...@@ -295,7 +295,7 @@ robj *dbRandomKey(redisDb *db) {
* it could happen that all the keys are already logically * it could happen that all the keys are already logically
* expired in the slave, so the function cannot stop because * expired in the slave, so the function cannot stop because
* expireIfNeeded() is false, nor it can stop because * expireIfNeeded() is false, nor it can stop because
* dictGetRandomKey() returns NULL (there are keys to return). * dictGetFairRandomKey() returns NULL (there are keys to return).
* To prevent the infinite loop we do some tries, but if there * To prevent the infinite loop we do some tries, but if there
* are the conditions for an infinite loop, eventually we * are the conditions for an infinite loop, eventually we
* return a key name that may be already expired. */ * return a key name that may be already expired. */
......
...@@ -1980,7 +1980,7 @@ void disableWatchdog(void) { ...@@ -1980,7 +1980,7 @@ void disableWatchdog(void) {
* of microseconds, i.e. -10 means 100 nanoseconds. */ * of microseconds, i.e. -10 means 100 nanoseconds. */
void debugDelay(int usec) { void debugDelay(int usec) {
/* Since even the shortest sleep results in context switch and system call, /* Since even the shortest sleep results in context switch and system call,
* the way we achive short sleeps is by statistically sleeping less often. */ * the way we achieve short sleeps is by statistically sleeping less often. */
if (usec < 0) usec = (rand() % -usec) == 0 ? 1: 0; if (usec < 0) usec = (rand() % -usec) == 0 ? 1: 0;
if (usec) usleep(usec); if (usec) usleep(usec);
} }
...@@ -133,7 +133,7 @@ void evictionPoolAlloc(void) { ...@@ -133,7 +133,7 @@ void evictionPoolAlloc(void) {
EvictionPoolLRU = ep; EvictionPoolLRU = ep;
} }
/* This is an helper function for performEvictions(), it is used in order /* This is a helper function for performEvictions(), it is used in order
* to populate the evictionPool with a few entries every time we want to * to populate the evictionPool with a few entries every time we want to
* expire a key. Keys with idle time bigger than one of the current * expire a key. Keys with idle time bigger than one of the current
* keys are added. Keys are always added if there are free entries. * keys are added. Keys are always added if there are free entries.
......
...@@ -213,7 +213,7 @@ void addReplyDoubleDistance(client *c, double d) { ...@@ -213,7 +213,7 @@ void addReplyDoubleDistance(client *c, double d) {
* representing a point, and a GeoShape, appends this entry as a geoPoint * representing a point, and a GeoShape, appends this entry as a geoPoint
* into the specified geoArray only if the point is within the search area. * into the specified geoArray only if the point is within the search area.
* *
* returns C_OK if the point is included, or REIDS_ERR if it is outside. */ * returns C_OK if the point is included, or C_ERR if it is outside. */
int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds member) { int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds member) {
double distance = 0, xy[2]; double distance = 0, xy[2];
...@@ -241,10 +241,10 @@ int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds memb ...@@ -241,10 +241,10 @@ int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds memb
} }
/* Query a Redis sorted set to extract all the elements between 'min' and /* Query a Redis sorted set to extract all the elements between 'min' and
* 'max', appending them into the array of geoPoint structures 'gparray'. * 'max', appending them into the array of geoPoint structures 'geoArray'.
* The command returns the number of elements added to the array. * The command returns the number of elements added to the array.
* *
* Elements which are farest than 'radius' from the specified 'x' and 'y' * Elements which are farther than 'radius' from the specified 'x' and 'y'
* coordinates are not included. * coordinates are not included.
* *
* The ability of this function to append to an existing set of points is * The ability of this function to append to an existing set of points is
...@@ -330,7 +330,7 @@ void scoresOfGeoHashBox(GeoHashBits hash, GeoHashFix52Bits *min, GeoHashFix52Bit ...@@ -330,7 +330,7 @@ void scoresOfGeoHashBox(GeoHashBits hash, GeoHashFix52Bits *min, GeoHashFix52Bit
* *
* To get the min score we just use the initial hash value left * To get the min score we just use the initial hash value left
* shifted enough to get the 52 bit value. Later we increment the * shifted enough to get the 52 bit value. Later we increment the
* 6 bit prefis (see the hash.bits++ statement), and get the new * 6 bit prefix (see the hash.bits++ statement), and get the new
* prefix: 101011, which we align again to 52 bits to get the maximum * prefix: 101011, which we align again to 52 bits to get the maximum
* value (which is excluded from the search). So we get everything * value (which is excluded from the search). So we get everything
* between the two following scores (represented in binary): * between the two following scores (represented in binary):
......
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