Sometimes, float measurements are integers (no decimals)
HTTP INSERT POST BODY :
node13 B6A2021050000=25,BE6B820050000=24.6
results in an error :
write failed: field type conflict: input field "B6A2021050000" on measurement "node13" is type int64, already exists as type float
And if it's the first insert : field type is wrongly defined as integer
Following inserts errors :
write failed: field type conflict: input field "BE6B820050000" on measurement "node13" is type float64, already exists as type integer
InfluxDB version : 0.9.1
This is known and documented behavior, not a bug. The first point written to a series (on a given shard) determines the data type of the field(s).
The way to avoid it is to write all floats with a decimal, so rather than B6A2021050000=25 you write B6A2021050000=25.0, which parses as a float and will work.
Because of this and a host of other issues, we're considering ditching int64 as a user data type entirely and just making every number in the system (other than timestamps) a float64. There should be an explicit decision one way or the other with 0.9.3 in mid-August.
See "Fields" on https://influxdb.com/docs/v0.9/write_protocols/line.html for the documentation
What concerns me with this behavior, notably with telegraf, is that it causes the whole batch insert to fail, not only the data which conflicts:
2015/11/20 16:31:25 Error in output [influxdb-0]: Could not write to any InfluxDB server in cluster, retrying in 12.713705331s
@beckettsean int and float has no difference. So, i think we can make it coherent to float. This also eases the situation above.
@andyxning The information in this issue is out of date. Integers can be written to line protocol by specifying an i after the number while any field value without an i is considered a float.
https://docs.influxdata.com/influxdb/v0.13/troubleshooting/frequently_encountered_issues/#writing-integers
What about the JSON protocol, @gunnaraasen?
@abrkn The JSON write protocol was deprecated with version 0.9.1, disabled in InfluxDB 0.11, and removed in version 0.12: https://docs.influxdata.com/influxdb/v0.12/write_protocols/json/
Most helpful comment
@andyxning The information in this issue is out of date. Integers can be written to line protocol by specifying an
iafter the number while any field value without aniis considered a float.https://docs.influxdata.com/influxdb/v0.13/troubleshooting/frequently_encountered_issues/#writing-integers