null will be return. Lua script that will be executed:
local allpks=redis.pcall('SORT', 'model', 'BY', 'model' .. ':a:*->' .. 'id', 'DESC')
if allpks['err'] then
allpks=redis.pcall('SORT', 'model', 'BY', 'model' .. ':a:*->' .. 'id', 'DESC', 'ALPHA')
end
local pks={}
-- inside doesn't matter
return pks -- {} this is will be return
allpks will be contain an error:
(error) @user_script: 3: -READONLY You can't write against a read only replica.
Redis
SORT
command returns an error on slave instances andorderBy()
always returns empty result.To reproduce the problem make Redis master and slave, make and add any
ActiveRecord
model. Do query withorderBy()
on slave instance:null
will be return.Lua
script that will be executed:allpks
will be contain an error:And empty
pks
will be return.Additional info