Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.9.3-HEAD] Quoted measurement names fail #3681

Closed
yvesf opened this issue Aug 15, 2015 · 5 comments
Closed

[0.9.3-HEAD] Quoted measurement names fail #3681

yvesf opened this issue Aug 15, 2015 · 5 comments
Assignees
Milestone

Comments

@yvesf
Copy link

yvesf commented Aug 15, 2015

The document lists this example

"measurement\ with\ quotes",tag\ key\ with\ spaces=tag\,value\,with"commas" field_key\\\\="string field value, only \" need be quoted"

However, already this smaller one fails:

curl -v 'http://localhost:8086/write?db=test' --data-binary '"test",tag=123 value=1123'

Every line starting with " fails because the scanLine function in tsdb/points.go tries to find out if it was quoted (line 710), thus raising a runtime error: index out of range

@beckettsean
Copy link
Contributor

@yvesf I cannot reproduce this on 0.9.2, the writes succeed for me just fine.

Using curl:

 curl -v 'http://localhost:8086/write?db=test' --data-binary '"test",tag=123 value=1123'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8086 (#0)
> POST /write?db=test HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:8086
> Accept: */*
> Content-Length: 25
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 25 out of 25 bytes
< HTTP/1.1 204 No Content
< Request-Id: e255d5b4-4509-11e5-8015-000000000000
< X-Influxdb-Version: 0.9.2
< Date: Mon, 17 Aug 2015 18:00:46 GMT
< 
* Connection #0 to host localhost left intact

> use test
Using database test
> show measurements
name: measurements
------------------
name
"test"

using the CLI:

> insert "hello",foo=bar value=12
> show measurements
name: measurements
------------------
name
"hello"
...

I cannot successfully query those measurements because the parser is upset with the double-quote, but that's different from not being able to write the point.

@beckettsean
Copy link
Contributor

Opened #3698 for the query bug.

@yvesf
Copy link
Author

yvesf commented Aug 17, 2015

Hi @beckettsean, you are right it's working fine in v0.9.2. However, in current HEAD it's not working. I think it's failing since cb7f0b8.

@beckettsean beckettsean changed the title Quoted measurement names fail [0.9.3-HEAD] Quoted measurement names fail Aug 17, 2015
@beckettsean
Copy link
Contributor

Still working in the most recent nightly:

root@sean-test:/opt/influxdb# ./influx
Connected to http://localhost:8086 version 0.9.3-nightly-1548f62
InfluxDB shell 0.9.3-nightly-1548f62
> create database quotes
> use quotes
Using database quotes
> insert "quotes",foo=bar value=12i
> show measurements
name: measurements
------------------
name
"quotes"

@jwilder is this commit: cb7f0b8 in the most recent 0.9.3 nightly?

@beckettsean beckettsean reopened this Aug 17, 2015
@yvesf
Copy link
Author

yvesf commented Aug 17, 2015

In my case it also succeed using the 'influx' client because it packs a whitespace at the beginning. Compare the to requests in the following

curl -v 'http://localhost:8086/write?db=test' --data-binary "\"quotes\",foo=bar value=12i" (crash)

POST /write?db=test HTTP/1.1
User-Agent: curl/7.38.0
Host: localhost:8086
Accept: */*
Content-Length: 26
Content-Type: application/x-www-form-urlencoded

"quotes",foo=bar value=12i

success using influx insert command

POST /write?consistency=any&db=test&precision=n&rp= HTTP/1.1
Host: localhost:8086
User-Agent: InfluxDBShell/0.9
Content-Length: 28
Content-Type: 
Accept-Encoding: gzip

 "quotes",foo=bar value=12i

(note content length 28 = 26 + space + newline)

@jwilder jwilder self-assigned this Aug 18, 2015
@jwilder jwilder added this to the 0.9.3 milestone Aug 18, 2015
jwilder added a commit that referenced this issue Aug 18, 2015
If the measurement started with a quote, a panic would happen.  This
is a reegression due to cb7f0b8.

This also uncovered that measurement names were being escaped incorrectly.
The escape codes for tag and fields also includes `=` and '"` which should
not be escaped for measurement names.

Fixes #3681
jwilder added a commit that referenced this issue Aug 19, 2015
If the measurement started with a quote, a panic would happen.  This
is a reegression due to cb7f0b8.

This also uncovered that measurement names were being escaped incorrectly.
The escape codes for tag and fields also includes `=` and '"` which should
not be escaped for measurement names.

Fixes #3681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants