Skip to content

Hitless handshake #3735

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

Open
wants to merge 41 commits into
base: ps_add_fail_over_events_handling
Choose a base branch
from

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
Copy link
Contributor

@Copilot 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 handshake functionality for hitless upgrades and updates the server maintenance message format to include sequence IDs for better event tracking.

  • Adds endpoint type detection and CLIENT MAINT_NOTIFICATIONS command for proper handshake setup
  • Updates maintenance event message parsing to handle new format with sequence IDs
  • Changes default behavior to enable maintenance events by default

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, enables maintenance events by default
redis/connection.py Implements handshake via CLIENT MAINT_NOTIFICATIONS command during connection setup
redis/_parsers/base.py Updates message parsing to handle new format with sequence IDs and adds error handling
tests/test_maintenance_events.py Adds comprehensive tests for endpoint type detection and configuration validation
tests/test_maintenance_events_handling.py Updates mock responses to match new message format with sequence IDs

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

return False


def _get_resolved_ip_from_connection(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to expose this function on the connection object.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done.

@petyaslavova petyaslavova marked this pull request as ready for review August 13, 2025 13:16
@petyaslavova petyaslavova force-pushed the ps_add_fail_over_events_handling branch from 8d7cc00 to 10ded34 Compare August 15, 2025 14:37
mengxunQAQ and others added 8 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.
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.

5 participants