Merge pull request #9591 from hashicorp/dnephin/state-store-coordinates-iter
state: do not delete from inside an iteration (coordinates)
This commit is contained in:
commit
13706b9be4
|
@ -740,7 +740,11 @@ func (s *Store) deleteNodeTxn(tx WriteTxn, idx uint64, nodeName string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed coordinate lookup: %s", err)
|
return fmt.Errorf("failed coordinate lookup: %s", err)
|
||||||
}
|
}
|
||||||
|
var coordsToDelete []interface{}
|
||||||
for coord := coords.Next(); coord != nil; coord = coords.Next() {
|
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 {
|
if err := tx.Delete("coordinates", coord); err != nil {
|
||||||
return fmt.Errorf("failed deleting coordinate: %s", err)
|
return fmt.Errorf("failed deleting coordinate: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue