Retention policy parameter ignored in queries?
Using master:
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE test_database"
curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY custom_retention_policy ON test_database DURATION 1w REPLICATION 1"
curl -XPOST "http://localhost:8086/write?db=test_database&rp=custom_retention_policy" --data-binary "cpu value=61"
Issuing a query like this:
curl -G http://localhost:8086/query --data-urlencode "q=SELECT * FROM cpu" --data-urlencode "db=test_database" --data-urlencode "rp=custom_retention_policy"
returns an empty result.
On the other hand:
curl -G http://localhost:8086/query --data-urlencode "q=SELECT * FROM custom_retention_policy.cpu" --data-urlencode "db=test_database"
returns the expected result.
Am I missing something?
There is no support for specifying the retention policy as a URL query parameter. Only your second example is valid.
On Monday, October 12, 2015, Paul Goldbaum [email protected] wrote:
Using master:
curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE test_database" curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY custom_retention_policy ON test_database DURATION 1w REPLICATION 1"
curl -XPOST "http://localhost:8086/write?db=test_database&rp=custom_retention_policy" --data-binary "cpu value=61"
Issuing a query like this:
curl -G http://localhost:8086/query --data-urlencode "q=SELECT * FROM cpu" --data-urlencode "db=test_database" --data-urlencode "rp=custom_retention_policy"
returns an empty result.
An the other hand:
curl -G http://localhost:8086/query --data-urlencode "q=SELECT * FROM custom_retention_policy.cpu" --data-urlencode "db=test_database" --data-urlencode "custom_retention_policy"
return the expected result.
Am I missing something?
— Reply to this email directly or view it on GitHub https://github.com/influxdb/influxdb/issues/4413.
@otoolep, ok that clears it up :) I'm not sure if I misunderstood the documentation then. From https://influxdb.com/docs/v0.9/query_language/query_syntax.html#retention-policy
Retention Policy
Use the rp=<retention_policy> query string parameter to supply a target retention policy for the query. If not specified, the default retention policy for the target database will be used.
is this outdated information?
Well, that is news to me. Let me double check the code for you. I may be mistaken.
On Monday, October 12, 2015, Paul Goldbaum [email protected] wrote:
@otoolep https://github.com/otoolep, ok that clears it up :) I'm not sure if I misunderstood the documentation then. From https://influxdb.com/docs/v0.9/query_language/query_syntax.html#retention-policy
Retention Policy Use the rp=<retention_policy> query string parameter to supply a target retention policy for the query. If not specified, the default retention policy for the target database will be used.
is this outdated information?
— Reply to this email directly or view it on GitHub https://github.com/influxdb/influxdb/issues/4413#issuecomment-147445394.
The documents are incorrect. As I originally stated rp is only supported as a query parameter for writes, not queries.
I will open a ticket regarding the docs.
Got it. Thanks for the help!