Version: redis-5.0.7 but it is seen in unstable branch as well.
- implement redis command "cmda" via redismodule liba.so.
- implement redis command "cmdb" which includes executing "cmda".
- have slave connecting to master.
- while execute "cmdb" command. slave report below warning log. 22328:S 02 Jan 2020 08:50:42.161 # == CRITICAL == This replica is sending an error to its master: 'MULTI calls can not be nested' after processing the command 'multi' 22328:S 02 Jan 2020 08:50:42.161 # == CRITICAL == This replica is sending an error to its master: 'EXEC without MULTI' after processing the command 'exec'
The error looks because "cmdb" and "cmda" are wrapped into a MULTI/EXEC block while do propagate. Then the exact propagate content is "MULTI cmdb MULTI cmda EXEC EXEC". However when the propagate content sending to slave. slave report above warning log.
Comment From: zh1029
I'm not sure, Maybe it is acceptable warning log?
Comment From: antirez
@oranagra @soloestoy still to check this but pinging you as informed persons.
Comment From: guybe7
@zh1029 which version are you using?
commit 2c970532dc47e68efee55082718502e4fa591c7d
Author: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
Date: 6 weeks ago
Propagation: flag module client as CLIENT_MULTI if needed
in case of nested MULTI/EXEC
should have fixed it IIUC
Comment From: guybe7
actually now i see that the above commit is in the "wrong" place...
/* If we are using single commands replication, we need to wrap what
* we propagate into a MULTI/EXEC block, so that it will be atomic like
* a Lua script in the context of AOF and slaves. */
if (replicate) moduleReplicateMultiIfNeeded(ctx);
if (ctx->client->flags & CLIENT_MULTI ||
ctx->flags & REDISMODULE_CTX_MULTI_EMITTED) {
c->flags |= CLIENT_MULTI;
}
if we flag c with CLIENT_MULTI before calling moduleReplicateMultiIfNeeded it should solve the problem... @soloestoy WDYT?
Comment From: soloestoy
@zh1029 could you share how you implement cmda and cmdb ?
Comment From: zh1029
Thank you all guys. Seems I missed pulling the latest commits of unstable branch to local. I have verified that yes the "commit 2c970532dc47e68efee55082718502e4fa591c7d" can fix the issue. Let's wait for next version including the commit then.
BTW. I raised another ticket https://github.com/antirez/redis/issues/6686 to discuss can we also suppress MULTI/EXEC propagation along with the command as well? e.g. neither command nor MULTI/EXEC block is propagated to AOF if has "!A" flags.