Skip to content

Commit

Permalink
Fix line protocol accepting tags with no values
Browse files Browse the repository at this point in the history
If a tag with no value was in the middle of all the tags, it would
get accepted as valid incorrectly.

Fixes #4421
  • Loading branch information
jwilder committed Oct 13, 2015
1 parent f0efd1f commit e0ece9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- [#4280](https://github.com/influxdb/influxdb/issues/4280): Only drop points matching WHERE clause
- [#4410](https://github.com/influxdb/influxdb/pull/4410): Fix infinite recursion in statement string(). Thanks @kostya-sh
- [#4360](https://github.com/influxdb/influxdb/issues/4360): Aggregate Selectors overwrite values during post-processing
- [#4421](https://github.com/influxdb/influxdb/issues/4421): Fix line protocol accepting tags with no values

## v0.9.4 [2015-09-14]

Expand Down
4 changes: 2 additions & 2 deletions models/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ func scanKey(buf []byte, i int) (int, []byte, error) {
i += 1
equals += 1

// Check for "cpu,a=1,b= value=1"
if i < len(buf) && buf[i] == ' ' {
// Check for "cpu,a=1,b= value=1" or "cpu,a=1,b=,c=foo value=1"
if i < len(buf) && (buf[i] == ' ' || buf[i] == ',') {
return i, buf[start:i], fmt.Errorf("missing tag value")
}
continue
Expand Down
5 changes: 5 additions & 0 deletions models/points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ func TestParsePointMissingTagValue(t *testing.T) {
if err == nil {
t.Errorf(`ParsePoints("%s") mismatch. got nil, exp error`, `cpu,host=serverA,region= value=1i`)
}
_, err = models.ParsePointsString(`cpu,host=serverA,region=,zone=us-west value=1i`)
if err == nil {
t.Errorf(`ParsePoints("%s") mismatch. got nil, exp error`, `cpu,host=serverA,region=,zone=us-west value=1i`)
}

}

func TestParsePointMissingFieldName(t *testing.T) {
Expand Down

1 comment on commit e0ece9f

@DanielMorsing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Please sign in to comment.