Clarity on redis: replication #NA2

From the logs below, here is my understanding

Tester does

  1. Executes the process as master
  2. Creates 3 replicas and connects with master. I am assuming these replicas are tester generated, not our code run as replica
  3. Tester executes a redis-cli SET foo 123
  4. I see from the console output these commands are propagated to the replicas
  5. Tester executes redis-cli WAIT 1 500

What is our expectation in the master
Once we receive the wait command in master, below are our options
a. From master, we can call replica’s to check whether the set command executed by calling get foo
b. From master, send REPLECONF GETACK * and wait for acknowledge
c. From master, send INFO command and check on the offset bytes

What can we do here? The tester program tests in the replica whether it received the SET command, and then errors out
[replication-18] Received: “” (no content received)
[replication-18] ^ error
[replication-18] Error: Expected start of a new RESP2 value (either +, -, :, $ or *)

Are we supposed to send anything from the master that the tester replica program expecting? Little clarity on how the testing is done and what the program expecting to pass the stage will be really helpful to pass this stage

Below are the console logs
[replication-18] Running tests for Replication > Stage #18: WAIT with multiple commands
[replication-18] $ ./spawn_redis_server.sh --port 6379
[replication-18] Proceeding to create 4 replicas.
[replication-18] Creating replica: 1
[your_program] master - Server running on (‘127.0.0.1’, 6379)
[replication-18] replica-1: $ redis-cli PING
[replication-18] replica-1: Sent bytes: “*1\r\n$4\r\nPING\r\n”
[replication-18] replica-1: Received bytes: “+PONG\r\n”
[replication-18] replica-1: Received RESP value: “PONG”
[your_program] master - command: b’*1\r\n$4\r\nPING\r\n’, length: 14, parsed: [‘PING’] from client ::1:40440
[your_program] master - writing response: b’+PONG\r\n’ to client ::1:40440
[replication-18] Received “PONG”
[replication-18] replica-1: $ redis-cli REPLCONF listening-port 6380
[replication-18] replica-1: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6380\r\n”
[replication-18] replica-1: Received bytes: “+OK\r\n”
[replication-18] replica-1: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6380\r\n’, length: 49, parsed: [‘REPLCONF’, ‘listening-port’, ‘6380’] from client ::1:40440
[your_program] master - Replica connections added
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40440
[replication-18] Received “OK”
[replication-18] replica-1: $ redis-cli REPLCONF capa psync2
[replication-18] replica-1: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n”
[replication-18] replica-1: Received bytes: “+OK\r\n”
[replication-18] replica-1: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n’, length: 40, parsed: [‘REPLCONF’, ‘capa’, ‘psync2’] from client ::1:40440
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40440
[replication-18] Received “OK”
[replication-18] replica-1: $ redis-cli PSYNC ? -1
[replication-18] replica-1: Sent bytes: “*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n”
[replication-18] replica-1: Received bytes: “+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n”
[replication-18] replica-1: Received RESP value: “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Received “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Reading RDB file…
[your_program] master - command: b’*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n’, length: 30, parsed: [‘PSYNC’, ‘?’, ‘-1’] from client ::1:40440
[your_program] master - writing response: b’+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n’ to client ::1:40440
[your_program] master - writing response: b’$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\x08\xbce\xfa\x08used-mem\xc2\xb0\xc4\x10\x00\xfa\x08aof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2’ to client ::1:40440
[replication-18] replica-1: Received bytes: “$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\b\xbce\xfa\bused-mem°\xc4\x10\x00\xfa\baof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2”
[replication-18] Received RDB file
[replication-18] Creating replica: 2
[replication-18] replica-2: $ redis-cli PING
[replication-18] replica-2: Sent bytes: “*1\r\n$4\r\nPING\r\n”
[replication-18] replica-2: Received bytes: “+PONG\r\n”
[replication-18] replica-2: Received RESP value: “PONG”
[your_program] master - command: b’*1\r\n$4\r\nPING\r\n’, length: 14, parsed: [‘PING’] from client ::1:40454
[your_program] master - writing response: b’+PONG\r\n’ to client ::1:40454
[replication-18] Received “PONG”
[replication-18] replica-2: $ redis-cli REPLCONF listening-port 6381
[replication-18] replica-2: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6381\r\n”
[replication-18] replica-2: Received bytes: “+OK\r\n”
[replication-18] replica-2: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6381\r\n’, length: 49, parsed: [‘REPLCONF’, ‘listening-port’, ‘6381’] from client ::1:40454
[your_program] master - Replica connections added
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40454
[replication-18] Received “OK”
[replication-18] replica-2: $ redis-cli REPLCONF capa psync2
[replication-18] replica-2: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n”
[replication-18] replica-2: Received bytes: “+OK\r\n”
[replication-18] replica-2: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n’, length: 40, parsed: [‘REPLCONF’, ‘capa’, ‘psync2’] from client ::1:40454
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40454
[replication-18] Received “OK”
[replication-18] replica-2: $ redis-cli PSYNC ? -1
[replication-18] replica-2: Sent bytes: “*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n”
[replication-18] replica-2: Received bytes: “+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n”
[replication-18] replica-2: Received RESP value: “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Received “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Reading RDB file…
[your_program] master - command: b’*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n’, length: 30, parsed: [‘PSYNC’, ‘?’, ‘-1’] from client ::1:40454
[your_program] master - writing response: b’+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n’ to client ::1:40454
[your_program] master - writing response: b’$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\x08\xbce\xfa\x08used-mem\xc2\xb0\xc4\x10\x00\xfa\x08aof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2’ to client ::1:40454
[replication-18] replica-2: Received bytes: “$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\b\xbce\xfa\bused-mem°\xc4\x10\x00\xfa\baof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2”
[replication-18] Received RDB file
[replication-18] Creating replica: 3
[replication-18] replica-3: $ redis-cli PING
[replication-18] replica-3: Sent bytes: “*1\r\n$4\r\nPING\r\n”
[your_program] master - command: b’*1\r\n$4\r\nPING\r\n’, length: 14, parsed: [‘PING’] from client ::1:40462
[your_program] master - writing response: b’+PONG\r\n’ to client ::1:40462
[replication-18] replica-3: Received bytes: “+PONG\r\n”
[replication-18] replica-3: Received RESP value: “PONG”
[replication-18] Received “PONG”
[replication-18] replica-3: $ redis-cli REPLCONF listening-port 6382
[replication-18] replica-3: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6382\r\n”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6382\r\n’, length: 49, parsed: [‘REPLCONF’, ‘listening-port’, ‘6382’] from client ::1:40462
[replication-18] replica-3: Received bytes: “+OK\r\n”
[replication-18] replica-3: Received RESP value: “OK”
[your_program] master - Replica connections added
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40462
[replication-18] Received “OK”
[replication-18] replica-3: $ redis-cli REPLCONF capa psync2
[replication-18] replica-3: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n”
[replication-18] replica-3: Received bytes: “+OK\r\n”
[replication-18] replica-3: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n’, length: 40, parsed: [‘REPLCONF’, ‘capa’, ‘psync2’] from client ::1:40462
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40462
[replication-18] Received “OK”
[replication-18] replica-3: $ redis-cli PSYNC ? -1
[replication-18] replica-3: Sent bytes: “*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n”
[your_program] master - command: b’*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n’, length: 30, parsed: [‘PSYNC’, ‘?’, ‘-1’] from client ::1:40462
[your_program] master - writing response: b’+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n’ to client ::1:40462
[your_program] master - writing response: b’$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\x08\xbce\xfa\x08used-mem\xc2\xb0\xc4\x10\x00\xfa\x08aof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2’ to client ::1:40462
[replication-18] replica-3: Received bytes: “+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n”
[replication-18] replica-3: Received RESP value: “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Received “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Reading RDB file…
[replication-18] replica-3: Received bytes: “$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\b\xbce\xfa\bused-mem°\xc4\x10\x00\xfa\baof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2”
[replication-18] Received RDB file
[replication-18] Creating replica: 4
[replication-18] replica-4: $ redis-cli PING
[replication-18] replica-4: Sent bytes: “*1\r\n$4\r\nPING\r\n”
[your_program] master - command: b’*1\r\n$4\r\nPING\r\n’, length: 14, parsed: [‘PING’] from client ::1:40470
[your_program] master - writing response: b’+PONG\r\n’ to client ::1:40470
[replication-18] replica-4: Received bytes: “+PONG\r\n”
[replication-18] replica-4: Received RESP value: “PONG”
[replication-18] Received “PONG”
[replication-18] replica-4: $ redis-cli REPLCONF listening-port 6383
[replication-18] replica-4: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6383\r\n”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6383\r\n’, length: 49, parsed: [‘REPLCONF’, ‘listening-port’, ‘6383’] from client ::1:40470
[your_program] master - Replica connections added
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40470
[replication-18] replica-4: Received bytes: “+OK\r\n”
[replication-18] replica-4: Received RESP value: “OK”
[replication-18] Received “OK”
[replication-18] replica-4: $ redis-cli REPLCONF capa psync2
[replication-18] replica-4: Sent bytes: “*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n”
[your_program] master - command: b’*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n’, length: 40, parsed: [‘REPLCONF’, ‘capa’, ‘psync2’] from client ::1:40470
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40470
[replication-18] replica-4: Received bytes: “+OK\r\n”
[replication-18] replica-4: Received RESP value: “OK”
[replication-18] Received “OK”
[replication-18] replica-4: $ redis-cli PSYNC ? -1
[replication-18] replica-4: Sent bytes: “*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n”
[your_program] master - command: b’*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n’, length: 30, parsed: [‘PSYNC’, ‘?’, ‘-1’] from client ::1:40470
[your_program] master - writing response: b’+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n’ to client ::1:40470
[your_program] master - writing response: b’$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\x08\xbce\xfa\x08used-mem\xc2\xb0\xc4\x10\x00\xfa\x08aof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2’ to client ::1:40470
[replication-18] replica-4: Received bytes: “+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n”
[replication-18] replica-4: Received RESP value: “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Received “FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0”
[replication-18] Reading RDB file…
[replication-18] replica-4: Received bytes: “$88\r\nREDIS0011\xfa\tredis-ver\x057.2.0\xfa\nredis-bits\xc0@\xfa\x05ctime\xc2m\b\xbce\xfa\bused-mem°\xc4\x10\x00\xfa\baof-base\xc0\x00\xff\xf0n;\xfe\xc0\xffZ\xa2”
[replication-18] Received RDB file
[replication-18] client: $ redis-cli SET foo 123
[replication-18] client: Sent bytes: “*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n”
[replication-18] client: Received bytes: “+OK\r\n”
[replication-18] client: Received RESP value: “OK”
[your_program] master - command: b’*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n’, length: 31, parsed: [‘SET’, ‘foo’, ‘123’] from client ::1:40484
[your_program] master - writing response: b’+OK\r\n’ to client ::1:40484
[your_program] sent b’*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n’ to replica (‘::1’, 40440, 0, 0)
[your_program] sent b’*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n’ to replica (‘::1’, 40454, 0, 0)
[your_program] sent b’*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n’ to replica (‘::1’, 40462, 0, 0)
[your_program] sent b’*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n’ to replica (‘::1’, 40470, 0, 0)
[replication-18] Received “OK”
[replication-18] client: $ redis-cli WAIT 1 500
[replication-18] client: Sent bytes: “*3\r\n$4\r\nWAIT\r\n$1\r\n1\r\n$3\r\n500\r\n”
[replication-18] Testing Replica : 1
[replication-18] replica-1: Received bytes: “*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\n123\r\n”
[replication-18] replica-1: Received RESP value: [“SET”, “foo”, “123”]
[replication-18] Received [“SET”, “foo”, “123”]
[your_program] master - command: b’*3\r\n$4\r\nWAIT\r\n$1\r\n1\r\n$3\r\n500\r\n’, length: 30, parsed: [‘WAIT’, ‘1’, ‘500’] from client ::1:40484
[your_program] master - Inside Wait, last command: set, expected_replica_ack_count: 1, replicas_count: 4
[your_program] master - Waiting for replica ACK count: 1
[your_program] master - Sent replica count: 4 to client ::1:40484
[your_program] An error occurred: [Errno 104] Connection reset by peer
[your_program] master - command: b’‘, length: 0, parsed: from client ::1:40484
[your_program] master - writing response: b’-Invalid Command\r\n’ to client ::1:40484
[your_program] master - Error occurred for client ::1:40484: [Errno 104] Connection reset by peer
[replication-18] Received: “” (no content received)
[replication-18] ^ error
[replication-18] Error: Expected start of a new RESP2 value (either +, -, :, $ or *)
[replication-18] Test failed
[replication-18] Terminating program
[replication-18] Program terminated successfullyemphasized text

Hey @Jothikumar-ekanath,

The answer here is “b. From master, send REPLCONF GETACK * and wait for acknowledge”

We’ll make this clear once we’ve got instructions up for this stage!

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

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.