Commit 6a1bf07a authored by antirez's avatar antirez
Browse files

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.
parent 65a9740f
...@@ -329,6 +329,8 @@ void debugCommand(client *c) { ...@@ -329,6 +329,8 @@ void debugCommand(client *c) {
"structsize -- Return the size of different Redis core C structures."); "structsize -- Return the size of different Redis core C structures.");
blen++; addReplyStatus(c, blen++; addReplyStatus(c,
"htstats <dbid> -- Return hash table statistics of the specified Redis database."); "htstats <dbid> -- 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); setDeferredMultiBulkLength(c,blenp,blen);
} else if (!strcasecmp(c->argv[1]->ptr,"segfault")) { } else if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
*((char*)-1) = 'x'; *((char*)-1) = 'x';
...@@ -570,6 +572,11 @@ void debugCommand(client *c) { ...@@ -570,6 +572,11 @@ void debugCommand(client *c) {
stats = sdscat(stats,buf); stats = sdscat(stats,buf);
addReplyBulkSds(c,stats); 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 { } else {
addReplyErrorFormat(c, "Unknown DEBUG subcommand or wrong number of arguments for '%s'", addReplyErrorFormat(c, "Unknown DEBUG subcommand or wrong number of arguments for '%s'",
(char*)c->argv[1]->ptr); (char*)c->argv[1]->ptr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment