-
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
Make default retention policy configurable #2676
Comments
+1 |
+1 |
I'm taking a crack at this, getting pretty close... |
retention-policy = "168h" shard-duration = "24h" Fixes influxdata#2676
👍 |
The reason we've held off on this is that what if the user subsequently alters the default retention policy? Should the system always override on restart? We can make it so that the config settings only apply when the retention policy is created. |
Just my thought but I would rather have the default retention policy applied at the creation of a database, and if someone wants to alter it they can do it manually. |
This would definitely be a useful feature. The steps to implement this are as follows:
|
+1 for applying default policy only on database creation. On it! |
@otoolep what would be the desired defaults? |
Actually, @otoolep I was looking at #2805 and read the following by @pauldix:
Does it still applies? If so, this issue should be closed. Otherwise, #2805 should be reviewed once more because it seems to deliver. I would just add a couple tests where we guarantee a couple things:
|
I can check with @pauldix but I think this is actually OK. We've done some similar things recently, and the key thing to understand is that the retention policy duration only applies on creation. If you look at the code, the duration is set to something, and right now it's set to infinity (0). This change would be easy enough -- one simply defines the key, and if it's not set, one goes what the code does now. The PR you referenced is pretty close, except the default time is wrong. I need to check with @pauldix to see if I can get him to agree if this change is actually OK. In practise I can see why users like the default retention policy, but don't like that it's always of infinite retention. |
Sure. Keep us posted. |
What's the desired result of this setting? That every time you create a database it has a given retention duration? I think the more appropriate thing to do is to add something to the |
@pauldix something like |
I was wondering if should really be the full command, including name etc. But that could be over the top.
might be more in line with our current standards -- the optional keywords come after the mandatory keywords, and we don't use |
@otoolep can you please lead the way spec'ing this and I'll give it a try? |
Sure. The first step would be understanding how to add a command to our parser. It's not that difficult actually, if you can follow an example. For example this PR shows how the Note that
|
Once the parsing and AST code has been completed, it's pretty easy to work with the CreateDatabase type, and just check for the presence of the require attibutes, and when creating the database, create the retention policy (today that is checked via a flag in the |
@otoolep thank you so much! Seems really doable even for a (Go and InfluxDB) newbie like me. Some questions though:
|
@pires -- actually if you checked the code you are right, I got it backwards. The parser is not smart, and will error if you supply what I thought it was. As for the time spec, I was just being brief. Yes, it should follow the Go spec as you suggest. |
@otoolep owning it. Should I report back to this issue? |
So I am guessing we want:
To be honest, once you know how to add commands to the parser it's not a big deal to modify if we change our mind during development. |
That sounds good, thanks @pires |
Yes, your pointers made whoever takes this task life easier. Again, I'm going for it. Thank you! |
For example:
Introduce two variables in config.toml file
"DefaultRetentionPolicy": "7d",
"DefaultShardDuration": "1d",
to make default retention configurable.
The text was updated successfully, but these errors were encountered: