Skip to content
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

Don't send DISCARD after ExecAbortError in pipeline #1301

Closed
wants to merge 1 commit into from

Conversation

nickgaya
Copy link
Contributor

@nickgaya nickgaya commented Mar 5, 2020

Description of change

Don't send DISCARD after ExecAbortError when executing a MULTI/EXEC transaction in the Pipeline class.

The EXECABORT error type was added in Redis 2.6.5 and is returned from an EXEC command to indicate that the transaction was aborted due to an invalid command. It is not necessary to call DISCARD after this error, and doing so causes a "DISCARD without MULTI" error.

Fixes #1300

Pull Request check-list

  • Does $ tox pass with this change (including linting)?
  • Does travis tests pass with this change (enable it first in your forked repo and wait for the travis build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

The `EXECABORT` error type was added in Redis 2.6.5 and is returned from an
`EXEC` command to indicate that the transaction was aborted due to an invalid
command.  It is not necessary to call `DISCARD` after this error, and doing so
causes a "DISCARD without MULTI" error.
@codecov-io
Copy link

codecov-io commented Mar 5, 2020

Codecov Report

Merging #1301 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1301      +/-   ##
==========================================
+ Coverage   92.76%   92.78%   +0.02%     
==========================================
  Files          19       19              
  Lines        6478     6485       +7     
==========================================
+ Hits         6009     6017       +8     
+ Misses        469      468       -1
Impacted Files Coverage Δ
redis/client.py 86.25% <ø> (+0.04%) ⬆️
tests/test_pipeline.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81d7665...cf7662d. Read the comment docs.

@andymccurdy
Copy link
Contributor

Merged in 07fec7e. Thanks for finding this!

I had to do some digging to validate this was a good change. I was actually involved in the original discussion with antirez back in 2012 when this code was added. The existing code worked against a branch he was developing to fix an underlying problem. I shipped the redis-py code, then a few days later in the same thread he changed the behavior of the server to automatically discard before replying with EXECABORT. I apparently missed that change in direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pipeline incorrectly calls DISCARD after EXEC in case of EXECABORT error
4 participants