-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] Impossible to insert string value test\" as anything other than the last field #3682
Comments
@jwilder did your recent PR around parsing escape characters fix this? |
@beckettsean no. Still working on this one. |
Hi,
Expected:
If there is a problem then I assume it's a regression of the previous bug, otherwise feel free to move it to a new issue. |
@yvesf there is a bug here, but there's a trivial workaround, as well. Inserting a single trailing backslash works as long as there are no more fields to parse. It appears that the comma separating the fields complicates the parsing. All of this is expected behavior:
However, if there's a field after the one with the escaped trailing backslash the two fields get combined into one (and the second field value is silently dropped.)
Escaping something other than backslash works as expected:
Repro'd using 0.9.3 |
As long as the escaped backslash is the final field value things work as expected:
|
This is what I found as fix and test-case. I think it makes sense to add a test like this one to points_test.go. diff --git a/tsdb/points.go b/tsdb/points.go
index dd8dbb6..7fd22cb 100644
--- a/tsdb/points.go
+++ b/tsdb/points.go
@@ -848,0 +849,6 @@ func scanFieldValue(buf []byte, i int) (int, []byte) {
+ // Accept escape char followed by escape char
+ if buf[i] == '\\' && i+1 < len(buf) && buf[i+1] == '\\' {
+ i += 2
+ continue
+ }
+
diff --git a/tsdb/points_test.go b/tsdb/points_test.go
index f3cf93d..7fcfcbb 100644
--- a/tsdb/points_test.go
+++ b/tsdb/points_test.go
@@ -646,0 +647,8 @@ func TestParsePointUnescape(t *testing.T) {
+ test(t, `test field1="value1\\",field2="value2"`,
+ tsdb.NewPoint(
+ "test",
+ tsdb.Tags{},
+ tsdb.Fields{
+ "field1" : "value1\\",
+ },
+ time.Unix(0, 0))) |
This is still an issue on
|
At the moment, it isn't possible for us to fix this without breaking the line protocol. I'm closing this in favor of #6037 which is a discussion about a v2 of the line protocol. |
I found no way to insert the value
test\"
in a string field. I think the escaping for fieldValue (intsdb.scanFieldValue(buf []byte, i int) (int, []byte)
) does not allow that.Let's try:
The text was updated successfully, but these errors were encountered: