Skip to content

Commit

Permalink
fix PrimaryIsNotServing logic
Browse files Browse the repository at this point in the history
Signed-off-by: deepthi <deepthi@planetscale.com>
  • Loading branch information
deepthi committed Aug 23, 2024
1 parent 81ed314 commit 4f5c31b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/vt/discovery/keyspace_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,10 @@ func (kew *KeyspaceEventWatcher) PrimaryIsNotServing(ctx context.Context, target
if state, ok := ks.shards[target.Shard]; ok {
// If the primary tablet was present then externallyReparented will be non-zero and
// currentPrimary will be not nil.
return state.currentPrimary, !state.serving && !ks.consistent && state.externallyReparented != 0 && state.currentPrimary != nil

// serving := state.serving && ks.consistent && state.externallyReparented != 0 && state.currentPrimary != nil
// notServing := !state.serving || !ks.consistent || state.externallyReparented == 0 || state.currentPrimary == nil
return state.currentPrimary, !state.serving || !ks.consistent || state.externallyReparented == 0 || state.currentPrimary == nil
}
return nil, false
}
Expand Down

0 comments on commit 4f5c31b

Please sign in to comment.