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

fix #2251: fix panic when changing default RP #2255

Merged
merged 1 commit into from
Apr 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/influxd/server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,6 +1160,17 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
queryOne: true,
expected: `{"results":[{}]}`,
},
{
name: "Ensure default retention policy can be changed",
query: `ALTER RETENTION POLICY rp1 ON mydatabase DEFAULT`,
queryOne: true,
expected: `{"results":[{}]}`,
},
{
name: "Make sure default retention policy actually changed",
query: `SHOW RETENTION POLICIES mydatabase`,
expected: `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,false],["rp1","0",1,true]]}]}]}`,
},
{
name: "Ensure retention policy with acceptable retention can be created",
query: `CREATE RETENTION POLICY rp2 ON mydatabase DURATION 30d REPLICATION 1`,
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ type RetentionPolicyUpdate struct {
// UpdateRetentionPolicy updates an existing retention policy on a database.
func (s *Server) UpdateRetentionPolicy(database, name string, rpu *RetentionPolicyUpdate) error {
// Enforce duration of at least retentionPolicyMinDuration
if *rpu.Duration < retentionPolicyMinDuration && *rpu.Duration != 0 {
if rpu.Duration != nil && *rpu.Duration < retentionPolicyMinDuration && *rpu.Duration != 0 {
return ErrRetentionPolicyMinDuration
}

Expand Down