I had already implemented rdb file transfer for this stage. However, through tests, I figured out that you are supposed to send the binary for a empty rdb file. So I did that.
I am coming across an error in the logs:
remote: [tester::#CF8] Running tests for Stage #CF8 (Replication - Empty RDB Transfer)
remote: [tester::#CF8] $ ./your_program.sh --port 6379
remote: [your_program] At line 56 in file app/store.c: empty config
remote: [tester::#CF8] client: $ redis-cli PING
remote: [tester::#CF8] client: Sent bytes: "*1\r\n$4\r\nPING\r\n"
remote: [tester::#CF8] client: Received bytes: "+PONG\r\n"
remote: [tester::#CF8] client: Received RESP simple string: "PONG"
remote: [tester::#CF8] Received "PONG"
remote: [tester::#CF8] client: > REPLCONF listening-port 6380
remote: [tester::#CF8] client: Sent bytes: "*3\r\n$8\r\nREPLCONF\r\n$14\r\nlistening-port\r\n$4\r\n6380\r\n"
remote: [tester::#CF8] client: Received bytes: "+OK\r\n"
remote: [tester::#CF8] client: Received RESP simple string: "OK"
remote: [tester::#CF8] Received "OK"
remote: [tester::#CF8] client: > REPLCONF capa psync2
remote: [tester::#CF8] client: Sent bytes: "*3\r\n$8\r\nREPLCONF\r\n$4\r\ncapa\r\n$6\r\npsync2\r\n"
remote: [tester::#CF8] client: Received bytes: "+OK\r\n"
remote: [tester::#CF8] client: Received RESP simple string: "OK"
remote: [tester::#CF8] Received "OK"
remote: [tester::#CF8] client: > PSYNC ? -1
remote: [tester::#CF8] client: Sent bytes: "*3\r\n$5\r\nPSYNC\r\n$1\r\n?\r\n$2\r\n-1\r\n"
remote: [tester::#CF8] client: Received bytes: "++FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0\r\n"
remote: [tester::#CF8] client: Received RESP simple string: "+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0"
remote: [tester::#CF8] Received "+FULLRESYNC 8371b4fb1155b71f4a04d3e1bc3e18c4a990aeeb 0"
remote: [tester::#CF8] Reading RDB file...
remote: [tester::#CF8] Received: "e\xc2m\b\xbce\xfa\bused-mem°\xc4\x10"
remote: [tester::#CF8] ^ error
remote: [tester::#CF8] Error: Expected 88 bytes of data in RDB file message, got 66
remote: [tester::#CF8] Test failed
remote: [tester::#CF8] Terminating program
remote: [tester::#CF8] Program terminated successfully
remote:
Just before writing to client fd, I am logging the hex values and there are all 88 of them. However, the test complains that there are only 66.
Link to code: GitHub - UdeshyaDhungana/redisclone