Skip to content

Conversation

@elena-kolevska
Copy link
Contributor

@elena-kolevska elena-kolevska commented Aug 12, 2025

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action 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)? N/A
  • Is there an example added to the examples folder (if applicable)? N/A

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

  • Adds handshake for hitless upgrades
  • Updates the server maintenance message format to include the sequence ID

petyaslavova and others added 27 commits July 24, 2025 16:40
… Refactored the maintenance events tests not to be multithreaded - we don't need it for those tests.
…ot processed in in Moving state. Tests are updated
Signed-off-by: Elena Kolevska <[email protected]>

Cleanup

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
@petyaslavova petyaslavova requested a review from Copilot August 13, 2025 07:28
mengxunQAQ and others added 15 commits August 15, 2025 18:09
* Typos in commands.py

* Correct URL in vectorset commands.py
…#3512)

* Fix async safety when Redis client is used as an async context manager

When the async Redis client is used as an async context manager and
called from different corotuines, one coroutine can exit, shutting
down the client's connection pool, while another coroutine is
attempting to use a connection. This results in a connection error,
such as:

redis.exceptions.ConnectionError: Connection closed by server.

Additional locking in `ConnectionPool` resolves the problem but
introduces extreme latency due to the locking. Instead, this PR
implements a shielded counter that increments as callers enter the async
context manager and decrements when they exit. The client then closes
its connection pool only after all active contexts exit.

Performance is on par with use of the client without a context manager.
@petyaslavova petyaslavova deleted the branch redis:feat/hitless-upgrade-sync-standalone August 19, 2025 09:08
@petyaslavova petyaslavova reopened this Aug 19, 2025
@petyaslavova petyaslavova changed the base branch from ps_add_fail_over_events_handling to feat/hitless-upgrade-sync-standalone August 19, 2025 09:15
@petyaslavova petyaslavova requested a review from Copilot August 19, 2025 11:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements hitless handshake functionality for Redis maintenance events by adding a handshake process and updating message formats to include sequence IDs. The changes enable clients to negotiate maintenance notification preferences with the server during connection establishment.

  • Adds endpoint type detection and validation for CLIENT MAINT_NOTIFICATIONS command
  • Updates server maintenance message format to include sequence ID as the first parameter
  • Changes default maintenance events configuration from disabled to enabled

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
redis/maintenance_events.py Adds EndpointType class and endpoint detection logic to MaintenanceEventsConfig for handshake negotiation
redis/connection.py Implements CLIENT MAINT_NOTIFICATIONS handshake during connection establishment and adds IP resolution method
redis/_parsers/base.py Updates message parsing to handle new format with sequence ID as first parameter
tests/test_maintenance_events.py Adds comprehensive tests for endpoint type detection and validation
tests/test_maintenance_events_handling.py Updates mock server responses to match new message format with sequence ID

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


logger = logging.getLogger(__name__)
logger.warning(f"Failed to enable maintenance notifications: {e}")

Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The broad exception handling catches all exceptions during the handshake process. Consider being more specific about which exceptions to handle and potentially re-raise authentication or connection errors that shouldn't be silently ignored.

Suggested change
except (AuthenticationError, ConnectionError) as e:
# Re-raise critical connection/authentication errors
raise
except ResponseError as e:
# Log warning but don't fail the connection for expected server response errors
import logging
logger = logging.getLogger(__name__)
logger.warning(f"Failed to enable maintenance notifications: {e}")

Copilot uses AI. Check for mistakes.
@petyaslavova petyaslavova merged commit 193219d into redis:feat/hitless-upgrade-sync-standalone Aug 20, 2025
1 check passed
petyaslavova pushed a commit that referenced this pull request Aug 25, 2025
petyaslavova added a commit that referenced this pull request Aug 29, 2025
…rade or maintenance procedures. (#3756)

* Hitless upgrade: Support initial implementation for synchronous Redis client - no handshake, no failing over notifications support. (#3713)

* Adding handling of FAILING_OVER and FAILED_OVER events/push notifications (#3716)

* Hitless upgrade: Adding handshake command to enable the notifications after connection is established (#3735)

* Hitless-Upgrade: Add handling of MOVING push notification with "null" host:port info. (#3751)

---------

Co-authored-by: Elena Kolevska <[email protected]>
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.

6 participants