SHOW SERIES behaves strangly with multiple retention policies

Hi,

we noticed some strange behaviour of InfluxDB when we call SHOW SERIES on <measurement>.

When all data is in one RP (which isn’t default), we need to specify the RP in the statement like this: SHOW SERIES on <RP>.<measurement>.

But as soon, as there is also data in another RP, influxdb behaves differently and shows me all series in all RPs.

See the following script to reproduce what I mean:

#!/bin/bash
echo "prepare database ... (may cause error on first run)"
curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=DROP DATABASE "testdb"'
curl -XPOST 'http://localhost:8086/query' --data-urlencode 'q=CREATE DATABASE "testdb"'

echo "create 2 RPs - none of them are default"
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=create retention policy rp_1 on testdb duration 0m  replication 1'
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=create retention policy rp_2 on testdb duration 0m  replication 1'

echo "put data in first RP"
curl -XPOST "http://localhost:8086/write?db=testdb&precision=s&rp=rp_1" --data-binary 'mymeas,mytag=1 myfield=90'

echo "SHOW SERIES on default RP shows no data. ... OK there is no series in default RP:"
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=SHOW SERIES from mymeas'

echo "SHOW SERIES on RP with data shows my series:"
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=SHOW SERIES from rp_1.mymeas'

echo "So far everything is as I would expect. Now we create another series on the second RP:"
curl -XPOST "http://localhost:8086/write?db=testdb&precision=s&rp=rp_2" --data-binary 'mymeas,mytag=2 myfield=90'

echo "From now on, SHOW SERIES shows all series on all RPs, no matter which RP I query:"
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=SHOW SERIES from mymeas'
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=SHOW SERIES from rp_1.mymeas'
curl -XPOST 'http://localhost:8086/query?db=testdb' --data-urlencode 'q=SHOW SERIES from rp_2.mymeas'

So my question is: is this the intended behaviour?
We’d like to use SHOW SERIES in our application to determine for which tag/value-combinations there are series and we’d appreciate if the behaviour would be RP-specific.

1 Like