-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
@@ -10,6 +10,10 @@ import ( | |||
"github.com/influxdb/influxdb/client" | |||
) | |||
|
|||
const ( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: typo in comment.
+1 |
👍 |
Enforce retention policy minimum (currently 1 hour)
After this was added, I get this response
to this query:
This query succeeds in 0.9.0-rc10, but fails in the current master. |
Thanks @jnutzmann -- you have spotted a regression. I have opened #1918 and this will be fixed soon. |
I was testing things out from
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. |
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. |
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. |
This is a follow up PR for ##1897