Skip to content

Commit

Permalink
Change Redis to Valkey in log messages (valkey-io#226)
Browse files Browse the repository at this point in the history
Log messages containing "Redis" in some files are changed.

Add macro SERVER_TITLE defined to "Valkey" (uppercase V) is introduced
and used in log messages, so at least it will be easy to patch this
definition to get Redis or any other name in the logs instead of Valkey.

Change "Redis" in some log messages to use %s and SERVER_TITLE.

This is a partial implementation of
valkey-io#207

---------

Signed-off-by: 0del <[email protected]>
  • Loading branch information
9bany authored Apr 17, 2024
1 parent 5d23f8f commit 96d14fe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,11 +2572,11 @@ int ACLSaveToFile(const char *filename) {
void ACLLoadUsersAtStartup(void) {
if (server.acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
serverLog(LL_WARNING,
"Configuring Redis with users defined in redis.conf and at "
"Configuring %s with users defined in valkey.conf and at "
"the same setting an ACL file path is invalid. This setup "
"is very likely to lead to configuration errors and security "
"holes, please define either an ACL file or declare users "
"directly in your redis.conf, but not both.");
"directly in your valkey.conf, but not both.", SERVER_TITLE);
exit(1);
}

Expand All @@ -2590,7 +2590,7 @@ void ACLLoadUsersAtStartup(void) {
sds errors = ACLLoadFromFile(server.acl_filename);
if (errors) {
serverLog(LL_WARNING,
"Aborting Redis startup because of ACL errors: %s", errors);
"Aborting %s startup because of ACL errors: %s", SERVER_TITLE, errors);
sdsfree(errors);
exit(1);
}
Expand Down
10 changes: 5 additions & 5 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ int clusterLockConfig(char *filename) {
if (errno == EWOULDBLOCK) {
serverLog(LL_WARNING,
"Sorry, the cluster configuration file %s is already used "
"by a different Redis Cluster node. Please make sure that "
"by a different Cluster node. Please make sure that "
"different nodes use different cluster configuration "
"files.", filename);
} else {
Expand Down Expand Up @@ -1011,10 +1011,10 @@ void clusterInit(void) {
* us from trying to use a too-high cluster port number. */
int port = defaultClientPort();
if (!server.cluster_port && port > (65535-CLUSTER_PORT_INCR)) {
serverLog(LL_WARNING, "Redis port number too high. "
serverLog(LL_WARNING, "%s port number too high. "
"Cluster communication port is 10,000 port "
"numbers higher than your Redis port. "
"Your Redis port number must be 55535 or less.");
"numbers higher than your %s port. "
"Your %s port number must be 55535 or less.", SERVER_TITLE, SERVER_TITLE, SERVER_TITLE);
exit(1);
}
if (!server.bindaddr_count) {
Expand Down Expand Up @@ -1055,7 +1055,7 @@ void clusterInitLast(void) {
}

if (createSocketAcceptHandler(&server.clistener, clusterAcceptHandler) != C_OK) {
serverPanic("Unrecoverable error creating Redis Cluster socket accept handler.");
serverPanic("Unrecoverable error creating Cluster socket accept handler.");
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ int ldbStartSession(client *c) {
/* Log the creation of the child and close the listening
* socket to make sure if the parent crashes a reset is sent
* to the clients. */
serverLog(LL_NOTICE,"Redis forked for debugging eval");
serverLog(LL_NOTICE,"%s forked for debugging eval", SERVER_TITLE);
} else {
/* Parent */
listAddNodeTail(ldb.children,(void*)(unsigned long)cp);
Expand All @@ -897,7 +897,7 @@ int ldbStartSession(client *c) {
}
} else {
serverLog(LL_NOTICE,
"Redis synchronous debugging eval session started");
"%s synchronous debugging eval session started", SERVER_TITLE);
}

/* Setup our debugging session. */
Expand Down Expand Up @@ -934,7 +934,7 @@ void ldbEndSession(client *c) {
exitFromChild(0);
} else {
serverLog(LL_NOTICE,
"Redis synchronous debugging eval session ended");
"%s synchronous debugging eval session ended", SERVER_TITLE);
}

/* Otherwise let's restore client's state. */
Expand Down
5 changes: 5 additions & 0 deletions src/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/* These macros are used where the server name is printed in logs and replies.
* Note the difference in the first letter "V" vs "v". SERVER_TITLE is used in
* readable text like log messages and SERVER_NAME is used in INFO fields and
* similar. */
#define SERVER_NAME "valkey"
#define SERVER_TITLE "Valkey"
#define VALKEY_VERSION "255.255.255"
#define VALKEY_VERSION_NUM 0x00ffffff

Expand Down

0 comments on commit 96d14fe

Please sign in to comment.