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

Fix for escape fields when they are created in tsbd.Point #3043

Closed
wants to merge 1 commit into from
Closed

Fix for escape fields when they are created in tsbd.Point #3043

wants to merge 1 commit into from

Conversation

michal800106
Copy link

I receive panic error when I'm trying to write message with commas and internal quotas.

# curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE DATABASE mmm"
{"results":[{}]}
# curl -XPOST 'http://localhost:8086/write?db=mmm' --data-binary '@t.g'
curl: (52) Empty reply from server
# cat t.g
{
  "database" : "mmm",
  "retentionPolicy" : "",
  "points" :  [ {
    "measurement" : "http_status",
    "tags" : {
      "service" : "identity-service",
      "hostname" : "host1",
      "url" : "http://localhost:35774/"
    },
    "timestamp" : "2015-06-16T09:28:26.000Z",
    "fields" : {
      "value_meta" : "{Hello\"{,}\" World}",
      "value" : 1.0
    }
  } ],
  "tags" : { }
}

The problem is that with creation tsbd.Point:

func NewPoint(name string, tags Tags, fields Fields, time time.Time) Point {
        return &point{
                key:    makeKey([]byte(name), tags),
                time:   time,
                fields: fields.MarshalBinary(),
        }
}

In function MarshalBinary is error. Because there are added quotas on begin and end of field.
Problem is that we receive string:

"{Hello"{,}" World}"

instead of expected by function scanFieldValue

"{Hello\"{\\,}\" World}"

The biggest problem occurs later because with wrong string function scanFieldValue splits string in comma and we receive:

panic: unsupported value type during encode fields: <nil>

goroutine 29 [running]:
github.com/influxdb/influxdb/tsdb.(*FieldCodec).EncodeFields(0xc2081084b0, 0xc208146e70, 0x0, 0x0, 0x0, 0x0, 0x0)

@otoolep
Copy link
Contributor

otoolep commented Jun 18, 2015

@jwilder

@michal800106
Copy link
Author

I rebased to your master and added new commit to fix what is escaped and in which order.
I create new pull request #3073

@michal800106 michal800106 deleted the fix_escape_field_value branch June 20, 2015 11:50
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

Successfully merging this pull request may close these issues.

2 participants