Set pending_command flag consistently across all command execution paths#3600
Conversation
6191dae to
e5de2c7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## forkless #3600 +/- ##
============================================
+ Coverage 76.66% 76.73% +0.06%
============================================
Files 159 159
Lines 79570 79575 +5
============================================
+ Hits 61003 61058 +55
+ Misses 18567 18517 -50
🚀 New features to boost your workflow:
|
a83ba21 to
324fb13
Compare
324fb13 to
2c8d170
Compare
Signed-off-by: harrylin98 <harrylin980107@gmail.com>
2c8d170 to
a12a5b0
Compare
|
I think this is a good change to simplify the overall command processing logic. Since the |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
a7d2819 to
b241952
Compare
…g command on module blocking clients Signed-off-by: harrylin98 <harrylin980107@gmail.com>
b241952 to
782ff6c
Compare
…ths (valkey-io#3600) The `pending_command` flag indicates that a client has a fully parsed command ready for execution. This update ensures that the flag is set/cleared consistently across different execution paths. --------- Signed-off-by: harrylin98 <harrylin980107@gmail.com>
The
pending_commandflag is documented as indicating a client has a fully parsed command ready for execution. However, it was only set in the IO thread path, not in the main threadprocessInputBufferpath which parses and executes directly without ever setting the flag. This inconsistency meant blocking APIs likeblockClientInUseOnKeyshad to require callers to manually set pending_command = 1 before calling.This change:
processInputBufferwhen the command is fully parsed.commandProcessedafter execution completes.processPendingCommandAndInputBufferandunblockClientOnKey.Now any command that blocks during processCommand naturally has pending_command = 1 already set, without caller intervention.
Exception:
WAITandWAITAOFexplicitly clear pending_command before blocking, sinceprocessClientsWaitingReplicasuses it to distinguish reply commands (pending_command = 0) from re-execution commands like CLUSTER SETSLOT (pending_command = 1).moduleHandleBlockedClientsbefore unblocking, since their reply is already handled by the module's callback (reply callback for VM_BlockClient, key-notification callback for VM_BlockClientOnKeys). The exception is module auth-in-progress clients, which keep pending_command = 1 because they need re-execution after authentication completes.