influxdata / influxdata/influx-cli

influx v1 shell returns wrong timestamps

Open
#555 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

When querying data in the v1 shell the timestanps are wrong:

# environment
* OS: Debian: GNU/Linux 12 (bookworm)
* influx version: Influx CLI dev (git: a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:34:32Z
* retention periods for the bucket in question:
```
SHOW RETENTION POLICIES ON my_db
name,tags,name,duration,shardGroupDuration,replicaN,default
,,autogen,0s,168h0m0s,replicaN,true
```

# steps to reproduce
1. `influx v1 shell`
2. `use "my_db"`
3. `precision ns`
4. `SELECT time,temp FROM "heating" WHERE temp=0`

# expected result
the returned timestamps should be correct and in nanosecond precision

# actual result
the returned timestamps are incorrect
example:
* timestamp for first entry is: "1735325299900396800.0000000000"
* however, it should be: "1735325299900396750"

# proof that timestamps are incorrect
* if I query the database using the REST API, I get the correct timestamp:
```
curl --get 'http://my_server:8086/query' --header 'Authorization: Token ' --header 'Accept: application/csv' --header 'Content-type: application/json' --data-urlencode 'orgID=m<_org' --data-urlencode 'db=my_db' --data-urlencode 'epoch=ns' --data-urlencode 'q=SELECT time,temp FROM heating WHERE temp = 0'
```
the corresponding entry is: `heating,,1735325299900396750,0`
* if I now try to delete the entry using influx v1 shell according to the timestamp, the entry gets deleted only if I indicate the correct timestamp:
* `DELETE FROM "heating" WHERE time = 1735325299900396800` --> entry is not deleted
* `DELETE FROM "heating" WHERE time = 1735325299900396750` --> entry is deleted

Contributor guide

No contributing guide indexed for this repository

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 by reproducing the `influx v1 shell` query with `precision ns` and compare its timestamp with the REST API result shown in the issue. Trace the v1 shell's timestamp formatting or conversion path; done means the shell reports `1735325299900396750` without changing the value used by deletes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.