Merge pull request #2852 from influxdb/panic_change_rp
Don't panic when altering retention policypull/2805/merge
commit
6ce7c6e4ad
|
@ -8,6 +8,7 @@
|
|||
- [2838](https://github.com/influxdb/influxdb/pull/2838) -- Set auto-created retention policy period to infinite.
|
||||
- [2829](https://github.com/influxdb/influxdb/pull/2829) -- Re-enable Graphite support as a new Service-style component.
|
||||
- [2814](https://github.com/influxdb/influxdb/issues/2814) -- Convert collectd to a service.
|
||||
- [2852](https://github.com/influxdb/influxdb/pull/2852) -- Don't panic when altering retention policies. Thanks for the report @huhongbo
|
||||
|
||||
## v0.9.0-rc32 [2015-06-07]
|
||||
|
||||
|
|
|
@ -367,9 +367,9 @@ func TestStatementExecutor_ExecuteStatement_AlterRetentionPolicy(t *testing.T) {
|
|||
t.Fatalf("unexpected database: %s", database)
|
||||
} else if name != "rp0" {
|
||||
t.Fatalf("unexpected name: %s", name)
|
||||
} else if *rpu.Duration != 7*24*time.Hour {
|
||||
} else if rpu.Duration != nil && *rpu.Duration != 7*24*time.Hour {
|
||||
t.Fatalf("unexpected duration: %v", *rpu.Duration)
|
||||
} else if *rpu.ReplicaN != 2 {
|
||||
} else if rpu.ReplicaN != nil && *rpu.ReplicaN != 2 {
|
||||
t.Fatalf("unexpected replication factor: %v", *rpu.ReplicaN)
|
||||
}
|
||||
return nil
|
||||
|
@ -387,6 +387,16 @@ func TestStatementExecutor_ExecuteStatement_AlterRetentionPolicy(t *testing.T) {
|
|||
if res := e.ExecuteStatement(stmt); res.Err != nil {
|
||||
t.Fatalf("unexpected error: %s", res.Err)
|
||||
}
|
||||
|
||||
stmt = influxql.MustParseStatement(`ALTER RETENTION POLICY rp0 ON foo DURATION 7d`)
|
||||
if res := e.ExecuteStatement(stmt); res.Err != nil {
|
||||
t.Fatalf("unexpected error: %s", res.Err)
|
||||
}
|
||||
|
||||
stmt = influxql.MustParseStatement(`ALTER RETENTION POLICY rp0 ON foo REPLICATION 2`)
|
||||
if res := e.ExecuteStatement(stmt); res.Err != nil {
|
||||
t.Fatalf("unexpected error: %s", res.Err)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure a ALTER RETENTION POLICY statement returns errors from the store.
|
||||
|
|
|
@ -719,7 +719,7 @@ func (s *Store) UpdateRetentionPolicy(database, name string, rpu *RetentionPolic
|
|||
}
|
||||
|
||||
var replicaN *uint32
|
||||
if rpu.Duration != nil {
|
||||
if rpu.ReplicaN != nil {
|
||||
value := uint32(*rpu.ReplicaN)
|
||||
replicaN = &value
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue