influxdata / influxdata/influxdb

Deletion via API responds 204 but does not delete

Open
#22,591 7 comments 0 reactions 0 assignees View on GitHub
area/2.x
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

### Setup
Running Docker image [influxdb:latest](https://hub.docker.com/layers/influxdb/library/influxdb/latest/images/sha256-d28012651eee76bd7b18c9f453db24a5dfefc3a9888225f97a02a01565c09050?context=explore) linux/amd64 version via Docker Desktop and Docker-compose on Windows 10 with WSL2 backend

Reported version info:
> ts=2021-09-28T16:50:59.231871Z lvl=info msg="Welcome to InfluxDB" log_id=0WsKun7l000 version=2.0.8 commit=e91d41810f build_date=2021-08-13T18:22:30Z

Relevant docker-compose:

> influxdb:
image: influxdb:latest
hostname: influxdb
ports:
- "8086:8086"
volumes:
- /run/desktop/mnt/host/c/infrastructure/influxdb:/var/lib/influxdb2
environment:
- INFLUXD_LOG_LEVEL=debug

I have attached the files being used by InfluxDB. [influxdb_files.zip](https://github.com/influxdata/influxdb/files/7245977/influxdb_files.zip)

Username is user, password is password. Token that should be available is:
> z2yImQ0GwQnfM5X2-SmP0l2ioWTx7w6xDtkhcacgEPVfUnLBwS79iYrm-I4IL-hvnWxOly8q-jY66CMVGiOhtw==

Influx CLI config creation:
> .\influx.exe config create --config-name default --host-url http://localhost:8086 --org default --token z2yImQ0GwQnfM5X2-SmP0l2ioWTx7w6xDtkhcacgEPVfUnLBwS79iYrm-I4IL-hvnWxOly8q-jY66CMVGiOhtw== --active

### Issue Replication

Using Influx CLI (version Influx CLI 2.1.1 (git: 535183b) build_date: 2021-09-22T18:32:23Z):
> .\influx.exe delete --bucket Tenant1 --start '2021-08-01T00:00:00Z' --stop '2021-08-02T00:00:00Z'

Response via CLI was empty. Debug logs from InfluxDB show:

> ts=2021-09-28T16:28:33.204170Z lvl=debug msg="user find by ID" log_id=0WsHS6Xl000 store=new took=0.016ms
> ts=2021-09-28T16:28:33.204340Z lvl=debug msg="org find" log_id=0WsHS6Xl000 store=new took=0.034ms
> ts=2021-09-28T16:28:33.204440Z lvl=debug msg="bucket find" log_id=0WsHS6Xl000 store=new took=0.070ms
> ts=2021-09-28T16:28:33.204473Z lvl=debug msg=Deleted log_id=0WsHS6Xl000 orgID=92f832d796c103c2 bucketID=b0cf74844a0697dd
> ts=2021-09-28T16:28:33.204607Z lvl=debug msg=Request log_id=0WsHS6Xl000 service=http method=POST host=localhost:8086 path=/api/v2/delete query="bucket=Tenant1&org=default" proto=HTTP/1.1 status_code=204 response_size=0 content_length=-1 referrer= remote=172.18.0.1:39768 user_agent=Date took=0.709ms body="{\"start\":\"2021-08-01T00:00:00Z\",\"stop\":\"2021-08-02T00:00:00Z\"}\n"

### Result

I would expect the data to be indiscriminately deleted in the specified date range. However, running a query

>.\influx.exe query 'from(bucket: \"Tenant1\") |> range(start: 2021-08-01T00:00:00Z, stop: 2021-08-02T00:00:00Z) |> filter(fn: (r) => r[\"_measurement\"] == \"14\")'

returns data within the specified range as seen below.

> Result: _result
> Table: keys: [_start, _stop, _field, _measurement, history_type, qualityTag, type]
> _start:time _stop:time _field:string _measurement:string history_type:string qualityTag:string type:string _value:float _time:time
> ------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------------- ------------------------------
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T05:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T06:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T07:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T08:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T09:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T10:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T11:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T12:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T13:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T14:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T15:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T16:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T17:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T18:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T19:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T20:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T21:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T22:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z VA 14 default 1 1 100 2021-08-01T23:00:00.000000000Z
> Table: keys: [_start, _stop, _field, _measurement, history_type, qualityTag, type]
> _start:time _stop:time _field:string _measurement:string history_type:string qualityTag:string type:string _value:int _time:time
> ------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- -------------------------- ------------------------------
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T05:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T06:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T07:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T08:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T09:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T10:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T11:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T12:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T13:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T14:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T15:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T16:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T17:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T18:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T19:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T20:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T21:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T22:00:00.000000000Z
> 2021-08-01T00:00:00.000000000Z 2021-08-02T00:00:00.000000000Z quality 14 default 1 1 1 2021-08-01T23:00:00.000000000Z

### Comments

I wanted to point out that this is extremely bizarre. I insert data into InfluxDB and have no problem clearing it out in most cases. This is the first time I'm running into behavior where it is simply not possible to delete the data even without a predicate. I was hoping for some sort of error message or log indicating the problem, but there's simply nothing from what I can see.

Please let me know how else I can help or provide more information. Thank you for your time.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the deletion with the provided Docker Compose setup, Influx CLI command, and POST /api/v2/delete request, then compare the debug log with a query over the same time range. Trace the deletion path from that API entry point and verify that the reported bucket data no longer appears in the query result.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
api, cli, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.