influxdata / influxdb

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

InfluxDB 2: The Delete predicate doesn't work - always delete all data #19545

Closed bednar closed 4 years ago

bednar commented 4 years ago

Steps to reproduce:

  1. Write data
  2. Delete with specified predicate
  3. All data all gone
# Prepare data
--> POST http://127.0.0.1:9999/api/v2/write?org=b491a83d18e3ded4&bucket=h2o1599741493685-IT&precision=s
--> h2o,location=a level=1.0 10
h2o,location=a level=2.0 20
h2o,location=b level=3.0 30
h2o,location=c level=4.0 40
<-- 204 No Content http://127.0.0.1:9999/api/v2/write?org=b491a83d18e3ded4&bucket=h2o1599741493685-IT&precision=s 

### Delete with specified predicate
--> POST http://127.0.0.1:9999/api/v2/delete?org=b491a83d18e3ded4&bucket=7f336ed3e8c66848
--> {"start":"1970-01-01T00:00:01Z","stop":"1970-01-01T00:00:50Z","predicate":"location=\"a\""}
<-- 204 No Content http://127.0.0.1:9999/api/v2/delete?org=b491a83d18e3ded4&bucket=7f336ed3e8c66848 

### Query Data
--> POST http://127.0.0.1:9999/api/v2/query?org=b491a83d18e3ded4
--> {
    "query": "from(bucket:\"h2o1599741493685-IT\") |> range(start: 1970-01-01T00:00:00.000000001Z)",
    "type": "flux",
    "dialect": {
        "header": true,
        "delimiter": ",",
        "annotations": ["datatype", "group", "default"],
        "commentPrefix": "#",
        "dateTimeFormat": "RFC3339"
    }
}
<-- 200 OK http://127.0.0.1:9999/api/v2/query?org=b491a83d18e3ded4 
<-- []

Expected behavior: Delete only data that are specified by predicate.

Actual behavior: Delete all data.

Environment info:

timhallinflux commented 4 years ago

we've disabled delete with predicate for now. It will be re-enabled post GA here: https://github.com/influxdata/influxdb/issues/19635