diff --git a/cmd/influxd/extra.go b/cmd/influxd/extra.go index bbe74ebaaf..3aa2ab0554 100644 --- a/cmd/influxd/extra.go +++ b/cmd/influxd/extra.go @@ -198,18 +198,12 @@ func (s *store) GroupRead(ctx context.Context, req *ReadRequest) (GroupResultSet } const ( - fieldTagKey = "_f" - measurementTagKey = "_m" - fieldKey = "_field" measurementKey = "_measurement" valueKey = "_value" ) var ( - fieldTagKeyBytes = []byte(fieldTagKey) - measurementTagKeyBytes = []byte(measurementTagKey) - fieldKeyBytes = []byte(fieldKey) measurementKeyBytes = []byte(measurementKey) ) @@ -315,7 +309,7 @@ func (c *indexSeriesCursor) Next() *SeriesRow { //TODO(edd): check this. c.row.SeriesTags = copyTags(c.row.SeriesTags, sr.Tags) c.row.Tags = copyTags(c.row.Tags, sr.Tags) - c.row.Field = string(c.row.Tags.Get(fieldTagKeyBytes)) + c.row.Field = string(c.row.Tags.Get(tsdb.FieldKeyTagKeyBytes)) normalizeTags(c.row.Tags) @@ -10467,14 +10461,14 @@ func toStoragePredicate(n semantic.Expression, objectName string) (*Node, error) return &Node{ NodeType: NodeTypeTagRef, Value: &Node_TagRefValue{ - TagRefValue: fieldTagKey, + TagRefValue: tsdb.FieldKeyTagKey, }, }, nil case measurementKey: return &Node{ NodeType: NodeTypeTagRef, Value: &Node_TagRefValue{ - TagRefValue: measurementTagKey, + TagRefValue: tsdb.MeasurementTagKey, }, }, nil case valueKey: diff --git a/tsdb/explode.go b/tsdb/explode.go index b6fac78706..d3dce92724 100644 --- a/tsdb/explode.go +++ b/tsdb/explode.go @@ -6,6 +6,17 @@ import ( "github.com/influxdata/platform/models" ) +// Values used to store the field key and measurement name as tags. +const ( + FieldKeyTagKey = "_f" + MeasurementTagKey = "_m" +) + +var ( + FieldKeyTagKeyBytes = []byte(FieldKeyTagKey) + MeasurementTagKeyBytes = []byte(MeasurementTagKey) +) + // ExplodePoints creates a list of points that only contains one field per point. It also // moves the measurement to a tag, and changes the measurement to be the provided argument. func ExplodePoints(org, bucket []byte, points []models.Point) ([]models.Point, error) { @@ -23,8 +34,8 @@ func ExplodePoints(org, bucket []byte, points []models.Point) ([]models.Point, e itr := pt.FieldIterator() for itr.Next() { tags = tags[:0] - tags = append(tags, models.NewTag([]byte("_f"), itr.FieldKey())) - tags = append(tags, models.NewTag([]byte("_m"), pt.Name())) + tags = append(tags, models.NewTag(FieldKeyTagKeyBytes, itr.FieldKey())) + tags = append(tags, models.NewTag(MeasurementTagKeyBytes, pt.Name())) pt.ForEachTag(func(k, v []byte) bool { tags = append(tags, models.NewTag(k, v)) return true diff --git a/tsdb/shard.go b/tsdb/shard.go index 60f195b1d7..0379f6cfce 100644 --- a/tsdb/shard.go +++ b/tsdb/shard.go @@ -224,11 +224,6 @@ func (s *Shard) Index() (Index, error) { // WritePoints will write the raw data points and any new metadata to the index in the shard. func (s *Shard) WritePoints(points []models.Point) error { - points, err := explodePoints([]byte("insert-org-bucket"), points) - if err != nil { - return err - } - collection := NewSeriesCollection(points) j := 0