fix: prevent an infinite loop in measurementFieldSetChangeMgr (#25155) (#25156) (#25164)

The measurementFieldSetChangeMgr has a possibly infinite loop
if the writeRequests channel is closed while in the inner
loop to consolidate write requests. We need to check for ok
on channel receive and exit the loop when ok is false.

closes https://github.com/influxdata/influxdb/issues/25151

(cherry picked from commit 176fca2138)

closes https://github.com/influxdata/influxdb/issues/25153

(cherry picked from commit 031f394d2c)

closes https://github.com/influxdata/influxdb/issues/25154
BNP_v2.7.8-test
davidby-influx 2024-07-16 08:36:52 -07:00 committed by GitHub
parent e9e0f744fa
commit 8e0d754c1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -2276,10 +2276,12 @@ func (fscm *measurementFieldSetChangeMgr) appendToChangesFile(first writeRequest
// requests
for {
select {
case wr := <-fscm.writeRequests:
changes = append(changes, wr.changes)
errorChannels = append(errorChannels, wr.errorReturn)
continue
case wr, ok := <-fscm.writeRequests:
if ok {
changes = append(changes, wr.changes)
errorChannels = append(errorChannels, wr.errorReturn)
continue
}
default:
}
break