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

Add default column to SHOW RETENTION POLICIES #1931

Merged
merged 3 commits into from Mar 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@
- [#1758](https://github.com/influxdb/influxdb/pull/1758): Add Graphite Integration Test.
- [#1929](https://github.com/influxdb/influxdb/pull/1929): Default Retention Policy incorrectly auto created.
- [#1930](https://github.com/influxdb/influxdb/pull/1930): Auto create database for graphite if not specified.
- [#1931](https://github.com/influxdb/influxdb/pull/1931): Add default column to SHOW RETENTION POLICIES.

### Features
- [#1902](https://github.com/influxdb/influxdb/pull/1902): Enforce retention policies to have a minimum duration.
Expand Down
4 changes: 2 additions & 2 deletions cmd/influxd/server_integration_test.go
Expand Up @@ -686,7 +686,7 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
{
name: "Check for default retention policy",
query: `SHOW RETENTION POLICIES mydatabase`,
expected: `{"results":[{"series":[{"columns":["name","duration","replicaN"],"values":[["default","0",1]]}]}]}`,
expected: `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,true]]}]}]}`,
},
{
name: "Ensure retention policy with infinite retention can be created",
Expand Down Expand Up @@ -1027,7 +1027,7 @@ func Test_ServerSingleGraphiteIntegration_NoDatabase(t *testing.T) {
}

// Need to wait for the database to get a default retention policy
expected = `{"results":[{"series":[{"columns":["name","duration","replicaN"],"values":[["default","0",1]]}]}]}`
expected = `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["default","0",1,true]]}]}]}`
got, ok = queryAndWait(t, nodes, "graphite", `show retention policies graphite`, expected, 2*time.Second)
if !ok {
t.Errorf(`Test "%s" failed, expected: %s, got: %s`, testName, expected, got)
Expand Down
2 changes: 1 addition & 1 deletion httpd/handler_test.go
Expand Up @@ -263,7 +263,7 @@ func TestHandler_RetentionPolicies(t *testing.T) {

if status != http.StatusOK {
t.Fatalf("unexpected status: %d", status)
} else if body != `{"results":[{"series":[{"columns":["name","duration","replicaN"],"values":[["bar","168h0m0s",1]]}]}]}` {
} else if body != `{"results":[{"series":[{"columns":["name","duration","replicaN","default"],"values":[["bar","168h0m0s",1,false]]}]}]}` {
t.Fatalf("unexpected body: %s", body)
}
}
Expand Down
6 changes: 4 additions & 2 deletions server.go
Expand Up @@ -2639,9 +2639,11 @@ func (s *Server) executeShowRetentionPoliciesStatement(q *influxql.ShowRetention
return &Result{Err: err}
}

row := &influxql.Row{Columns: []string{"name", "duration", "replicaN"}}
d := s.databases[q.Database]

row := &influxql.Row{Columns: []string{"name", "duration", "replicaN", "default"}}
for _, rp := range a {
row.Values = append(row.Values, []interface{}{rp.Name, rp.Duration.String(), rp.ReplicaN})
row.Values = append(row.Values, []interface{}{rp.Name, rp.Duration.String(), rp.ReplicaN, d.defaultRetentionPolicy == rp.Name})
}
return &Result{Series: []*influxql.Row{row}}
}
Expand Down