According to faq, if timestamp and tags are the same but fields are different, Influx will only store the new field set.
With simple ‘s’ precision - if I send 5 files to influx with different names as fields but all with the same tag set and timestamp (because they are being sent so fast, precision will not register it as a different second) - I will only get the last point sent.
So I send file 1, 2, 3, 4, 5 at the same time and in the same second, influx will only show I sent file 5.
According to the faq this is intended behavior:
How does InfluxDB handle duplicate points?
A point is uniquely identified by the measurement name, tag set, and timestamp.
If you submit a new point with the same measurement, tag set, and timestamp as an existing point,
the field set becomes the union of the old field set and the new field set,
where any ties go to the new field set. This is the intended behavior.
Then gives two suggestions to work around this:
- Introduce an arbitrary new tag to enforce uniqueness.
This would explode the index wouldn’t it?
- Increment the timestamp by a nanosecond.
This does not guarantee another client somewhere else incremented their time to the same nanosecond as well.
I’ve already invested a lot of time in my application not realizing this was the case but this is a complete show stopper for me unfortunately and I will have to rewrite a lot of code if there are no other ways around this.
It seems distressing though that unique fields are not considered unique and are overwritten by default. There may be a perfectly reasonable use case for this but at least for me and my project it’s unintuitive and completely broken.
Since it is in the faq this must be a very common question. It would be great if this behavior was configurable. Otherwise it’s going to take me weeks to work out another solution to logging my file uploads with my current setup.