Merge pull request #5153 from trevor211/fixLuaScript

Consider aof write error as well as rdb in lua script.
This commit is contained in:
Salvatore Sanfilippo 2018-07-30 18:10:06 +02:00 committed by GitHub
commit ac3c012a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,11 +493,21 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
{
luaPushError(lua, shared.roslaveerr->ptr);
goto cleanup;
} else if (server.stop_writes_on_bgsave_err &&
server.saveparamslen > 0 &&
server.lastbgsave_status == C_ERR)
} else if ((server.stop_writes_on_bgsave_err &&
server.saveparamslen > 0 &&
server.lastbgsave_status == C_ERR) ||
(server.aof_state != AOF_OFF &&
server.aof_last_write_status == C_ERR))
{
luaPushError(lua, shared.bgsaveerr->ptr);
if (server.aof_last_write_status == C_OK) {
luaPushError(lua, shared.bgsaveerr->ptr);
} else {
sds aof_write_err = sdscatfmt(sdsempty(),
"-MISCONF Errors writing to the AOF file: %s\r\n",
strerror(server.aof_last_write_errno));
luaPushError(lua, aof_write_err);
sdsfree(aof_write_err);
}
goto cleanup;
}
}