Skip to content

Commit 5c5d4dc

Browse files
committed
s/hitless/maintnotifications/
1 parent c4f8b99 commit 5c5d4dc

File tree

5 files changed

+34
-32
lines changed

5 files changed

+34
-32
lines changed

example/pubsub/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var cntSuccess atomic.Int64
1919
var startTime = time.Now()
2020

2121
// This example is not supposed to be run as is. It is just a test to see how pubsub behaves in relation to pool management.
22-
// It was used to find regressions in pool management in hitless mode.
22+
// It was used to find regressions in pool management in maintnotifications mode.
2323
// Please don't use it as a reference for how to use pubsub.
2424
func main() {
2525
startTime = time.Now()
@@ -35,12 +35,12 @@ func main() {
3535
},
3636
})
3737
_ = rdb.FlushDB(ctx).Err()
38-
hitlessManager := rdb.GetMaintNotificationsManager()
39-
if hitlessManager == nil {
40-
panic("hitless manager is nil")
38+
maintnotificationsManager := rdb.GetMaintNotificationsManager()
39+
if maintnotificationsManager == nil {
40+
panic("maintnotifications manager is nil")
4141
}
4242
loggingHook := maintnotifications.NewLoggingHook(int(logging.LogLevelDebug))
43-
hitlessManager.AddNotificationHook(loggingHook)
43+
maintnotificationsManager.AddNotificationHook(loggingHook)
4444

4545
go func() {
4646
for {

internal/interfaces/interfaces.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Package interfaces provides shared interfaces used by both the main redis package
2-
// and the hitless upgrade package to avoid circular dependencies.
2+
// and the maintnotifications upgrade package to avoid circular dependencies.
33
package interfaces
44

55
import (
@@ -16,7 +16,7 @@ type NotificationProcessor interface {
1616
GetHandler(pushNotificationName string) interface{}
1717
}
1818

19-
// ClientInterface defines the interface that clients must implement for hitless upgrades.
19+
// ClientInterface defines the interface that clients must implement for maintnotifications upgrades.
2020
type ClientInterface interface {
2121
// GetOptions returns the client options.
2222
GetOptions() OptionsInterface

internal/maintnotifications/logs/log_messages.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func CircuitBreakerCleanup(removed int, total int) string {
615615
return fmt.Sprintf("%s removed %d/%d entries %s", CircuitBreakerCleanupMessage, removed, total, string(data))
616616
}
617617

618-
// ExtractDataFromLogMessage extracts structured data from hitless log messages
618+
// ExtractDataFromLogMessage extracts structured data from maintnotifications log messages
619619
// Returns a map containing the parsed key-value pairs from the structured data section
620620
// Example: "conn[123] handoff started to localhost:6379 {"connID":123,"endpoint":"localhost:6379"}"
621621
// Returns: map[string]interface{}{"connID": 123, "endpoint": "localhost:6379"}

maintnotifications/README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
1-
# Hitless Upgrades
1+
# Maintenance Notifications
22

3-
Seamless Redis connection handoffs during cluster changes without dropping connections.
3+
Seamless Redis connection handoffs during cluster maintenance operations without dropping connections.
4+
5+
## ⚠️ **Important Note**
6+
**Maintenance notifications are currently supported only in standalone Redis clients.** Cluster clients (ClusterClient, FailoverClient, etc.) do not yet support this functionality.
47

58
## Quick Start
69

710
```go
811
client := redis.NewClient(&redis.Options{
912
Addr: "localhost:6379",
1013
Protocol: 3, // RESP3 required
11-
HitlessUpgrades: &hitless.Config{
12-
Mode: hitless.ModeEnabled,
14+
MaintNotifications: &maintnotifications.Config{
15+
Mode: maintnotifications.ModeEnabled,
1316
},
1417
})
1518
```
1619

1720
## Modes
1821

19-
- **`ModeDisabled`** - Hitless upgrades disabled
22+
- **`ModeDisabled`** - Maintenance notifications disabled
2023
- **`ModeEnabled`** - Forcefully enabled (fails if server doesn't support)
2124
- **`ModeAuto`** - Auto-detect server support (default)
2225

2326
## Configuration
2427

2528
```go
26-
&hitless.Config{
27-
Mode: hitless.ModeAuto,
28-
EndpointType: hitless.EndpointTypeAuto,
29+
&maintnotifications.Config{
30+
Mode: maintnotifications.ModeAuto,
31+
EndpointType: maintnotifications.EndpointTypeAuto,
2932
RelaxedTimeout: 10 * time.Second,
3033
HandoffTimeout: 15 * time.Second,
3134
MaxHandoffRetries: 3,
3235
MaxWorkers: 0, // Auto-calculated
3336
HandoffQueueSize: 0, // Auto-calculated
3437
PostHandoffRelaxedDuration: 0, // 2 * RelaxedTimeout
35-
LogLevel: logging.LogLevelError,
3638
}
3739
```
3840

@@ -56,7 +58,7 @@ client := redis.NewClient(&redis.Options{
5658

5759
## How It Works
5860

59-
1. Redis sends push notifications about cluster changes
61+
1. Redis sends push notifications about cluster maintenance operations
6062
2. Client creates new connections to updated endpoints
6163
3. Active operations transfer to new connections
6264
4. Old connections close gracefully
@@ -71,7 +73,7 @@ client := redis.NewClient(&redis.Options{
7173

7274
## Hooks (Optional)
7375

74-
Monitor and customize hitless operations:
76+
Monitor and customize maintenance notification operations:
7577

7678
```go
7779
type NotificationHook interface {
@@ -87,7 +89,7 @@ manager.AddNotificationHook(&MyHook{})
8789

8890
```go
8991
// Create metrics hook
90-
metricsHook := hitless.NewMetricsHook()
92+
metricsHook := maintnotifications.NewMetricsHook()
9193
manager.AddNotificationHook(metricsHook)
9294

9395
// Access collected metrics

maintnotifications/e2e/notiftracker_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ func setupNotificationHooks(client redis.UniversalClient, hooks ...maintnotifica
236236

237237
// setupRegularClientNotificationHook sets up notification hook for regular clients
238238
func setupRegularClientNotificationHook(client *redis.Client, hook maintnotifications.NotificationHook) {
239-
hitlessManager := client.GetMaintNotificationsManager()
240-
if hitlessManager != nil {
241-
hitlessManager.AddNotificationHook(hook)
239+
maintnotificationsManager := client.GetMaintNotificationsManager()
240+
if maintnotificationsManager != nil {
241+
maintnotificationsManager.AddNotificationHook(hook)
242242
} else {
243-
fmt.Printf("[TNH] Warning: Hitless manager not available for tracking\n")
243+
fmt.Printf("[TNH] Warning: Maintenance notifications manager not available for tracking\n")
244244
}
245245
}
246246

@@ -250,11 +250,11 @@ func setupClusterClientNotificationHook(client *redis.ClusterClient, hook maintn
250250

251251
// Register hook on existing nodes
252252
err := client.ForEachShard(ctx, func(ctx context.Context, nodeClient *redis.Client) error {
253-
hitlessManager := nodeClient.GetMaintNotificationsManager()
254-
if hitlessManager != nil {
255-
hitlessManager.AddNotificationHook(hook)
253+
maintnotificationsManager := nodeClient.GetMaintNotificationsManager()
254+
if maintnotificationsManager != nil {
255+
maintnotificationsManager.AddNotificationHook(hook)
256256
} else {
257-
fmt.Printf("[TNH] Warning: Hitless manager not available for tracking on node: %s\n", nodeClient.Options().Addr)
257+
fmt.Printf("[TNH] Warning: Maintenance notifications manager not available for tracking on node: %s\n", nodeClient.Options().Addr)
258258
}
259259
return nil
260260
})
@@ -265,11 +265,11 @@ func setupClusterClientNotificationHook(client *redis.ClusterClient, hook maintn
265265

266266
// Register hook on new nodes
267267
client.OnNewNode(func(nodeClient *redis.Client) {
268-
hitlessManager := nodeClient.GetMaintNotificationsManager()
269-
if hitlessManager != nil {
270-
hitlessManager.AddNotificationHook(hook)
268+
maintnotificationsManager := nodeClient.GetMaintNotificationsManager()
269+
if maintnotificationsManager != nil {
270+
maintnotificationsManager.AddNotificationHook(hook)
271271
} else {
272-
fmt.Printf("[TNH] Warning: Hitless manager not available for tracking on new node: %s\n", nodeClient.Options().Addr)
272+
fmt.Printf("[TNH] Warning: Maintenance notifications manager not available for tracking on new node: %s\n", nodeClient.Options().Addr)
273273
}
274274
})
275275
}

0 commit comments

Comments
 (0)