influxdata / influxdata/influxdb

1.x compatibility API silently ignores "h" and "m" precision when writing

Open
#21,625 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/2.x area/compat-v1x area/writes
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

After successfuly writing data to a 2.0.7 instance, using the 1.x compatibiliy with "m" precision I was unable to find it.

It turned out that because `models/points.go:GetPrecisionMultiplier()` silently considers anything that is not "us|ms|s" as "ns", data was written without proper multiplication of the timestamp.

I'm not sure what was the reason behind the dropping of these precisions (in 65bf4bb383693bb49e674e8cfc0a615a01388b12).
Anyway, I think that even if there is one, then either [documentation](https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/write/) should be corrected, and write handler probably made to detect this and fail,
or better, it should be supported (possibly only when using 1.x compatibility API if this is an issue for v2)

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

1. Write data with "m" or "h" precision and a timestamp

__Expected behavior:__
be able to get this data via a query for original timestamp

__Actual behavior:__
timestamp is incorrect.

__Environment info:__
* InfluxDB version: InfluxDB 2.0.7 (git: 2a45f0c037) build_date: 2021-06-04T19:17:40Z / latest docker 2.0 image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in models/points.go at GetPrecisionMultiplier(), then trace the 1.x compatibility write handler. Reproduce a timestamped write with m and h precision against the documented API behavior; done means the behavior is explicit and the original timestamp can be queried or the request fails clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, 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.