Skip to content

Commit

Permalink
Merge pull request #9591 from hashicorp/dnephin/state-store-coordinat…
Browse files Browse the repository at this point in the history
…es-iter

state: do not delete from inside an iteration (coordinates)
  • Loading branch information
dnephin authored Jan 19, 2021
2 parents a432730 + 810424a commit 6ecf3b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions agent/consul/state/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ func (s *Store) deleteNodeTxn(tx WriteTxn, idx uint64, nodeName string) error {
if err != nil {
return fmt.Errorf("failed coordinate lookup: %s", err)
}
var coordsToDelete []interface{}
for coord := coords.Next(); coord != nil; coord = coords.Next() {
coordsToDelete = append(coordsToDelete, coord)
}
for _, coord := range coordsToDelete {
if err := tx.Delete("coordinates", coord); err != nil {
return fmt.Errorf("failed deleting coordinate: %s", err)
}
Expand Down

0 comments on commit 6ecf3b7

Please sign in to comment.