Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WAIT with multiple commands: missing replies for GETACK #200

Open
marxin opened this issue May 18, 2024 · 1 comment
Open

WAIT with multiple commands: missing replies for GETACK #200

marxin opened this issue May 18, 2024 · 1 comment

Comments

@marxin
Copy link

marxin commented May 18, 2024

First of all, thank you for the very nice Replication extension for the Redis example.

I'm close to finishing the last WAIT command exercise, however, I face the following problem:

remote: [replication-18] client: $ redis-cli SET foo 123
remote: [your_program] 2024-05-18T11:28:58.737729Z  INFO connection{addr=127.0.0.1:35618}:replication: redis_starter_rust::server: sending replication: Set { key: "foo", value: "123", expiration: None }
remote: [your_program] 2024-05-18T11:28:58.737771Z  INFO connection{addr=127.0.0.1:35630}:replication: redis_starter_rust::server: sending replication: Set { key: "foo", value: "123", expiration: None }
remote: [your_program] 2024-05-18T11:28:58.737783Z  INFO connection{addr=127.0.0.1:35608}:replication: redis_starter_rust::server: sending replication: Set { key: "foo", value: "123", expiration: None }
remote: [your_program] 2024-05-18T11:28:58.737723Z  INFO connection{addr=127.0.0.1:35640}:replicationg_manager: redis_starter_rust::server: replicated: Set { key: "foo", value: "123", expiration: None }, counter: 31
remote: [your_program] 2024-05-18T11:28:58.738995Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: sending replication: Set { key: "foo", value: "123", expiration: None }
remote: [replication-18] Received "OK"
remote: [replication-18] client: $ redis-cli WAIT 1 500
remote: [replication-18] Testing Replica : 1
remote: [replication-18] replica-1: Expecting "SET foo 123" to be propagated
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-1: Expecting "REPLCONF GETACK *" from Master
remote: [your_program] 2024-05-18T11:28:58.750833Z  INFO connection{addr=127.0.0.1:35640}: redis_starter_rust::server: current replication counter: 31
remote: [your_program] 2024-05-18T11:28:58.750870Z  INFO connection{addr=127.0.0.1:35608}:replication: redis_starter_rust::server: sending replication: ReplConf { arg: "GETACK", value: "*" }
remote: [your_program] 2024-05-18T11:28:58.750903Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: sending replication: ReplConf { arg: "GETACK", value: "*" }
remote: [your_program] 2024-05-18T11:28:58.750946Z  INFO connection{addr=127.0.0.1:35630}:replication: redis_starter_rust::server: sending replication: ReplConf { arg: "GETACK", value: "*" }
remote: [your_program] 2024-05-18T11:28:58.750962Z  INFO connection{addr=127.0.0.1:35640}:replicationg_manager: redis_starter_rust::server: replicated: ReplConf { arg: "GETACK", value: "*" }, counter: 68
remote: [your_program] 2024-05-18T11:28:58.750972Z  INFO connection{addr=127.0.0.1:35618}:replication: redis_starter_rust::server: sending replication: ReplConf { arg: "GETACK", value: "*" }
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] replica-1: $ redis-cli REPLCONF ACK 31
remote: [replication-18] Testing Replica : 2
remote: [replication-18] replica-2: Expecting "SET foo 123" to be propagated
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-2: Expecting "REPLCONF GETACK *" from Master
remote: [your_program] 2024-05-18T11:28:58.763419Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: replconf reply received: ReplConf { arg: "ACK", value: "31" }
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Testing Replica : 3
remote: [replication-18] replica-3: Expecting "SET foo 123" to be propagated
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-3: Expecting "REPLCONF GETACK *" from Master
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Testing Replica : 4
remote: [replication-18] replica-4: Expecting "SET foo 123" to be propagated
remote: [replication-18] Received ["SET", "foo", "123"]
remote: [replication-18] replica-4: Expecting "REPLCONF GETACK *" from Master
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] Passed first WAIT test.
remote: [replication-18] client: $ redis-cli SET baz 789
remote: [your_program] 2024-05-18T11:28:58.770262Z  INFO connection{addr=127.0.0.1:35640}:replicationg_manager: redis_starter_rust::server: replicated: Set { key: "baz", value: "789", expiration: None }, counter: 99
remote: [your_program] 2024-05-18T11:28:58.770298Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: sending replication: Set { key: "baz", value: "789", expiration: None }
remote: [replication-18] Received "OK"
remote: [replication-18] client: $ redis-cli WAIT 3 2000
remote: [replication-18] Testing Replica : 1
remote: [replication-18] replica-1: Expecting "SET baz 789" to be propagated
remote: [replication-18] Received ["SET", "baz", "789"]
remote: [replication-18] replica-1: Expecting "REPLCONF GETACK *" from Master
remote: [your_program] 2024-05-18T11:28:58.771828Z  INFO connection{addr=127.0.0.1:35640}: redis_starter_rust::server: current replication counter: 99
remote: [your_program] 2024-05-18T11:28:58.771840Z  INFO connection{addr=127.0.0.1:35640}:replicationg_manager: redis_starter_rust::server: replicated: ReplConf { arg: "GETACK", value: "*" }, counter: 136
remote: [your_program] 2024-05-18T11:28:58.771850Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: sending replication: ReplConf { arg: "GETACK", value: "*" }
remote: [replication-18] Received ["REPLCONF", "GETACK", "*"]
remote: [replication-18] replica-1: $ redis-cli REPLCONF ACK 99
remote: [replication-18] Testing Replica : 2
remote: [replication-18] replica-2: Expecting "SET baz 789" to be propagated
remote: [your_program] 2024-05-18T11:28:58.819304Z  INFO connection{addr=127.0.0.1:35594}:replication: redis_starter_rust::server: replconf reply received: ReplConf { arg: "ACK", value: "99" }
remote: [replication-18] Received: "" (no content received)
remote: [replication-18]            ^ error
remote: [replication-18] Error: Expected start of a new RESP2 value (either +, -, :, $ or *)
remote: [replication-18] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)
remote: [your_program] 2024-05-18T11:29:00.824922Z  INFO connection{addr=127.0.0.1:35608}:replication: redis_starter_rust::server: replconf reply received: Null
remote: [your_program] 2024-05-18T11:29:00.824937Z ERROR connection{addr=127.0.0.1:35608}:replication: redis_starter_rust::server: replconf expect a valid reply
remote: [your_program] 2024-05-18T11:29:00.824979Z  INFO connection{addr=127.0.0.1:35630}:replication: redis_starter_rust::server: replconf reply received: Null
remote: [your_program] 2024-05-18T11:29:00.824982Z ERROR connection{addr=127.0.0.1:35630}:replication: redis_starter_rust::server: replconf expect a valid reply
remote: [your_program] 2024-05-18T11:29:00.824998Z  INFO connection{addr=127.0.0.1:35618}:replication: redis_starter_rust::server: replconf reply received: Null
remote: [your_program] 2024-05-18T11:29:00.825000Z ERROR connection{addr=127.0.0.1:35618}:replication: redis_starter_rust::server: replconf expect a valid reply

It seems some of the clients don't reply to the GETACK before the second SET baz 789 happens. That's problematic because I wait for each GETACK before I process commands in the replication queue. The failing line is:

replica-2: Expecting "SET baz 789" to be propagated where the replica expects the SET, but it hasn't send reply to GETACK yet. Is it something one should handle and what timeouts should be used if so?

Copy link

linear bot commented May 18, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant