Skip to content

Commit

Permalink
Fix panic if the query key not exist (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
july2993 authored Sep 21, 2020
1 parent 8ca0da1 commit 81ec3eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cluster/api/binlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func (c *BinlogClient) updateStatus(ty string, nodeID string, state string) erro
return errors.AddStack(err)
}

if len(resp.Kvs) == 0 {
return errors.Errorf("no pump with node id: %v", nodeID)
}

var nodeStatus NodeStatus
err = json.Unmarshal(resp.Kvs[0].Value, &nodeStatus)
if err != nil {
Expand Down

0 comments on commit 81ec3eb

Please sign in to comment.