diff --git a/CHANGELOG.md b/CHANGELOG.md index febd753d45..e4e9b50956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - [#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. - [#1908](https://github.com/influxdb/influxdb/pull/1908): Cosmetic CLI output fixes. +- [#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. diff --git a/cmd/influxd/server_integration_test.go b/cmd/influxd/server_integration_test.go index 4ef8427fbc..ea749e04f1 100644 --- a/cmd/influxd/server_integration_test.go +++ b/cmd/influxd/server_integration_test.go @@ -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", @@ -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) diff --git a/httpd/handler_test.go b/httpd/handler_test.go index 8ad63948f4..6c57f6b556 100644 --- a/httpd/handler_test.go +++ b/httpd/handler_test.go @@ -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) } } diff --git a/server.go b/server.go index 9c2649a2f8..36a2974cea 100644 --- a/server.go +++ b/server.go @@ -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}} }