influxdata / influxdata/influxdb

time as field key name: only an error for single field points

Open
#23,024 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Observation:__
`time` is not allowed as field key name.
If a metric point has only a single field with key name `time` one gets an error.
If a metric point has several fields, and one field key is `time`, the POST is accepted, and the `time` field silently ignored.
That is imho inconsistent behavior.

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

Case of single field
```
curl -i -XPOST "http://localhost:8086/write?db=test" \
--header "Authorization: Token ${INFLUX_TOKEN}" \
--data-binary 'weather,location=ca time=82 1640692157000000000'

returns
HTTP/1.1 422 Unprocessable Entity
"code":"unprocessable entity",
"message":"failure writing points to database:
partial write: invalid field name:
input field \"time\" on measurement \"weather\"
is invalid dropped=1"
```
Case of multiple fields:
```
curl -i -XPOST "http://localhost:8086/write?db=test" \
--header "Authorization: Token ${INFLUX_TOKEN}" \
--data-binary 'weather,location=ca time=82,temperature=82 1640692157000000000'

returns
HTTP/1.1 204 No Content
```

__Expected behavior:__
The POST should return with a error in both cases.

__Actual behavior:__
The `time` fields was silently dropped.

__Environment info:__
If seen that with
- Influx V1.8
- Influx V2.1 via the v1 compatibility interface
- Influx V2.1 vla the `api/v2/write` interface

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two curl requests against the v1 compatibility and /api/v2/write endpoints, comparing the single-field and multi-field results. Trace the field-name validation and partial-write behavior involved in these write paths. Done means both requests reject a time field and no such field is silently dropped.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.