Repository navigation
Fix reply alignment after skip-result batches - #7445
rahulrane50 wants to merge 5 commits into
Conversation
Signed-off-by: Rahul Rane <[email protected]>
|
Can you add a test to RedissonBatchTest too? |
There was a problem hiding this comment.
if CLIENT REPLY OFF has no effect, the commands after the batch get incorrect replies
reply is broken for: ACL user without client|reply, or a renamed CLIENT command, REDIS_WRITE_ATOMIC batch with skipResult(), and the node becomes a replica before EXEC.
testFailedSkipResultBatchPreservesFollowingReply incorrect. This test sends -ERR rejected batch and then +PONG. Redis cannot send this sequence for this batch. If CLIENT REPLY OFF has an effect, Redis sends no error reply. If Redis refuses it, Redis sends a reply for each command.
Signed-off-by: Rahul Rane <[email protected]>
|
@mrniko updated PR and addressed your comments. PTAL |
|
@mrniko gentle ping. |
mrniko
left a comment
There was a problem hiding this comment.
In IN_MEMORY and IN_MEMORY_ATOMIC mode, if Redis refuses CLIENT REPLY OFF, the batch now fails with NOPERM. But Redis ran all commands of the batch. testSkipResultWhenClientReplyIsRejected shows this: the batch fails, and rejected:key contains "value".
If the decoder starts again in the middle of a batch, isResultSkipped() reads a later reply as the first reply.
testSkipResultWhenNodeBecomesReplicaBeforeExec passes without changes applied.
Signed-off-by: Rahul Rane <[email protected]>
|
Good catch @mrniko updated PR. |
|
@mrniko whenever you have time can you take a look at updated PR once. Thanks! |
mrniko
left a comment
There was a problem hiding this comment.
Add a log when OFF is refused. One WARN would tell that the optimization is off, and that the ACL is the reason.
When OFF is refused inside MULTI, Redis always aborts EXEC. The caller now gets only EXECABORT Transaction discarded because of previous errors. The NOPERM that caused it is skipped.
Signed-off-by: Rahul Rane <[email protected]>
Signed-off-by: Rahul Rane <[email protected]>
A Redis-queued
skipResult()batch can finish decoding after onlyCLIENT REPLY OFF'sQUEUEDreply when responses are fragmented, leavingEXECto time out. Batch decoding also needs to preserve reply boundaries when subsequent commands' replies arrive in the same read.Determine whether reply suppression took effect and retain that decision for the lifetime of the batch. Frame only the remaining replies after a resumed decode, including queued transactions and optional
WAIT/WAITAOFresponses. Preserve an earlier command error across resumes and use the same remaining boundary for late replies to completed batches.When Redis rejects
CLIENT REPLY OFF, decode the unsuppressed command replies. In-memory batches whose writes succeeded still succeed with empty results; rejection of the internal OFF/ON optimization does not report already executed writes as failed. Actual command errors still fail the batch. For in-memory atomic fallback, alignEXECresults with the commands followingMULTI.Log one WARN per refused OFF with the Redis rejection reason and the disabled optimization. The corresponding ON refusal does not emit a duplicate warning. Replace CR/LF with underscores in the logged reason to prevent untrusted Redis text from injecting log lines; retain the original text in the exception cause. For Redis-queued transactions, retain the OFF rejection across resumed decoding and attach it as the cause of
EXECABORTbefore completing the EXEC future exceptionally. Callers retain both the transaction failure and the original ACL or renamed-command reason.Validation with JDK 25 and Redis 8.10:
client|reply, a renamedCLIENT, and a node becoming a replica beforeEXEC. Rejection tests check non-idempotent writes execute exactly once, following string/integer reads stay aligned, and real command errors remain visible. Queued callers now assert both the EXECABORT exception and the original refusal as its root cause.8ab3c1fda49a7fails 14 of the 22 selected warning/cause cases, including both real-Redis queued refusal cases. The revision passes all 22.testAtomicSyncSlavesvariant 1 expected one replica acknowledgment and received zero. A fresh control on unmodified base64d5fbf7c73e9reproduces that same failure; variant 2 passes in both runs.The genuine fragmented
REDIS_WRITE_ATOMICreproduction fails on unmodified base64d5fbf7c73e9, using its normal heartbeat implementation and no injected PING. Both in-memory fragmentation cases pass on that base.testSkipResultWhenNodeBecomesReplicaBeforeExecalso passes on the base and is retained as compatibility coverage, not evidence of a new regression.Related to #7380.