Skip to content

Commit

Permalink
Merge branch 'unstable' into rdb-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
naglera authored Apr 9, 2024
2 parents 9454ec2 + 03650e9 commit cefd9e2
Show file tree
Hide file tree
Showing 212 changed files with 1,290 additions and 1,233 deletions.
2 changes: 1 addition & 1 deletion deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Redis dependency Makefile
# Dependency Makefile

uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')

Expand Down
8 changes: 4 additions & 4 deletions src/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ typedef struct {
* execute this command.
*
* If the bit for a given command is NOT set and the command has
* allowed first-args, Redis will also check allowed_firstargs in order to
* allowed first-args, the server will also check allowed_firstargs in order to
* understand if the command can be executed. */
uint64_t allowed_commands[USER_COMMAND_BITS_COUNT/64];
/* allowed_firstargs is used by ACL rules to block access to a command unless a
Expand Down Expand Up @@ -502,7 +502,7 @@ void ACLFreeUserAndKillClients(user *u) {
if (c->user == u) {
/* We'll free the connection asynchronously, so
* in theory to set a different user is not needed.
* However if there are bugs in Redis, soon or later
* However if there are bugs in the server, soon or later
* this may result in some security hole: it's much
* more defensive to set the default user and put
* it in non authenticated mode. */
Expand Down Expand Up @@ -1023,7 +1023,7 @@ aclSelector *aclCreateSelectorFromOpSet(const char *opset, size_t opsetlen) {
* +@<category> Allow the execution of all the commands in such category
* with valid categories are like @admin, @set, @sortedset, ...
* and so forth, see the full list in the server.c file where
* the Redis command table is described and defined.
* the command table is described and defined.
* The special category @all means all the commands, but currently
* present in the server, and that will be loaded in the future
* via modules.
Expand Down Expand Up @@ -3204,7 +3204,7 @@ void addReplyCommandCategories(client *c, struct serverCommand *cmd) {
}

/* AUTH <password>
* AUTH <username> <password> (Redis >= 6.0 form)
* AUTH <username> <password> (Redis OSS >= 6.0 form)
*
* When the user is omitted it means that we are trying to authenticate
* against the default user. */
Expand Down
2 changes: 1 addition & 1 deletion src/ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id)
* If there are no timers, -1 is returned.
*
* Note that's O(N) since time events are unsorted.
* Possible optimizations (not needed by Redis so far, but...):
* Possible optimizations (not needed so far, but...):
* 1) Insert the event in order, so that the nearest is just the head.
* Much better but still insertion or deletion of timers is O(N).
* 2) Use a skiplist to have this operation as O(1) and insertion as O(log(N)).
Expand Down
4 changes: 2 additions & 2 deletions src/anet.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ int anetResolve(char *err, char *host, char *ipbuf, size_t ipbuf_len,

static int anetSetReuseAddr(char *err, int fd) {
int yes = 1;
/* Make sure connection-intensive things like the redis benchmark
/* Make sure connection-intensive things like the benchmark tool
* will be able to close/open sockets a zillion of times */
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) {
anetSetError(err, "setsockopt SO_REUSEADDR: %s", strerror(errno));
Expand All @@ -388,7 +388,7 @@ static int anetCreateSocket(char *err, int domain) {
return ANET_ERR;
}

/* Make sure connection-intensive things like the redis benchmark
/* Make sure connection-intensive things like the benchmark tool
* will be able to close/open sockets a zillion of times */
if (anetSetReuseAddr(err,s) == ANET_ERR) {
close(s);
Expand Down
38 changes: 19 additions & 19 deletions src/aof.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ void aof_background_fsync_and_close(int fd);
*
* Append-only files consist of three types:
*
* BASE: Represents a Redis snapshot from the time of last AOF rewrite. The manifest
* BASE: Represents a server snapshot from the time of last AOF rewrite. The manifest
* file contains at most a single BASE file, which will always be the first file in the
* list.
*
* INCR: Represents all write commands executed by Redis following the last successful
* INCR: Represents all write commands executed by the server following the last successful
* AOF rewrite. In some cases it is possible to have several ordered INCR files. For
* example:
* - During an on-going AOF rewrite
Expand Down Expand Up @@ -119,7 +119,7 @@ aofInfo *aofInfoDup(aofInfo *orig) {

/* Format aofInfo as a string and it will be a line in the manifest.
*
* When update this format, make sure to update redis-check-aof as well. */
* When update this format, make sure to update valkey-check-aof as well. */
sds aofInfoFormat(sds buf, aofInfo *ai) {
sds filename_repr = NULL;

Expand Down Expand Up @@ -222,10 +222,10 @@ sds getAofManifestAsString(aofManifest *am) {
}

/* Load the manifest information from the disk to `server.aof_manifest`
* when the Redis server start.
* when the server starts.
*
* During loading, this function does strict error checking and will abort
* the entire Redis server process on error (I/O error, invalid format, etc.)
* the entire server process on error (I/O error, invalid format, etc.)
*
* If the AOF directory or manifest file do not exist, this will be ignored
* in order to support seamless upgrades from previous versions which did not
Expand Down Expand Up @@ -253,7 +253,7 @@ void aofLoadManifestFromDisk(void) {
sdsfree(am_filepath);
}

/* Generic manifest loading function, used in `aofLoadManifestFromDisk` and redis-check-aof tool. */
/* Generic manifest loading function, used in `aofLoadManifestFromDisk` and valkey-check-aof tool. */
#define MANIFEST_MAX_LINE 1024
aofManifest *aofLoadManifestFromFile(sds am_filepath) {
const char *err = NULL;
Expand Down Expand Up @@ -609,15 +609,15 @@ int persistAofManifest(aofManifest *am) {
return ret;
}

/* Called in `loadAppendOnlyFiles` when we upgrade from a old version redis.
/* Called in `loadAppendOnlyFiles` when we upgrade from a old version of the server.
*
* 1) Create AOF directory use 'server.aof_dirname' as the name.
* 2) Use 'server.aof_filename' to construct a BASE type aofInfo and add it to
* aofManifest, then persist the manifest file to AOF directory.
* 3) Move the old AOF file (server.aof_filename) to AOF directory.
*
* If any of the above steps fails or crash occurs, this will not cause any
* problems, and redis will retry the upgrade process when it restarts.
* problems, and the server will retry the upgrade process when it restarts.
*/
void aofUpgradePrepare(aofManifest *am) {
serverAssert(!aofFileExist(server.aof_filename));
Expand Down Expand Up @@ -704,13 +704,13 @@ void aofDelTempIncrAofFile(void) {
return;
}

/* Called after `loadDataFromDisk` when redis start. If `server.aof_state` is
/* Called after `loadDataFromDisk` when the server starts. If `server.aof_state` is
* 'AOF_ON', It will do three things:
* 1. Force create a BASE file when redis starts with an empty dataset
* 1. Force create a BASE file when the server starts with an empty dataset
* 2. Open the last opened INCR type AOF for writing, If not, create a new one
* 3. Synchronously update the manifest file to the disk
*
* If any of the above steps fails, the redis process will exit.
* If any of the above steps fails, the server process will exit.
*/
void aofOpenIfNeededOnServerStart(void) {
if (server.aof_state != AOF_ON) {
Expand Down Expand Up @@ -856,7 +856,7 @@ int openNewIncrAofForAppend(void) {

/* Whether to limit the execution of Background AOF rewrite.
*
* At present, if AOFRW fails, redis will automatically retry. If it continues
* At present, if AOFRW fails, the server will automatically retry. If it continues
* to fail, we may get a lot of very small INCR files. so we need an AOFRW
* limiting measure.
*
Expand Down Expand Up @@ -1371,7 +1371,7 @@ void feedAppendOnlyFile(int dictid, robj **argv, int argc) {
* AOF loading
* ------------------------------------------------------------------------- */

/* In Redis commands are always executed in the context of a client, so in
/* Commands are always executed in the context of a client, so in
* order to load the append only file we need to create a fake client. */
struct client *createAOFClient(void) {
struct client *c = createClient(NULL);
Expand All @@ -1390,7 +1390,7 @@ struct client *createAOFClient(void) {
c->flags = CLIENT_DENY_BLOCKING;

/* We set the fake client as a slave waiting for the synchronization
* so that Redis will not try to send replies to this client. */
* so that the server will not try to send replies to this client. */
c->replstate = SLAVE_STATE_WAIT_BGSAVE_START;
return c;
}
Expand Down Expand Up @@ -1664,7 +1664,7 @@ int loadAppendOnlyFiles(aofManifest *am) {
int total_num, aof_num = 0, last_file;

/* If the 'server.aof_filename' file exists in dir, we may be starting
* from an old redis version. We will use enter upgrade mode in three situations.
* from an old server version. We will use enter upgrade mode in three situations.
*
* 1. If the 'server.aof_dirname' directory not exist
* 2. If the 'server.aof_dirname' directory exists but the manifest file is missing
Expand Down Expand Up @@ -1954,7 +1954,7 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) {
}

/* Write either the key or the value of the currently selected item of a hash.
* The 'hi' argument passes a valid Redis hash iterator.
* The 'hi' argument passes a valid hash iterator.
* The 'what' filed specifies if to write a key or a value and can be
* either OBJ_HASH_KEY or OBJ_HASH_VALUE.
*
Expand Down Expand Up @@ -2208,7 +2208,7 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) {
}

/* Call the module type callback in order to rewrite a data type
* that is exported by a module and is not handled by Redis itself.
* that is exported by a module and is not handled by the server itself.
* The function returns 0 on error, 1 on success. */
int rewriteModuleObject(rio *r, robj *key, robj *o, int dbid) {
ValkeyModuleIO io;
Expand Down Expand Up @@ -2347,7 +2347,7 @@ int rewriteAppendOnlyFileRio(rio *aof) {
* "filename". Used both by REWRITEAOF and BGREWRITEAOF.
*
* In order to minimize the number of commands needed in the rewritten
* log Redis uses variadic commands when possible, such as RPUSH, SADD
* log, the server uses variadic commands when possible, such as RPUSH, SADD
* and ZADD. However at max AOF_REWRITE_ITEMS_PER_CMD items per time
* are inserted using a single command. */
int rewriteAppendOnlyFile(char *filename) {
Expand Down Expand Up @@ -2419,7 +2419,7 @@ int rewriteAppendOnlyFile(char *filename) {
/* This is how rewriting of the append only file in background works:
*
* 1) The user calls BGREWRITEAOF
* 2) Redis calls this function, that forks():
* 2) The server calls this function, that forks():
* 2a) the child rewrite the append only file in a temp file.
* 2b) the parent open a new INCR AOF file to continue writing.
* 3) When the child finished '2a' exists.
Expand Down
4 changes: 2 additions & 2 deletions src/atomicvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@
/* Define serverAtomic for atomic variable. */
#define serverAtomic

/* To test Redis with Helgrind (a Valgrind tool) it is useful to define
/* To test the server with Helgrind (a Valgrind tool) it is useful to define
* the following macro, so that __sync macros are used: those can be detected
* by Helgrind (even if they are less efficient) so that no false positive
* is reported. */
// #define __ATOMIC_VAR_FORCE_SYNC_MACROS

/* There will be many false positives if we test Redis with Helgrind, since
/* There will be many false positives if we test the server with Helgrind, since
* Helgrind can't understand we have imposed ordering on the program, so
* we use macros in helgrind.h to tell Helgrind inter-thread happens-before
* relationship explicitly for avoiding false positives.
Expand Down
6 changes: 3 additions & 3 deletions src/bio.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Background I/O service for Redis.
/* Background I/O service for the server.
*
* This file implements operations that we need to perform in the background.
* Currently there is only a single operation, that is a background close(2)
Expand All @@ -8,7 +8,7 @@
*
* In the future we'll either continue implementing new things we need or
* we'll switch to libeio. However there are probably long term uses for this
* file as we may want to put here Redis specific background tasks (for instance
* file as we may want to put here server specific background tasks (for instance
* it is not impossible that we'll need a non blocking FLUSHDB/FLUSHALL
* implementation).
*
Expand Down Expand Up @@ -323,7 +323,7 @@ void bioDrainWorker(int job_type) {

/* Kill the running bio threads in an unclean way. This function should be
* used only when it's critical to stop the threads for some reason.
* Currently Redis does this only on crash (for instance on SIGSEGV) in order
* Currently the server does this only on crash (for instance on SIGSEGV) in order
* to perform a fast memory check without other threads messing with memory. */
void bioKillThreads(void) {
int err;
Expand Down
4 changes: 2 additions & 2 deletions src/bitops.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void printBits(unsigned char *p, unsigned long count) {

/* This helper function used by GETBIT / SETBIT parses the bit offset argument
* making sure an error is returned if it is negative or if it overflows
* Redis 512 MB limit for the string value or more (server.proto_max_bulk_len).
* the server's 512 MB limit for the string value or more (server.proto_max_bulk_len).
*
* If the 'hash' argument is true, and 'bits is positive, then the command
* will also parse bit offsets prefixed by "#". In such a case the offset
Expand Down Expand Up @@ -443,7 +443,7 @@ int getBitOffsetFromArgument(client *c, robj *o, uint64_t *offset, int hash, int
/* This helper function for BITFIELD parses a bitfield type in the form
* <sign><bits> where sign is 'u' or 'i' for unsigned and signed, and
* the bits is a value between 1 and 64. However 64 bits unsigned integers
* are reported as an error because of current limitations of Redis protocol
* are reported as an error because of current limitations of RESP
* to return unsigned integer values greater than INT64_MAX.
*
* On error C_ERR is returned and an error is sent to the client. */
Expand Down
4 changes: 2 additions & 2 deletions src/blocked.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void disconnectAllBlockedClients(void) {
}
}

/* This function should be called by Redis every time a single command,
/* This function should be called by the server every time a single command,
* a MULTI/EXEC block, or a Lua script, terminated its execution after
* being called by a client. It handles serving clients blocked in all scenarios
* where a specific key access requires to block until that key is available.
Expand All @@ -310,7 +310,7 @@ void disconnectAllBlockedClients(void) {
* do client side, indeed!). Because mismatching clients (blocking for
* a different type compared to the current key type) are moved in the
* other side of the linked list. However as long as the key starts to
* be used only for a single type, like virtually any Redis application will
* be used only for a single type, like virtually any application will
* do, the function is already fair. */
void handleClientsBlockedOnKeys(void) {

Expand Down
2 changes: 1 addition & 1 deletion src/call_reply.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ list *callReplyDeferredErrorList(CallReply *rep) {
* callReplyGetPrivateData().
*
* NOTE: The parser used for parsing the reply and producing CallReply is
* designed to handle valid replies created by Redis itself. IT IS NOT
* designed to handle valid replies created by the server itself. IT IS NOT
* DESIGNED TO HANDLE USER INPUT and using it to parse invalid replies is
* unsafe.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/cli_commands.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* This file is used by redis-cli in place of server.h when including commands.c
/* This file is used by valkey-cli in place of server.h when including commands.c
* It contains alternative structs which omit the parts of the commands table
* that are not suitable for redis-cli, e.g. the command proc. */
* that are not suitable for valkey-cli, e.g. the command proc. */

#ifndef VALKEY_CLI_COMMANDS_H
#define VALKEY_CLI_COMMANDS_H
Expand Down
12 changes: 6 additions & 6 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/*
* cluster.c contains the common parts of a clustering
* implementation, the parts that are shared between
* any implementation of Redis clustering.
* any implementation of clustering.
*/

#include "server.h"
Expand Down Expand Up @@ -142,7 +142,7 @@ void createDumpPayload(rio *payload, robj *o, robj *key, int dbid) {
payload->io.buffer.ptr = sdscatlen(payload->io.buffer.ptr,&crc,8);
}

/* Verify that the RDB version of the dump payload matches the one of this Redis
/* Verify that the RDB version of the dump payload matches the one of this
* instance and that the checksum is ok.
* If the DUMP payload looks valid C_OK is returned, otherwise C_ERR
* is returned. If rdbver_ptr is not NULL, its populated with the value read
Expand Down Expand Up @@ -173,7 +173,7 @@ int verifyDumpPayload(unsigned char *p, size_t len, uint16_t *rdbver_ptr) {
}

/* DUMP keyname
* DUMP is actually not used by Redis Cluster but it is the obvious
* DUMP is actually not used by Cluster but it is the obvious
* complement of RESTORE and can be useful for different applications. */
void dumpCommand(client *c) {
robj *o;
Expand Down Expand Up @@ -687,7 +687,7 @@ void migrateCommand(client *c) {
if (!copy) {
/* Translate MIGRATE as DEL for replication/AOF. Note that we do
* this only for the keys for which we received an acknowledgement
* from the receiving Redis server, by using the del_idx index. */
* from the receiving server, by using the del_idx index. */
if (del_idx > 1) {
newargv[0] = createStringObject("DEL",3);
/* Note that the following call takes ownership of newargv. */
Expand Down Expand Up @@ -1007,7 +1007,7 @@ clusterNode *getNodeByQuery(client *c, struct serverCommand *cmd, robj **argv, i
/* Set error code optimistically for the base case. */
if (error_code) *error_code = CLUSTER_REDIR_NONE;

/* Modules can turn off Redis Cluster redirection: this is useful
/* Modules can turn off Cluster redirection: this is useful
* when writing a module that implements a completely different
* distributed system. */

Expand Down Expand Up @@ -1446,7 +1446,7 @@ void clusterCommandSlots(client * c) {

/* The ASKING command is required after a -ASK redirection.
* The client should issue ASKING before to actually send the command to
* the target instance. See the Redis Cluster specification for more
* the target instance. See the Cluster specification for more
* information. */
void askingCommand(client *c) {
if (server.cluster_enabled == 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __CLUSTER_H

/*-----------------------------------------------------------------------------
* Redis cluster exported API.
* Cluster exported API.
*----------------------------------------------------------------------------*/

#define CLUSTER_SLOT_MASK_BITS 14 /* Number of bits used for slot id. */
Expand All @@ -25,9 +25,9 @@
typedef struct _clusterNode clusterNode;
struct clusterState;

/* Flags that a module can set in order to prevent certain Redis Cluster
/* Flags that a module can set in order to prevent certain Cluster
* features to be enabled. Useful when implementing a different distributed
* system on top of Redis Cluster message bus, using modules. */
* system on top of Cluster message bus, using modules. */
#define CLUSTER_MODULE_FLAG_NONE 0
#define CLUSTER_MODULE_FLAG_NO_FAILOVER (1<<1)
#define CLUSTER_MODULE_FLAG_NO_REDIRECTION (1<<2)
Expand Down
Loading

0 comments on commit cefd9e2

Please sign in to comment.