and also , why can i pass xv6
Could you clarify what you mean?
and also , why can i pass xv6
Could you clarify what you mean?
@andy1li
Yes, has anyone told you that you’re smart? Love you. Let me explain what you mean. You’re saying that the readLine
command does indeed block the main thread until it encounters a newline character. Since the empty RDB file does not end with a newline, it remains blocked indefinitely. As a result, the program cannot proceed further and cannot start the replica to listen for client requests. Therefore, when the client requests the replica, a connection refused error occurs. Because of this error, the tester determines that this phase has failed and attempts to terminate the replica’s main thread. This action causes readLine
to stop blocking and continue running, printing out “part3.” Additionally, before the main thread is actually terminated, it will continue to run for a while until it is fully terminated. (How long it runs depends on how quickly it is terminated.
am i right?
appreciate it
What I meant earlier was why XV6 would pass. Now I realize it’s because XV6 does not have a client attempting to connect to the replica. Additionally, in XV6, the master sends data to the replica, and this data includes a newline character, which releases the blocking caused by readLine
.
are you there bro @andy1li
If my previous understanding is correct, then let’s continue and return to my initial question: how to ensure that the set
command in propagation is executed before the get
request from clients. My discovery is that it is neither necessary nor possible to guarantee this. This can also be proven by the design of the test cases. If the get
command is executed first and does not retrieve a value, it can simply retry a few times. (The reason I didn’t trigger the retry mechanism earlier was that my code had an issue—a null pointer caused it to terminate directly. So, I just need to add a non-null check to fix it.)
My discovery is that it is neither necessary nor possible to guarantee this.
You’re absolutely right!
If you’d like to explore further, here’s the tester code for #YG4 Command Processing:
ok ok @andy1li
i have no questions right now
you are so good and patient and smart
appreciate your help very much
Glad I could help! Feel free to start a new topic if you run into other issues.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.