Improves existing RP checking when creating a DB. #6202
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
Currently when running an InfluxQL(
CREATE DATABASE IF NOT EXISTS xyz WITH DURATION 24h0m0s REPLICATION 1 NAME one_day_only
) to create a database which does not provideshard duration
a default value will be set for it via:meta.Data.CreateRetentionPolicy(...)
sets a default value (currently 1 hour).When re-running the same InfluxQL mentioned above, an error will occur (
retention policy conflicts with an existing policy
) when it shouldn't, based on the expected behavior ofIF NOT EXISTS
& confirmed by the docs:shard duration
value mentioned above.TL:DR, this PR improves the checking for existing retention policy within
meta.Client.CreateDatabaseWithRetentionPolicy(...)
to consider the defaultshard duration
value which is set when none is provided when creating a database.