Make sure queries for missing measurements return a `200 OK` even when using a `GROUP BY *`.

pull/1859/head
Todd Persen 2015-03-05 17:04:05 -08:00
parent 7eb31f20a2
commit 93b56ca058
2 changed files with 3 additions and 3 deletions

View File

@ -1576,7 +1576,7 @@ func (s *Server) applyCreateMeasurementsIfNotExists(m *messaging.Message) error
// Create each new field.
mm := db.measurements[cm.Name]
if mm == nil {
panic(fmt.Sprintf("Measurement %s does not exist", cm.Name))
panic(fmt.Sprintf("measurement not found: %s", cm.Name))
}
for _, f := range cm.Fields {
if err := mm.createFieldIfNotExists(f.Name, f.Type); err != nil {
@ -1873,7 +1873,7 @@ func (s *Server) rewriteSelectStatement(stmt *influxql.SelectStatement) (*influx
mm := s.databases[db].measurements[m]
if mm == nil {
return nil, fmt.Errorf("measurement %s does not exist.", measurement.Name)
return nil, fmt.Errorf("measurement not found: %s", measurement.Name)
}
for _, f := range mm.Fields {

View File

@ -1035,7 +1035,7 @@ func TestServer_DropMeasurementSeriesTagsPreserved(t *testing.T) {
}
results = s.ExecuteQuery(MustParseQuery(`SELECT * FROM cpu`), "foo", nil)
if res := results.Results[0]; res.Err.Error() != `measurement "foo"."raw"."cpu" does not exist.` {
if res := results.Results[0]; res.Err.Error() != `measurement not found: "foo"."raw"."cpu"` {
t.Fatalf("unexpected error: %s", res.Err)
} else if len(res.Series) != 0 {
t.Fatalf("unexpected row count: %d", len(res.Series))