-
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
Modify the default retention policy name and make it configurable #6586
Conversation
This should be a good starting point. A lingering concern of mine with this is that some of the meta commands are not atomic and may work badly in clustering if an outage happens. It's possible to get into a state when creating a database with a default retention policy for the database and retention policy to be created, but the default isn't set. In that scenario, the default will never end up getting set without using a different command. In all likelyhood, the data store should probably support
I would think the second command should either return an error or set the default retention policy if it differs from "NAME". |
b837112
to
b27f7c2
Compare
@jsternberg I don't quite follow the cluster issue. Wouldn't any |
@beckettsean yes, but if it's three separate commands then 2 of the 3 could go through. It appears as though in clustering we have this as a single command rather than 3 though so I don't see it as an issue in the open source version. We still have the issue I mentioned in the open source version. If I run the two |
b27f7c2
to
7c83fff
Compare
@jsternberg shouldn't the second command fail because |
Right now the second command won't fail. Database creates don't fail unless there is something different in the command. Retention policy creates would be the same so, as long as the existing retention policy has the same parameters, it would not fail in its creation. The interesting part is that the second will work and create the retention policy, but it won't update the default retention policy even though it looks like it would. That's why I was asking if we should make it into an error if you try to use |
a2028d3
to
cb15307
Compare
@jsternberg thanks for the clarifications. I am not yet conversant with the new CREATE DATABASE syntax, it seems. I would propose that a second CREATE DATABASE statement with a conflicting retention policy name should throw an error. Not creating a database has immediate and obvious feedback and won't lead to anything difficult to undo. Inadvertently changing the default retention policy means data is suddenly going to the wrong place, and fixing it is painful. |
cb15307
to
49f5487
Compare
RetentionAutoCreate: true, | ||
LeaseDuration: toml.Duration(DefaultLeaseDuration), | ||
LoggingEnabled: DefaultLoggingEnabled, | ||
RetentionAutoCreate: true, |
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.
The idiom with Influx configs is to add DefaultDefaultRetentionPolicyName = "autogen"
as a constant (even though the name is silly), and then set DefaultRetentionPolicyName: DefaultDefaultRetentionPolicyName
in the constructor.
That way other packages can figure out the default without having to construct a config.
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.
Is DefaultRetentionPolicyName
fine? The double Default
seems a bit silly, but I'll do it if there's an objection to removing the extra default.
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.
It's fine, I just like consistency is all 😆
Aside from adding the I think it should have an extra pair of eyes on it given the changes to the meta client methods. |
49f5487
to
c1a54d0
Compare
Updating the PR with that change. |
c1a54d0
to
85038f0
Compare
85038f0
to
c3e785b
Compare
a023bda
to
83330fc
Compare
The default retention policy name is changed to "autogen" instead of "default" since it ends up being ambiguous when we tell a user to check the default retention policy, it is uncertain if we are referring to the default retention policy (which can be changed) or the retention policy with the name "default". Now the automatically generated retention policy name is "autogen". The default retention policy is now also configurable through the configuration file so an administrator can customize what they think should be the default. Fixes #3733.
83330fc
to
baaa782
Compare
@corylanou @dgnorton Can you take a look? |
ReplicaN: 1, | ||
}); err != nil { | ||
return nil, err | ||
} | ||
if err := data.SetDefaultRetentionPolicy(name, "default"); err != nil { | ||
if err := data.SetDefaultRetentionPolicy(name, ""); err != nil { |
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.
When database creation is complete, does this mean there is no default RP?
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.
No, this will set the default retention policy to be whatever the default retention policy name should be (from the config).
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.
Ah, I see it in the implementation of the method now.
👍 |
This needs to be communicated better. This will break every existing telegraf user. It also means that Telegraf 1.0.0-beta1 is not compatible with InfluxDB 1.0.0-beta1 😵 |
Since 1.0, InfluxDB has changed the name of the default retention policy from 'default' to 'autogen' to reduce naming confusion. This should be reflected in the default settings for this project. influxdata/influxdb#6586
The default retention policy name is changed to "autogen" instead of
"default" since it ends up being ambiguous when we tell a user to check
the default retention policy, it is uncertain if we are referring to the
default retention policy (which can be changed) or the retention policy
with the name "default".
Now the automatically generated retention policy name is "autogen".
The default retention policy is now also configurable through the
configuration file so an administrator can customize what they think
should be the default.
Fixes #3733.