-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Functional handoff and connection testing of maint events 2 #3445
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
Functional handoff and connection testing of maint events 2 #3445
Conversation
…rise maintenance events - Add ConnectionTesting class with 9 test scenarios for maintenance handoff behavior - Test old connection graceful shutdown during MOVING operations - Validate traffic resumption with autoconnect after handoff - Verify maintenance notifications only work with RESP3 protocol - Test new connection establishment during migration and bind phases - Add memory leak validation for multiple concurrent connections - Include TLS support testing for maintenance events - Replace .supportMaintenanceEvents(true) with MaintenanceEventsOptions.enabled() - Add comprehensive monitoring and validation of connection lifecycle Tests cover CAE-1130 requirements for Redis Enterprise maintenance event handling including connection draining, autoconnect behavior, and notification delivery.
…IONS - connectionHandshakeIncludesEnablingNotificationsTest: Verifies all 5 notification types (MOVING, MIGRATING, MIGRATED, FAILING_OVER, FAILED_OVER) are received when maintenance events are enabled - disabledDontReceiveNotificationsTest: Verifies no notifications received when maintenance events are disabled - clientHandshakeWithEndpointTypeTest: Tests CLIENT MAINT_NOTIFICATIONS with 'none' endpoint type (nil IP scenario) - clientMaintenanceNotificationInfoTest: Verifies CLIENT MAINT_NOTIFICATIONS configuration with moving-endpoint-type Based on CLIENT MAINT_NOTIFICATIONS implementation from commit bd408cf
- Update push notification patterns to include sequence numbers (4-element format) - Fix MOVING notification parsing to handle new address format with sequence and time - Update MIGRATING, MIGRATED, FAILING_OVER, and FAILED_OVER patterns with sequence numbers - Improve FaultInjectionClient status handling: change from 'pending' to 'running' checks - Enhance JSON response parsing with better output field handling and debugging - Remove deprecated maintenance sequence functionality and associated unit test - Add test phase isolation to prevent cleanup notification interference - Extend monitoring timeout from 2 to 5 minutes for longer maintenance operations - Add @AfterEach cleanup to restore cluster state between tests - Remove hardcoded optimal node selection logic in RedisEnterpriseConfig This aligns with the updated Redis Enterprise maintenance events specification and improves test reliability by handling the new notification protocol format.
…ing-of-maint-events-2
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.
Pull Request Overview
This PR introduces comprehensive testing infrastructure for Redis Enterprise maintenance events, focusing on connection handoff behavior, timeout relaxation mechanisms, and memory leak detection during database migrations and failovers. The implementation provides robust validation of connection lifecycle management and ensures proper cleanup of resources during maintenance operations.
Key Changes:
- Added extensive connection handoff tests with multi-address type support (External IP, External FQDN, Internal IP, Internal FQDN, None)
- Implemented timeout relaxation testing during maintenance events with proper cleanup phase handling
- Created connection leak detection utilities using EventBus monitoring and Netty channel state inspection
- Updated maintenance notification patterns to handle new RESP3 format with sequence numbers
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
RelaxedTimeoutConfigurationTest.java | Enhanced timeout testing with proper cleanup phase handling and command stack clearing |
RedisEnterpriseConfig.java | Simplified cluster configuration by removing hardcoded node logic and complex validation |
MaintenancePushNotificationMonitor.java | Updated to handle new notification format with sequence numbers and immediate ping monitoring |
MaintenanceNotificationTest.java | Updated notification patterns and test names to match new format requirements |
FaultInjectionClientUnitTest.java | Removed unit test file for better focus on integration testing |
FaultInjectionClient.java | Improved status checking and output parsing for better reliability |
ConnectionLeakDetectionUtil.java | New utility for detecting connection leaks using EventBus and Netty channel monitoring |
ConnectionHandoffTest.java | New comprehensive test suite for connection handoff scenarios with all address types |
Comments suppressed due to low confidence (1)
src/test/java/io/lettuce/scenario/RelaxedTimeoutConfigurationTest.java:1
- The conditional check for status being "running" followed by a null check in the log message is inconsistent. If status equals "running", it cannot be null, making the null check redundant.
package io.lettuce.scenario;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/test/java/io/lettuce/scenario/MaintenancePushNotificationMonitor.java
Outdated
Show resolved
Hide resolved
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.
LGTM in general.
Provided some suggestions regarding ConnectionHandoffTest covering actual handoff..
…ing-of-maint-events-2
…and-connection-testing-of-maint-events-2 Ci fix functional handoff and connection testing of maint events 2
…raised during review
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.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// Patterns to parse rladmin output - updated for real Redis Enterprise format | ||
private static final Pattern SHARD_PATTERN = Pattern | ||
.compile("db:(\\d+)\\s+\\S+\\s+(\\S+)\\s+(node:\\d+)\\s+(master|slave)\\s+.*"); | ||
.compile("db:(\\d+)\\s+\\S+\\s+(redis:\\d+)\\s+(node:\\d+)\\s+(master|slave)\\s+.*"); | ||
|
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.
These regex patterns are complex and lack documentation. Consider adding comments explaining the expected format and what each capturing group represents, especially since this appears to be parsing Redis Enterprise specific output.
Copilot uses AI. Check for mistakes.
…ing-of-maint-events-2
Make sure that:
mvn formatter:format
target. Don’t submit any formatting related changes.Connection Handoff and Leak Detection for Redis Enterprise Maintenance Events
Overview
This PR introduces comprehensive testing infrastructure for Redis Enterprise maintenance events, focusing on connection handoff behavior and memory leak detection during database migrations and failovers. The implementation provides robust validation of connection lifecycle management and ensures proper cleanup of resources during maintenance operations.
Key Components
1. ConnectionHandoffTest.java
A comprehensive test suite that validates connection handoff behavior during Redis Enterprise maintenance events:
Core Features:
Multi-Address Type Support: Tests connection handoff with different endpoint address types:
EXTERNAL_IP
: External IP addresses for public cloud deploymentsEXTERNAL_FQDN
: External fully qualified domain namesINTERNAL_IP
: Internal IP addresses for private networksINTERNAL_FQDN
: Internal fully qualified domain namesNONE
: No address type (null handling)RESP3 Push Notification Monitoring: Captures and validates maintenance event notifications:
MOVING
: Endpoint rebind notifications with new connection targetsMIGRATING
: Migration start notificationsMIGRATED
: Migration completion notificationsFAILING_OVER
: Failover start notificationsFAILED_OVER
: Failover completion notificationsKey Test Cases:
Basic Connection Handoff Tests:
connectionHandedOffToNewEndpointExternalIPTest()
: Validates handoff to external IP endpointsconnectionHandoffWithFQDNExternalNameTest()
: Tests FQDN-based endpoint handoffclientHandshakeWithNoneEndpointTypeTest()
: Handles null address scenariosAdvanced Scenarios:
trafficResumesAfterMovingTest()
: Ensures continuous traffic flow during maintenance with 50:50 GET/SET rationewConnectionDuringRebindAfterMovingTest()
: Dual connection testing during endpoint rebinddetectConnectionClosureAndMemoryLeaksTest()
: Memory leak detection using EventBus monitoringNotification System Tests:
connectionHandshakeIncludesEnablingNotificationsTest()
: Validates all 5 notification typesdisabledDontReceiveNotificationsTest()
: Confirms notifications are properly disabled when configuredHelper Classes:
2. ConnectionLeakDetectionUtil.java
A utility class for detecting connection closure and memory leaks using EventBus monitoring and Netty channel state inspection:
Core Capabilities:
EventBus Monitoring:
ConnectedEvent
,DisconnectedEvent
,ConnectionActivatedEvent
,ConnectionDeactivatedEvent
Memory Leak Detection:
Analysis Results:
ConnectionAnalysisResult
: Comprehensive analysis of connection closureisFullyCleanedUpWithoutLeaks()
: Primary indicator for memory leak detectionKey Methods:
setupEventBusMonitoring()
: Configures EventBus listeners before connection creationprepareForConnectionTransition()
: Sets up monitoring for handoff eventswaitForConnectionTransition()
: Waits for disconnect/deactivate events with timeoutanalyzeConnectionClosure()
: Performs comprehensive cleanup analysisgetChannelFromConnection()
: Utility for extracting Netty channels using reflectionTechnical Implementation Details
Maintenance Event Flow
Setup Phase:
Trigger Phase:
FaultInjectionClient
to trigger migrate+bind operationsMIGRATED
notification (migration complete)MOVING
notification (endpoint rebind with new address)Validation Phase:
Cleanup Verification:
Address Type Validation
The implementation includes sophisticated address parsing and validation:
3. Fixing multiple tests and lots of refactoring.