-
Notifications
You must be signed in to change notification settings - Fork 166
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
fix: broken tx retries for cluster clients after #697 #709
base: main
Are you sure you want to change the base?
Conversation
return nil | ||
} | ||
count.m[p]++ | ||
count.m[cc]++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make naming consistent.
break | ||
} | ||
} | ||
if last == cmds.InitSlot { | ||
return nil | ||
} | ||
} else if init { | ||
cc := c.pslots[last] | ||
count.m[cc] += inits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't count cmd.InitSlot commands to c.pslots[last]
in the code above this, so add the count back here.
dbe3db5
to
6bfd890
Compare
Find one extreme case:
We will get [4]RedisResult with all successful results. And resp[3] (which means EDIT: maybe we should find the nearest successful |
I just tried the double |
make sense though. BTW i got different response from redis:7.4 cluster cmd:
response
EDIT: |
6bfd890
to
f61ee99
Compare
for mi = i; mi >= 0 && !isMulti(commands[mi]) && !isExec(commands[mi]); mi-- { | ||
} | ||
for ei = i; ei < len(commands) && !isMulti(commands[ei]) && !isExec(commands[ei]); ei++ { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both mi
and ei
cursor will stop at either MULTI
or EXEC
to avoid crossing tx boundaries.
} | ||
for ei = i; ei < len(commands) && !isMulti(commands[ei]) && !isExec(commands[ei]); ei++ { | ||
} | ||
if mi >= 0 && mi < ei && ei < len(commands) && isMulti(commands[mi]) && isExec(commands[ei]) && resps[mi].val.string == "QUEUED" { // a transaction is found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the nearest MULTI
didn't succeed, we don't retry the tx.
Signed-off-by: Rueian <[email protected]>
f61ee99
to
b4c543d
Compare
I tested these cases on Valkey 8, and they all failed with EXECABORT. But anyway, I think we should just not retry on these wired cases. |
No description provided.