I’m stuck on the replication 18th stage. Wondering what is missing in my code. first wait test passed, second one gave some unprecedented error. Same scenario was working for first test. I am writing in JS.
Here are my logs:
remote: [replication-18] replica-2: Received bytes: "*3\r\n$8\r\nREPLCONF\r\n$6\r\nGETACK\r\n$1\r\n*\r\n"
remote: [replication-18] replica-2: Received RESP value: ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] replica-2: Not sending ACK to Master
remote: [replication-18] Testing Replica : 3
remote: [replication-18] replica-3: Expecting "SET foo 123" to be propagated
remote: [replication-18] replica-3: Received bytes: "*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n"
remote: [replication-18] replica-3: Received RESP value: ["SET", "foo", "123"]
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-3: Expecting "REPLCONF GETACK *" from Master
remote: [replication-18] replica-3: Received bytes: "*3\r\n$8\r\nREPLCONF\r\n$6\r\nGETACK\r\n$1\r\n*\r\n"
remote: [replication-18] replica-3: Received RESP value: ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] replica-3: Not sending ACK to Master
remote: [replication-18] Testing Replica : 4
remote: [replication-18] replica-4: Expecting "SET foo 123" to be propagated
remote: [replication-18] replica-4: Received bytes: "*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n"
remote: [replication-18] replica-4: Received RESP value: ["SET", "foo", "123"]
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-4: Expecting "REPLCONF GETACK *" from Master
remote: [replication-18] replica-4: Received bytes: "*3\r\n$8\r\nREPLCONF\r\n$6\r\nGETACK\r\n$1\r\n*\r\n"
remote: [replication-18] replica-4: Received RESP value: ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] replica-4: Not sending ACK to Master
remote: [replication-18] client: Received bytes: ":1\r\n"
remote: [replication-18] client: Received RESP value: 1
remote: [replication-18] Passed first WAIT test.
remote: [replication-18] client: $ redis-cli SET baz 789
remote: [replication-18] client: Sent bytes: "*3\r\n$3\r\nSET\r\n$3\r\nbaz\r\n$3\r\n789\r\n"
remote: [your_program] Client connected to master server
remote: [your_program] command:set args:baz,789
remote: [your_program] Setting key value pair in cache
remote: [replication-18] client: Received bytes: "+OK\r\n"
remote: [replication-18] client: Received RESP value: "OK"
remote: [your_program] data sent to replicas
remote: [replication-18] Received "OK"
remote: [replication-18] client: $ redis-cli WAIT 3 2000
remote: [replication-18] client: Sent bytes: "*3\r\n$4\r\nWAIT\r\n$1\r\n3\r\n$4\r\n2000\r\n"
remote: [replication-18] Testing Replica : 1
remote: [replication-18] replica-1: Expecting "SET baz 789" to be propagated
remote: [replication-18] replica-1: Received bytes: "+OK\r\n"
remote: [replication-18] replica-1: Received RESP value: "OK"
remote: [your_program] Client connected to master server
remote: [your_program] command:wait args:3,2000
remote: [your_program] wait command
remote: [replication-18] Expected array type, got SIMPLE_STRING
remote: [replication-18] Test failed
Propagation to the replica of SET command is working for the first test but not for the second test. Please help me. I have been stuck here for long.
I have been able to find one issue in my code. I was registering two On condition, which was causing thee issue. I have surpassed that step. But now I am getting new issue. client is not receiving REPLCONF GETACK * even if I send it. my git repo URL GitHub - Shubho2/SimpleRedis: Implementation of Basic Redis Protocol.
Were you getting the same error as me? If yes.
I have accidentally registered two function call when I am getting the reply from replica as REPLCONF ACK <bytes_received>. It is resolved now.
Note: I’ve updated the title of this post to include the stage ID (#NA2). You can learn about the stages rename here: Upcoming change: Stages overhaul.