Did creating a retention policy just truncate all my data?

It appears that adding a one-year retention policy just truncated all my data. Did I goof? If so, how do I not do this next time?!?

Here’s a mildly edited script:

Initially, no retention policy in place:

> show retention policies on aquaviewer
name	duration	shardGroupDuration	replicaN	default
autogen	0		168h0m0s		1		true

The first entry is over a year old, the last entry is very recent (2018-06-16T18:58:49.157Z):

> precision rfc3339
> use aquaviewer
Using database aquaviewer
> select first("phValue") from "5x00Reading"
name: 5x00Reading
-----------------
time				first
2017-05-29T00:00:01.765Z	8.926681518554688

> select last("phValue") from "5x00Reading"     
name: 5x00Reading
-----------------
time				last
2018-06-16T18:58:49.157Z	6.224181652069092

Adding a retention policy:

> create retention policy  "a_year" on "aquaviewer" duration 52w replication 1 default

But now the oldest entry is only 30 minutes old (!!):

> select first("phValue") from "5x00Reading"
name: 5x00Reading
-----------------
time			first
2018-06-16T19:28:53.63Z	6.2368950843811035

> select last("phValue") from "5x00Reading"
name: 5x00Reading
-----------------
time				last
2018-06-16T19:38:52.357Z	48.784942626953125

… and there are very few entries:

> select count("phValue") from "5x00Reading"
name: 5x00Reading
-----------------
time			count
1970-01-01T00:00:00Z	540

If you run SHOW RETENTION POLICIES whats the output after you created your new RP?

I think the data should still be there you just apply the new RP to the database.

From within influx if you type:

use database.autogen and query one of the measurements in there then you should have the last piece of data recorded before changing the RP.

I’m pretty sure that should work, i’ve just checked in one of my DB’s, i pointed Telegraf to a different retention policy but can select data from either

Hope that helps.

PhilB