influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.02k stars 3.56k forks source link

Duplicate values stored in database #13989

Open hardiksondagar opened 5 years ago

hardiksondagar commented 5 years ago

I've run into one critical issue and found that influx has duplicate value on a single tag - timestamp pair.

> SELECT "time", "2001", "SensorId" FROM dbname.autogen.Reading WHERE "SensorId" = '17186' AND time >= 1557953095198000000 and time <= 1557953103853000000 GROUP BY "SensorId";
name: Reading
tags: SensorId=17186
time                2001              SensorId
----                ----              --------
1557953099000000000 330638950.4       17186
1557953099000000000 330967451.0651455 17186

Influx Version: 1.7.4

Actual Behaviour Duplicate field values stored for one tag and timestamp pair.

Expected Behaviour The value should have override and only one value should have present.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

empumd commented 5 years ago

I encountered the same problem with version 2.0 when writing duplicate data via command line.

painhardcore commented 5 years ago

Same here 1.7.6 Have 2 points with the same timestamp and tag but with different values.

painhardcore commented 5 years ago

@russorat, please add this issue to the bug scope.

painhardcore commented 5 years ago

I'm not sure, but #15197 related only to 2.0. What about other versions?

russorat commented 5 years ago

@painhardcore @empumd thanks for responding! happy to reopen.

Could you add the line protocol / code / api calls that reproduce this issue?

painhardcore commented 5 years ago

Can't provide the exact reproducible case. We've had this situation in past. Here saved logs: Both flux and influxQL return the same results like this

> select * from "mm_mmmmmmmmmmm_mmmmmm_mmmm_mmmmmmmm" WHERE time > '2019-08-01T11:25:00Z' AND time < '2019-08-01T16:25:00Z'

name: mm_mmmmmmmmmmm_mmmmmm_mmmm_mmmmmmmm
time                _flag _someval
----                ----- ----------
1564662000000000000 1000  1564658400000000000
1564662000000000000 0     1564658400000000000
1564665600000000000 1000  1564662000000000000
1564665600000000000 0     1564662000000000000
1564669200000000000 1000  1564665600000000000
1564669200000000000 0     1564665600000000000
1564672800000000000 1000  1564669200000000000
1564672800000000000 0     1564669200000000000
1564676400000000000 1000  1564672800000000000
1564676400000000000 0     1564672800000000000

InfluxDB version 1.7.6

empumd commented 5 years ago

i used a bash script like the following:

while read line; do echo $line; curl "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" --header "Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxx" --data-binary @$line

I'm not able to reliably recreate the error, though there have been duplicate values added on at least 2 separate imports.

InfluxDB version 2.0