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

Enforce retention policy minimum (currently 1 hour) #1902

Merged
merged 6 commits into from
Mar 10, 2015
Merged

Conversation

corylanou
Copy link
Contributor

This is a follow up PR for ##1897

@corylanou corylanou self-assigned this Mar 10, 2015
@@ -10,6 +10,10 @@ import (
"github.com/influxdb/influxdb/client"
)

const (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this could be defined in a better place -- server.go, with the other constants there. It makes more sense to group it with those, as opposed to here. influxdb.go is in the same package as server.go so you can still reference the constant in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think I had a "duh" moment there. I thought I looked for constants but I clearly missed them. Moved.

@otoolep
Copy link
Contributor

otoolep commented Mar 10, 2015

Looks good though I think the constant is defined in the wrong file.

@@ -74,6 +74,9 @@ var (
// ErrRetentionPolicyNameRequired is returned using a blank shard space name.
ErrRetentionPolicyNameRequired = errors.New("retention policy name required")

// ErrRetentionPolicyMinDuration is returned when creating replicaiton policy with a duration smaller than RetenionPolicyMinDuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: typo in comment.

@otoolep
Copy link
Contributor

otoolep commented Mar 10, 2015

+1

@toddboom
Copy link
Contributor

👍

corylanou added a commit that referenced this pull request Mar 10, 2015
Enforce retention policy minimum (currently 1 hour)
@corylanou corylanou merged commit bb35021 into master Mar 10, 2015
@corylanou corylanou deleted the rp-1hour-min branch March 10, 2015 19:20
@corylanou corylanou removed the review label Mar 10, 2015
@jnutzmann
Copy link

After this was added, I get this response

{"results":[{"error":"retention policy duration needs to be at least 1h0m0s"}]}

to this query:

CREATE RETENTION POLICY rp_inf ON properties DURATION INF REPLICATION 1

This query succeeds in 0.9.0-rc10, but fails in the current master.

@otoolep
Copy link
Contributor

otoolep commented Mar 11, 2015

Thanks @jnutzmann -- you have spotted a regression. I have opened #1918 and this will be fixed soon.

@jogo
Copy link

jogo commented Apr 2, 2015

I was testing things out from influxql/INFLUXQL.md and tried CREATE RETENTION POLICY "10m.events" ON somedb DURATION 10m REPLICATION 2; which failed due to the 1 hour retention policy minimum.

  • It would be nice to document the why behind this limit so it doesn't appear so arbitrary.
  • Looks like some of the in tree documentation needs updating.

Why is there a 1 hour minimum, and what about testing. I wanted to create a very short retention policy (say a minute or two) to test out how the retention policy works without having to wait for ever.

@otoolep
Copy link
Contributor

otoolep commented Apr 2, 2015

This minimum is in place to prevent an excessive number of shards from being created. If the retention period was 1 minute long, the system would create new shards every minute.

Since retention enforcement is based on the timestamp within the event, not reception time, simply write data older than 1 hour (assuming you've selected a retention period of 1 hour) and that data will be evicted within minutes.

@jogo
Copy link

jogo commented Apr 2, 2015

I see shards are pre-created now and I assume creating a shard is relatively expensive.

Documenting this trick somewhere in testing related documentation would be nice. Along with documenting why this new limit was added.

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

Successfully merging this pull request may close these issues.

5 participants