influxdata / influxdata/influx-cli

/query 1.x compatibility API fails to delete data with a false error: "default retention policy not set"

Open
#556 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
75
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Trying to delete data using the [/query 1.x compatibility API](https://docs.influxdata.com/influxdb/v2/api-guide/influxdb-1x/query/), fails with an incorrect error "default retention policy not set for: my_db"

# environment
* OS: Debian: GNU/Linux 12 (bookworm)
* influx version: Influx CLI dev (git: https://github.com/influxdata/influx-cli/commit/a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:34:32Z
* retention periods for the bucket in question:
```
SHOW RETENTION POLICIES ON my_db (queried also using the 1.x compatibility API)
name,tags,name,duration,shardGroupDuration,replicaN,default
,,autogen,0s,168h0m0s,replicaN,true
```
--> Is this also a bug? when executed in the v1 shell, the query returns:
```
SHOW RETENTION POLICIES ON my_db
name,duration,shardGroupDuration,replicaN,default
autogen,0s,168h0m0s,1,true
```

# steps to reproduce
1. execute a DELETE query using the /query 1.x compatibility API:
```
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=DELETE FROM heating WHERE time=1735492769351901200'
```
# expected result
data with the indicated timestamp is deleted

# actual result
the API returns:
`{"results":[{"statement_id":0,"error":"default retention policy not set for: my_db"}]}`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the /query 1.x compatibility API entry point and reproduce the DELETE request from the issue with the provided curl command. Trace why the configured default retention policy is not found; done means the indicated timestamp is deleted and the API no longer returns the false "default retention policy not set" error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.