build-your-own-redis icon indicating copy to clipboard operation
build-your-own-redis copied to clipboard

Command Processing Stage

Open kushal0511-not opened this issue 1 year ago • 3 comments

I passed this stage(Command Processing Stage ) earlier now while running test for next stage it is again failing for Command processing stage I have just added 1 line (conn.Write()) in case REPLCONF. i tried without changing code , It passes sometimes but most of times it is failing.

remote: [replication-13] PSYNC ? -1 received.
remote: [replication-13] +FULLRESYNC 20lvbc0fgoe7n06a4slgtvgq1303t8506s6sc2pm 0 sent.
remote: [replication-13] RDB file sent.
remote: [replication-13] $ redis-cli SET foo 123
remote: [replication-13] $ redis-cli SET bar 456
remote: [replication-13] $ redis-cli SET baz 789
remote: [replication-13] Getting key foo
remote: [replication-13] $ redis-cli GET foo
remote: [replication-13] 123 received.
remote: [replication-13] Getting key bar
remote: [replication-13] $ redis-cli GET bar
remote: [replication-13] 
remote: [replication-13] Assertion failed, retrying... (Attempt 2/5)
remote: [replication-13] 
remote: [replication-13] $ redis-cli GET bar
remote: [replication-13] 
remote: [replication-13] Assertion failed, retrying... (Attempt 3/5)
remote: [replication-13] 
remote: [replication-13] $ redis-cli GET bar
remote: [replication-13] 
remote: [replication-13] Assertion failed, retrying... (Attempt 4/5)
remote: [replication-13] 
remote: [replication-13] $ redis-cli GET bar
remote: [replication-13] 
remote: [replication-13] Assertion failed, retrying... (Attempt 5/5)
remote: [replication-13] 
remote: [replication-13] $ redis-cli GET bar
remote: [replication-13] 
remote: [replication-13] resp: invalid syntax
remote: [replication-13] Test failed
remote: [replication-13] Terminating program
remote: [replication-13] Program terminated successfully

kushal0511-not avatar Mar 25 '24 10:03 kushal0511-not

I have the same issue. Sometimes it passes and sometimes it doesn't (I use golang).

I use goroutines to accept connections and read messages and in case there is command that should be sent also to the replication server, I have another goroutine running waiting for channel to have value with command pushed in.

Every other test passes without any problems using this approach, but with this one I have been stuck for several hours now.

Also for some reason, sometimes the first SET command is not an ARRAY but a bulk string with some weird value.

image

naqet avatar Mar 30 '24 15:03 naqet

@naqet the bulk string there is the RDB file from the handshake, which should've been read before starting to listen for propagated commands. Looks like you eventually passed the stage, do you happen to remember what the issue was?

@kushal0511-not we've improved logs so you shouldn't see the cryptic "resp: invalid syntax" log anymore, you should see a more informative log.

Still think we can improve logs more here, will keep open until we've got that done

rohitpaulk avatar Apr 17 '24 12:04 rohitpaulk