Skip to content

Commit

Permalink
discovery: fix crash with nil server vschema
Browse files Browse the repository at this point in the history
Signed-off-by: Vicent Marti <[email protected]>
  • Loading branch information
vmg committed Jan 30, 2024
1 parent 77dc0c9 commit 1d22eed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/vt/discovery/keyspace_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ func (kss *keyspaceState) isServing() bool {
// In addition, the traffic switcher updates SrvVSchema when the DeniedTables attributes in a Shard record is
// modified.
func (kss *keyspaceState) onSrvVSchema(vs *vschemapb.SrvVSchema, err error) bool {
// the vschema can be nil if the server is currently shutting down
if vs == nil {
return true
}

Check warning on line 535 in go/vt/discovery/keyspace_events.go

View check run for this annotation

Codecov / codecov/patch

go/vt/discovery/keyspace_events.go#L532-L535

Added lines #L532 - L535 were not covered by tests

kss.mu.Lock()
defer kss.mu.Unlock()
kss.moveTablesState, _ = kss.getMoveTablesStatus(vs)
Expand Down

0 comments on commit 1d22eed

Please sign in to comment.