Skip to content

Commit 31f2dbd

Browse files
committed
Resolve merge conflicts with upstream/master
1 parent 2f9ce8b commit 31f2dbd

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

internal/pool/pool.go

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ var (
2424
// ErrPoolTimeout timed out waiting to get a connection from the connection pool.
2525
ErrPoolTimeout = errors.New("redis: connection pool timeout")
2626

27-
<<<<<<< HEAD
27+
// ErrConnUnusableTimeout is returned when a connection is not usable and we timed out trying to mark it as unusable.
28+
ErrConnUnusableTimeout = errors.New("redis: timed out trying to mark connection as unusable")
29+
30+
// errHookRequestedRemoval is returned when a hook requests connection removal.
31+
errHookRequestedRemoval = errors.New("hook requested removal")
32+
33+
// errConnNotPooled is returned when trying to return a non-pooled connection to the pool.
34+
errConnNotPooled = errors.New("connection not pooled")
2835
// Global callback for connection state changes (set by otel package)
2936
connectionStateChangeCallback func(ctx context.Context, cn *Conn, fromState, toState string)
3037

@@ -46,16 +53,6 @@ var (
4653
// Global callback for maintenance notifications (set by otel package)
4754
// Parameters: ctx, cn, notificationType
4855
maintenanceNotificationCallback func(ctx context.Context, cn *Conn, notificationType string)
49-
=======
50-
// ErrConnUnusableTimeout is returned when a connection is not usable and we timed out trying to mark it as unusable.
51-
ErrConnUnusableTimeout = errors.New("redis: timed out trying to mark connection as unusable")
52-
53-
// errHookRequestedRemoval is returned when a hook requests connection removal.
54-
errHookRequestedRemoval = errors.New("hook requested removal")
55-
56-
// errConnNotPooled is returned when trying to return a non-pooled connection to the pool.
57-
errConnNotPooled = errors.New("connection not pooled")
58-
>>>>>>> upstream/master
5956

6057
// popAttempts is the maximum number of attempts to find a usable connection
6158
// when popping from the idle connection pool. This handles cases where connections
@@ -75,7 +72,6 @@ var (
7572
noExpiration = maxTime
7673
)
7774

78-
<<<<<<< HEAD
7975
// SetConnectionStateChangeCallback sets the global callback for connection state changes.
8076
// This is called by the otel package to register metrics recording.
8177
func SetConnectionStateChangeCallback(fn func(ctx context.Context, cn *Conn, fromState, toState string)) {
@@ -144,8 +140,6 @@ var timers = sync.Pool{
144140
},
145141
}
146142

147-
=======
148-
>>>>>>> upstream/master
149143
// Stats contains pool state information and accumulated stats.
150144
type Stats struct {
151145
Hits uint32 // number of times free connection was found in the pool
@@ -961,26 +955,20 @@ func (p *ConnPool) putConn(ctx context.Context, cn *Conn, freeTurn bool) {
961955
p.connsMu.Unlock()
962956
p.idleConnsLen.Add(1)
963957
}
964-
<<<<<<< HEAD
965958
p.idleConnsLen.Add(1)
966959

967960
// Notify metrics: connection moved from used to idle
968961
if connectionStateChangeCallback != nil {
969962
connectionStateChangeCallback(ctx, cn, "used", "idle")
970963
}
971-
=======
972-
>>>>>>> upstream/master
973964
} else {
974965
shouldCloseConn = true
975-
<<<<<<< HEAD
966+
p.removeConnWithLock(cn)
976967

977968
// Notify metrics: connection removed (used -> nothing)
978969
if connectionStateChangeCallback != nil {
979970
connectionStateChangeCallback(ctx, cn, "used", "")
980971
}
981-
=======
982-
p.removeConnWithLock(cn)
983-
>>>>>>> upstream/master
984972
}
985973

986974
if freeTurn {
@@ -995,8 +983,6 @@ func (p *ConnPool) putConn(ctx context.Context, cn *Conn, freeTurn bool) {
995983
}
996984

997985
func (p *ConnPool) Remove(ctx context.Context, cn *Conn, reason error) {
998-
<<<<<<< HEAD
999-
=======
1000986
p.removeConnInternal(ctx, cn, reason, true)
1001987
}
1002988

@@ -1017,7 +1003,6 @@ func (p *ConnPool) removeConnInternal(ctx context.Context, cn *Conn, reason erro
10171003
hookManager.ProcessOnRemove(ctx, cn, reason)
10181004
}
10191005

1020-
>>>>>>> upstream/master
10211006
p.removeConnWithLock(cn)
10221007

10231008
if freeTurn {

maintnotifications/handoff_worker.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,12 @@ func (hwm *handoffWorkerManager) performHandoffInternal(
466466
conn.ClearHandoffState()
467467
internal.Logger.Printf(ctx, logs.HandoffSucceeded(connID, newEndpoint))
468468

469-
<<<<<<< HEAD
469+
// successfully completed the handoff, no retry needed and no error
470470
// Notify metrics: connection handoff succeeded
471471
if handoffCallback := pool.GetConnectionHandoffCallback(); handoffCallback != nil {
472472
handoffCallback(ctx, conn, "main")
473473
}
474474

475-
=======
476-
// successfully completed the handoff, no retry needed and no error
477-
>>>>>>> upstream/master
478475
return false, nil
479476
}
480477

redis.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,14 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
559559
case maintnotifications.ModeEnabled:
560560
// enabled mode, fail the connection
561561
c.optLock.Unlock()
562-
<<<<<<< HEAD
562+
cn.GetStateMachine().Transition(pool.StateClosed)
563563

564564
// Record handshake failure metric
565565
if errorCallback := pool.GetErrorCallback(); errorCallback != nil {
566566
// Handshake failures are internal errors with no retry attempts
567567
errorCallback(ctx, "HANDSHAKE_FAILED", cn, "HANDSHAKE_FAILED", true, 0)
568568
}
569569

570-
=======
571-
cn.GetStateMachine().Transition(pool.StateClosed)
572-
>>>>>>> upstream/master
573570
return fmt.Errorf("failed to enable maintnotifications: %w", maintNotifHandshakeErr)
574571
default: // will handle auto and any other
575572
// Disabling logging here as it's too noisy.

0 commit comments

Comments
 (0)