From d6c70f22cd1a2d9b96e761183ef4dd0ab42fd310 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 4 Dec 2017 10:24:52 +0100 Subject: [PATCH] DEBUG change-repl-id implemented. With PSYNC2 to force a full SYNC in tests is hard. With this new DEBUG subcommand we just need to call it and then CLIENT KILL TYPE master in the slave. --- src/debug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/debug.c b/src/debug.c index 5c3fd3471..2b3d51fcc 100644 --- a/src/debug.c +++ b/src/debug.c @@ -308,6 +308,8 @@ void debugCommand(client *c) { "structsize -- Return the size of different Redis core C structures."); blen++; addReplyStatus(c, "htstats -- Return hash table statistics of the specified Redis database."); + blen++; addReplyStatus(c, + "change-repl-id -- Change the replication IDs of the instance. Dangerous, should be used only for testing the replication subsystem."); setDeferredMultiBulkLength(c,blenp,blen); } else if (!strcasecmp(c->argv[1]->ptr,"segfault")) { *((char*)-1) = 'x'; @@ -549,6 +551,11 @@ void debugCommand(client *c) { stats = sdscat(stats,buf); addReplyBulkSds(c,stats); + } else if (!strcasecmp(c->argv[1]->ptr,"change-repl-id") && c->argc == 2) { + serverLog(LL_WARNING,"Changing replication IDs after receiving DEBUG change-repl-id"); + changeReplicationId(); + clearReplicationId2(); + addReply(c,shared.ok); } else { addReplyErrorFormat(c, "Unknown DEBUG subcommand or wrong number of arguments for '%s'", (char*)c->argv[1]->ptr);