Skip to content

Commit

Permalink
Update rdb and module's child proc name to valkey accordingly (compat…
Browse files Browse the repository at this point in the history
…ible with redis symlink) (valkey-io#454)

If `valkey-server` was started with the `redis-server` symlink, the old
proc names are used, for backwards compatibility.

---------

Signed-off-by: Shivshankar-Reddy <[email protected]>
  • Loading branch information
Shivshankar-Reddy authored and srgsanky committed May 19, 2024
1 parent 528c28f commit 8ab0bdc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -11253,7 +11253,11 @@ int VM_Fork(ValkeyModuleForkDoneHandler cb, void *user_data) {

if ((childpid = serverFork(CHILD_TYPE_MODULE)) == 0) {
/* Child */
serverSetProcTitle("redis-module-fork");
if (strstr(server.exec_argv[0],"redis-server") != NULL) {
serverSetProcTitle("redis-module-fork");
} else {
serverSetProcTitle("valkey-module-fork");
}
} else if (childpid == -1) {
serverLog(LL_WARNING,"Can't fork for module: %s", strerror(errno));
} else {
Expand Down
13 changes: 10 additions & 3 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,11 @@ int rdbSaveBackground(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) {
int retval;

/* Child */
serverSetProcTitle("redis-rdb-bgsave");
if (strstr(server.exec_argv[0],"redis-server") != NULL) {
serverSetProcTitle("redis-rdb-bgsave");
} else {
serverSetProcTitle("valkey-rdb-bgsave");
}
serverSetCpuAffinity(server.bgsave_cpulist);
retval = rdbSave(req, filename,rsi,rdbflags);
if (retval == C_OK) {
Expand Down Expand Up @@ -3596,8 +3600,11 @@ int rdbSaveToSlavesSockets(int req, rdbSaveInfo *rsi) {
/* Close the reading part, so that if the parent crashes, the child will
* get a write error and exit. */
close(server.rdb_pipe_read);

serverSetProcTitle("redis-rdb-to-slaves");
if (strstr(server.exec_argv[0],"redis-server") != NULL) {
serverSetProcTitle("redis-rdb-to-slaves");
} else {
serverSetProcTitle("valkey-rdb-to-replicas");
}
serverSetCpuAffinity(server.bgsave_cpulist);

retval = rdbSaveRioWithEOFMark(req,&rdb,NULL,rsi);
Expand Down

0 comments on commit 8ab0bdc

Please sign in to comment.