influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

V2.0.3 OSS: tags not disappearing after deleting by predicate

Open lephisto opened this issue 4 years ago • 19 comments

Steps to reproduce: List the minimal actions needed to reproduce the behavior.

  1. Have data with tags in a measurement.
  2. Delete Data with a specific tag value:
influx delete --bucket "telegraf/autogen" --predicate '_measurement="devax_forecast" AND fcdate="fc_21012021"' -o NETZConsult --start '1970-01-01T00:00:00Z' --stop '2025-12-31T23:59:00Z')
  1. Check of Tag value is removed from the DB:
show tag values from devax_forecast WITH key="fcdate"

and it's still showing up:

key    |value
fcdate |fc_01022021
fcdate |fc_02022021
fcdate |fc_03022021
fcdate |fc_04022021
fcdate |fc_21012021
fcdate |fc_22012021
fcdate |fc_23012021
fcdate |fc_24012021
fcdate |fc_25012021
fcdate |fc_26012021
fcdate |fc_27012021
fcdate |fc_27012021_erst
fcdate |fc_28012021
fcdate |fc_29012021
fcdate |fc_30012021

Expected behavior: The tag should disappear.

Actual behavior: The tag is still present, even if no records are assigned that tag.

Environment info:

  • System info: Linux 4.4.0-198-generic x86_64
  • InfluxDB version: InfluxDB 2.0.3 (git: fe04d346df) build_date: 2020-12-15T01:00:16Z
  • Other relevant environment details: Runs from debian Packages on a Ubuntu 16.04.7

lephisto avatar Feb 05 '21 09:02 lephisto

Update: Issue still present in Influx 2.0.4 OSS

lephisto avatar Feb 16 '21 23:02 lephisto

This issue is affecting our team as well and we cannot delete data using the delete with predicate option. This is becoming a show stopper for us. The documentation indicates that this should work but it does not:

We are trying something simple like: influx delete --bucket example-bucket
--start '1970-01-01T00:00:00Z'
--stop '2021-03-03T00:00:00Z'
--predicate 'DataSetId="78b6fdef-6908-4f26-85a2-e61be2f91a6d" AND _field="foo"'

The data is not deleted.

If we remove the _field="foo" then it works to remove the data tagged with DataSetId="78b6fdef-6908-4f26-85a2-e61be2f91a6d". This was tested and verified by our dev teams as broken in 2.0.3, 2.0.4.

So we can't delete data, which is killing us. Can anyone on influx team give an update on this. It seems to be an issue that has been around for a while an NOT addressed properly. Documentation is not accurate.

nickwbaker avatar Mar 05 '21 14:03 nickwbaker

@nickwbaker deleting by _field is a separate issue, see #20399

danxmoran avatar Mar 05 '21 14:03 danxmoran

Added https://github.com/influxdata/docs-v2/issues/2571 to update the documentation to include this.

russorat avatar May 20 '21 19:05 russorat

@nickwbaker the way the influxdb storage engine works, deleting by a specific field is not possible.

As for a workaround, you will need to write only the data you need to a new bucket and drop the old one.

from(bucket: "old_bucket") 
  |> range(start: -100y) 
  |> filter(fn: (r) =>  _field != "foo") 
  |> to(bucket: "new_bucket")

you can also do it from the command line by exporting the data from the old bucket as LP using the https://docs.influxdata.com/influxdb/v2.0/reference/cli/influxd/inspect/export-lp/ command and then ingesting that into a new bucket.

I know it's not the answer you wanted, but hopefully this can unblock you in the short term.

russorat avatar May 20 '21 19:05 russorat

@russorat I just want to clarify that the comment of @nickwbaker isn't exactly what I am experiencing. I experience the bug, that tag values still show up even if all data that might ever have been assigned to it has been deleted.

lephisto avatar May 21 '21 16:05 lephisto

Also having this issue. Version info:

# influx version
Influx CLI 2.0.3 (git: fe04d346df) build_date: 2020-12-15T01:00:16Z

I have a tag with two keys that need to be dropped as they contain invalid data that is interfering with other queries, but I cannot. I'm nearly at the point of running sed on the db files to get rid of them!

MajorDallas avatar Jun 02 '21 21:06 MajorDallas

I was able to delete tags using a similar command…

influx version
Influx CLI 2.0.7 (git: 2a45f0c037) build_date: 2021-06-04T19:17:40Z
influx delete --bucket "ups" --predicate '_field="watts"' -o Primary --start "1970-01-01T00:00:00Z" --stop "2025-12-31T23:59:00Z"

Actually... this is a false result. At first it seemed like it was working, but after doing some more queries, it isn't working.

midzelis avatar Jul 27 '21 02:07 midzelis

I ran into the same problem. I used "drop series from 'measurement' where 'tag_key'='tag_value'". I dropped the series, but the tag values were still there.

22ha avatar Jan 07 '22 10:01 22ha

Anyone manage to fix this ? @lephisto

I have the issue on 2.3.0

bygmakavi avatar Aug 02 '22 13:08 bygmakavi

Reporting this is still an issue on OSS 2.6.0

ValkyrieOps avatar May 11 '23 14:05 ValkyrieOps

influxdb2 2.7.0-1 Still an issue.

peycho avatar May 19 '23 06:05 peycho

I too appear to be struggling with this.... Deleted this data successfull but the tag still exists

root@8ab339126cfd:/# influx delete --bucket telegraf -o PBCSD -t **** --start '1970-01-01T00:00:00Z' --stop $(date +"%Y-%m-%dT%H:%M:%SZ") --predicate '_measurement="an-hosts" AND "system-name"="drac-esxfhtst10"'

image

mattjudson avatar Jul 29 '23 14:07 mattjudson

Same here please fix this ...

MattBrth avatar Feb 01 '24 14:02 MattBrth

OSS 2.7.5 It continues to be problem. The tag is never deleted

basalisco avatar Apr 06 '24 21:04 basalisco