Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tom-ch1 opened this issue Jan 1, 2025 · 1 comment

Comments

@tom-ch1
Copy link

tom-ch1 commented Jan 1, 2025

Trying to delete data using the /query 1.x compatibility API, 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: a79a2a1) 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 <my 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"}]}

@tom-ch1
Copy link
Author

tom-ch1 commented Jan 2, 2025

Additional information:

  • if the token has only read permission on my_db, the error message is correct: "error":"insufficient permissions"
  • if the token has only write permission on my_db, the error message is incorrect (this bug): "error":"default retention policy not set for: my_db"
  • if the token has read and write permission on my_db, the query is executed successfully (data is deleted).

So when deleting data via a query, you need read permission. This should be documented, because it is not intuitive and the error message is misleading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant