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

Elasticache: Abort incomplete pipelines and transactions upon reconnect #1084

Merged
merged 1 commit into from
Mar 28, 2020

Commits on Mar 27, 2020

  1. Abort incomplete pipelines upon reconnect

    Elasticache severs the connection immediately after it returns a
    READONLY error.  This can sometimes leave queued up pipelined commands
    in an inconsistent state when the connection is reestablished. For
    example, if a pipeline has 6 commands and the second one generates a
    READONLY error, Elasticache will only return results for the first two
    before severing the connection. Upon reconnect, the pipeline still
    thinks it has 6 commands to send but the commandQueue has only 4. This
    fix will detect any pipeline command sets that only had a partial
    response before connection loss, and abort them.
    
    This Elasticache behavior also affects transactions. If reconnectOnError
    returns 2, some transaction fragments may end up in the offlineQueue.
    This fix will check the offlineQueue for any such transaction fragments
    and abort them, so that we don't send mismatched multi/exec to redis
    upon reconnection.
    
    - Introduced piplineIndex property on pipelined commands to allow for later
    cleanup
    - Added a routine to event_handler that aborts any pipelined commands inside
    commandQueue and offlineQueue that were interrupted in the middle of the
    pipeline
    - Added a routine to event_handler that removes any transaction
    fragments from the offline queue
    - Introduced inTransaction property on commands to simplify pipeline logic
    - Added a flags param to mock_server to allow the Elasticache disconnect
    behavior to be simulated
    - Added a reconnect_on_error test case for transactions
    - Added some test cases testing for correct handling of this unique elasticache
    behavior
    - Added unit tests to validate inTransaction and pipelineIndex setting
    
    Fixes redis#965
    alavers committed Mar 27, 2020
    Configuration menu
    Copy the full SHA
    aa5fe68 View commit details
    Browse the repository at this point in the history