From 07367df981722fc021e9ac1b5d27e03af5618291 Mon Sep 17 00:00:00 2001 From: Shivshankar Date: Fri, 10 May 2024 15:51:01 -0400 Subject: [PATCH] Update rdb and module's child proc name to valkey accordingly (compatible with redis symlink) (#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 --- src/module.c | 6 +++++- src/rdb.c | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/module.c b/src/module.c index b515b10932..01abd7adfe 100644 --- a/src/module.c +++ b/src/module.c @@ -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 { diff --git a/src/rdb.c b/src/rdb.c index 54f0b070cd..0995907e62 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -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) { @@ -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);