influxdb output: treat field type conflicts as a successful write
If we write a batch of points and get a "field type conflict" error message in return, we should drop the entire batch of points because this indicates that one or more points have a type that doesnt match the database. These errors will never go away on their own, and InfluxDB will successfully write the points that dont have a conflict. closes #2245
This commit is contained in:
parent
6df3f0fdae
commit
80411f99f0
|
@ -84,6 +84,7 @@ plugins, not just statsd.
|
||||||
- [#1814](https://github.com/influxdata/telegraf/issues/1814): snmp: ensure proper context is present on error messages.
|
- [#1814](https://github.com/influxdata/telegraf/issues/1814): snmp: ensure proper context is present on error messages.
|
||||||
- [#2299](https://github.com/influxdata/telegraf/issues/2299): opentsdb: add tcp:// prefix if no scheme provided.
|
- [#2299](https://github.com/influxdata/telegraf/issues/2299): opentsdb: add tcp:// prefix if no scheme provided.
|
||||||
- [#2297](https://github.com/influxdata/telegraf/issues/2297): influx parser: parse line-protocol without newlines.
|
- [#2297](https://github.com/influxdata/telegraf/issues/2297): influx parser: parse line-protocol without newlines.
|
||||||
|
- [#2245](https://github.com/influxdata/telegraf/issues/2245): influxdb output: fix field type conflict blocking output buffer.
|
||||||
|
|
||||||
## v1.1.2 [2016-12-12]
|
## v1.1.2 [2016-12-12]
|
||||||
|
|
||||||
|
|
|
@ -200,8 +200,6 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error {
|
||||||
p := rand.Perm(len(i.conns))
|
p := rand.Perm(len(i.conns))
|
||||||
for _, n := range p {
|
for _, n := range p {
|
||||||
if e := i.conns[n].Write(bp); e != nil {
|
if e := i.conns[n].Write(bp); e != nil {
|
||||||
// Log write failure
|
|
||||||
log.Printf("E! InfluxDB Output Error: %s", e)
|
|
||||||
// If the database was not found, try to recreate it
|
// If the database was not found, try to recreate it
|
||||||
if strings.Contains(e.Error(), "database not found") {
|
if strings.Contains(e.Error(), "database not found") {
|
||||||
if errc := createDatabase(i.conns[n], i.Database); errc != nil {
|
if errc := createDatabase(i.conns[n], i.Database); errc != nil {
|
||||||
|
@ -209,6 +207,15 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error {
|
||||||
i.Database)
|
i.Database)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if strings.Contains(e.Error(), "field type conflict") {
|
||||||
|
log.Printf("E! Field type conflict, dropping conflicted points: %s", e)
|
||||||
|
// setting err to nil, otherwise we will keep retrying and points
|
||||||
|
// w/ conflicting types will get stuck in the buffer forever.
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// Log write failure
|
||||||
|
log.Printf("E! InfluxDB Output Error: %s", e)
|
||||||
} else {
|
} else {
|
||||||
err = nil
|
err = nil
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue