Commit 0b08d648 authored by antirez's avatar antirez
Browse files

Use specific error if master is down and slave-serve-stale-data is set to no.

We used to reply -ERR ... message ..., now the reply is
instead -MASTERDOWN ... message ... so that it can be distinguished
easily by the other error conditions.
parent 96d9c6cb
...@@ -970,6 +970,8 @@ void createSharedObjects(void) { ...@@ -970,6 +970,8 @@ void createSharedObjects(void) {
"-LOADING Redis is loading the dataset in memory\r\n")); "-LOADING Redis is loading the dataset in memory\r\n"));
shared.slowscripterr = createObject(REDIS_STRING,sdsnew( shared.slowscripterr = createObject(REDIS_STRING,sdsnew(
"-BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n")); "-BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n"));
shared.masterdownerr = createObject(REDIS_STRING,sdsnew(
"-MASTERDOWN Link with MASTER is down and slave-serve-stale-data is set to 'no'.\r\n"));
shared.bgsaveerr = createObject(REDIS_STRING,sdsnew( shared.bgsaveerr = createObject(REDIS_STRING,sdsnew(
"-MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.\r\n")); "-MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.\r\n"));
shared.roslaveerr = createObject(REDIS_STRING,sdsnew( shared.roslaveerr = createObject(REDIS_STRING,sdsnew(
...@@ -1541,8 +1543,7 @@ int processCommand(redisClient *c) { ...@@ -1541,8 +1543,7 @@ int processCommand(redisClient *c) {
server.repl_serve_stale_data == 0 && server.repl_serve_stale_data == 0 &&
c->cmd->proc != infoCommand && c->cmd->proc != slaveofCommand) c->cmd->proc != infoCommand && c->cmd->proc != slaveofCommand)
{ {
addReplyError(c, addReply(c, shared.masterdownerr);
"link with MASTER is down and slave-serve-stale-data is set to no");
return REDIS_OK; return REDIS_OK;
} }
......
...@@ -366,7 +366,8 @@ struct sharedObjectsStruct { ...@@ -366,7 +366,8 @@ struct sharedObjectsStruct {
*colon, *nullbulk, *nullmultibulk, *queued, *colon, *nullbulk, *nullmultibulk, *queued,
*emptymultibulk, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr, *emptymultibulk, *wrongtypeerr, *nokeyerr, *syntaxerr, *sameobjecterr,
*outofrangeerr, *noscripterr, *loadingerr, *slowscripterr, *bgsaveerr, *outofrangeerr, *noscripterr, *loadingerr, *slowscripterr, *bgsaveerr,
*roslaveerr, *oomerr, *plus, *messagebulk, *pmessagebulk, *subscribebulk, *masterdownerr, *roslaveerr,
*oomerr, *plus, *messagebulk, *pmessagebulk, *subscribebulk,
*unsubscribebulk, *psubscribebulk, *punsubscribebulk, *del, *rpop, *lpop, *unsubscribebulk, *psubscribebulk, *punsubscribebulk, *del, *rpop, *lpop,
*select[REDIS_SHARED_SELECT_CMDS], *select[REDIS_SHARED_SELECT_CMDS],
*integers[REDIS_SHARED_INTEGERS], *integers[REDIS_SHARED_INTEGERS],
......
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