mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
ROLE output improved for slaves.
Info about the replication state with the master added.
This commit is contained in:
parent
d34c2fa3bb
commit
6a13193d8f
@ -1353,11 +1353,23 @@ void roleCommand(redisClient *c) {
|
||||
}
|
||||
setDeferredMultiBulkLength(c,mbcount,slaves);
|
||||
} else {
|
||||
char *slavestate = NULL;
|
||||
|
||||
addReplyMultiBulkLen(c,4);
|
||||
addReplyBulkCBuffer(c,"slave",5);
|
||||
addReplyBulkCString(c,server.masterhost);
|
||||
addReplyLongLong(c,server.masterport);
|
||||
addReplyLongLong(c,server.master->reploff);
|
||||
switch(server.repl_state) {
|
||||
case REDIS_REPL_NONE: slavestate = "none"; break;
|
||||
case REDIS_REPL_CONNECT: slavestate = "connect"; break;
|
||||
case REDIS_REPL_CONNECTING: slavestate = "connecting"; break;
|
||||
case REDIS_REPL_RECEIVE_PONG: /* see next */
|
||||
case REDIS_REPL_TRANSFER: slavestate = "sync"; break;
|
||||
case REDIS_REPL_CONNECTED: slavestate = "connected"; break;
|
||||
default: slavestate = "unknown"; break;
|
||||
}
|
||||
addReplyBulkCString(c,slavestate);
|
||||
addReplyLongLong(c,server.master ? server.master->reploff : -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user