Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
2f4240b9
Commit
2f4240b9
authored
Mar 22, 2015
by
antirez
Browse files
Cluster: fix Lua scripts replication to slave nodes.
parent
94030fa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
2f4240b9
...
@@ -2199,6 +2199,8 @@ int processCommand(redisClient *c) {
...
@@ -2199,6 +2199,8 @@ int processCommand(redisClient *c) {
* 2) The command has no key arguments. */
* 2) The command has no key arguments. */
if
(
server
.
cluster_enabled
&&
if
(
server
.
cluster_enabled
&&
!
(
c
->
flags
&
REDIS_MASTER
)
&&
!
(
c
->
flags
&
REDIS_MASTER
)
&&
!
(
c
->
flags
&
REDIS_LUA_CLIENT
&&
server
.
lua_caller
->
flags
&
REDIS_MASTER
)
&&
!
(
c
->
cmd
->
getkeys_proc
==
NULL
&&
c
->
cmd
->
firstkey
==
0
))
!
(
c
->
cmd
->
getkeys_proc
==
NULL
&&
c
->
cmd
->
firstkey
==
0
))
{
{
int
hashslot
;
int
hashslot
;
...
...
src/scripting.c
View file @
2f4240b9
...
@@ -357,8 +357,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
...
@@ -357,8 +357,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
if
(
cmd
->
flags
&
REDIS_CMD_WRITE
)
server
.
lua_write_dirty
=
1
;
if
(
cmd
->
flags
&
REDIS_CMD_WRITE
)
server
.
lua_write_dirty
=
1
;
/* If this is a Redis Cluster node, we need to make sure Lua is not
/* If this is a Redis Cluster node, we need to make sure Lua is not
* trying to access non-local keys. */
* trying to access non-local keys, with the exception of commands
if
(
server
.
cluster_enabled
)
{
* received from our master. */
if
(
server
.
cluster_enabled
&&
!
(
server
.
lua_caller
->
flags
&
REDIS_MASTER
))
{
/* Duplicate relevant flags in the lua client. */
/* Duplicate relevant flags in the lua client. */
c
->
flags
&=
~
(
REDIS_READONLY
|
REDIS_ASKING
);
c
->
flags
&=
~
(
REDIS_READONLY
|
REDIS_ASKING
);
c
->
flags
|=
server
.
lua_caller
->
flags
&
(
REDIS_READONLY
|
REDIS_ASKING
);
c
->
flags
|=
server
.
lua_caller
->
flags
&
(
REDIS_READONLY
|
REDIS_ASKING
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment