Hi all,
I finally spend some time investigating the issue.
Since we talked about it quite a while ago, and since my understanding of the problem changed quite a bit, let me re-word the problem.
Redis does not replicate the commands if the call to RM_Replicate(Verbatim) happens after the client got blocked.
So it is impossible to replicate a command in a different thread (eg. call ClientBlock, then Replicate(Verbatim), the ClientUnblock) or in the main redis thread after unblocking in the reply function.
I explored the codebase and it seems to me that the case of replicate after a block, simply, is not considered.
Now I am wondering if this is by-design? Or it is suppose to work?
Here the files (from helloblock.c) that show the problem:
https://github.com/siscia/redis/blob/faster_unblock/src/modules/helloblock.cAnd here the (2 lines long) diff:
https://github.com/siscia/redis/commit/1d3bfbb31499794003ae3674250f01f5c7261718 To replicate the issue, just compile the module and load it.
Then set the appendonly to yes `config set appendonly yes`
Set a value `SET A 3`
Finally call the module `HELLO.BLOCK 1 3000`
Confirm the log from the module (It should appear something like: "# <helloblock> It should replicate")
Exploring the AOF file you will not see the log of `HELLO.BLOCK` but you will see the one of `SET`
Happy holidays everybody :)
Cheers,
Simone