influxdata / influxdata/influxdb
Point stopped getting stored in InfluxDB after working for 1.5 - 2 hours
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
I use influxdb golang client `github.com/influxdata/influxdb-client-go/v2 v2.12.3` to store sensors readings which are pushed periodically every 60 seconds.
I use the following version of InfluxDB
InfluxDB v2.7.1
Server: [407fa62]
Frontend: [9d25a2f]
I noticed that after a while, approx. 1.5 - 2 hours, the points do net get storred even though the WritePoint API call returns `nil` for success.
I used the frontend to validate absence of expected points. The data that comes in is exactly of the same format and processed exactly the same.
Here is the sample code I use to store the point:
```
func (i *influxDB) Store(m message.TimeSeriesRecord) error {
p := influxdb2.NewPointWithMeasurement(m.GetMeasurmentName())
dict := make(map[string]string)
lst := make([]string, 0)
for _, tag := range m.GetTag() {
dict[tag.Name] = tag.Value
lst = append(lst, tag.Name)
}
for _, l := range sort.SortMergeComparableSlice[string](lst) {
p.AddTag(l, dict[l])
}
for _, f := range m.GetField() {
p.AddField(f.Name, f.Value)
}
p.SetTime(m.GetTimestamp())
err := i.bucket.WritePoint(context.TODO(), p)
if err != nil {
glog.Errorf("Point for measurment: %s router: %s timestamp: %s failed with error: %+v", m.GetMeasurmentName(), m.GetNodeID(), m.GetTimestamp().Format(time.RFC3339), err)
} else {
glog.Infof("Point for measurment: %s router: %s timestamp: %s stored", m.GetMeasurmentName(), m.GetNodeID(), m.GetTimestamp().Format(time.RFC3339))
}
return err
}
```
InfluxDB server runs as a docker container, container log does not show any errors.
Contributor guide
Research direction
Start at the Store entry point and its influxdb2 WritePoint call, using the supplied client and InfluxDB versions. Reproduce the delayed-write behavior with the shown point construction, then compare client results with the Docker container logs and frontend data. Done means identifying why a nil result is followed by missing points and documenting a reproducible cause or fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100