Skip to content

Commit 2044458

Browse files
committed
feat: Export TimeBytes from tsdb, remove check that wasn't needed
1 parent 928b1c6 commit 2044458

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

tsdb/engine/tsm1/engine.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ var (
6464
// Ensure Engine implements the interface.
6565
_ tsdb.Engine = &Engine{}
6666
// Static objects to prevent small allocs.
67-
timeBytes = []byte("time")
6867
keyFieldSeparatorBytes = []byte(keyFieldSeparator)
6968
emptyBytes = []byte{}
7069
)
@@ -1360,11 +1359,6 @@ func (e *Engine) WritePoints(points []models.Point, tracker tsdb.StatsTracker) e
13601359
npoints++
13611360
var nValuesForPoint int64
13621361
for iter.Next() {
1363-
// Skip fields name "time", they are illegal
1364-
if bytes.Equal(iter.FieldKey(), timeBytes) {
1365-
continue
1366-
}
1367-
13681362
keyBuf = append(keyBuf[:baseLen], iter.FieldKey()...)
13691363

13701364
if e.seriesTypeMap != nil {

tsdb/field_validator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ func ValidateAndCreateFields(mf *MeasurementFields, point models.Point, skipSize
4242

4343
fieldKey := iter.FieldKey()
4444
// Skip fields name "time", they are illegal.
45-
if bytes.Equal(fieldKey, timeBytes) {
45+
if bytes.Equal(fieldKey, TimeBytes) {
4646
partialWriteError = &PartialWriteError{
4747
Reason: fmt.Sprintf(
48-
"invalid field name: input field \"%s\" on measurement \"%s\" is invalid. Field \"%s\" has been stripped from point.",
49-
"time", string(point.Name()), "time"),
48+
"invalid field name: input field \"%[1]s\" on measurement \"%s\" is invalid. Field \"%[1]s\" has been stripped from point.",
49+
string(fieldKey), string(point.Name())),
5050
Dropped: 0,
5151
}
5252
continue

tsdb/shard.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var (
8888

8989
var (
9090
// Static objects to prevent small allocs.
91-
timeBytes = []byte("time")
91+
TimeBytes = []byte("time")
9292
)
9393

9494
// A ShardError implements the error interface, and contains extra
@@ -631,7 +631,7 @@ func (s *Shard) validateSeriesAndFields(points []models.Point, tracker StatsTrac
631631
tags := p.Tags()
632632

633633
// Drop any series w/ a "time" tag, these are illegal
634-
if v := tags.Get(timeBytes); v != nil {
634+
if v := tags.Get(TimeBytes); v != nil {
635635
dropped++
636636
if reason == "" {
637637
reason = fmt.Sprintf(
@@ -689,7 +689,7 @@ func (s *Shard) validateSeriesAndFields(points []models.Point, tracker StatsTrac
689689
iter := p.FieldIterator()
690690
validField := false
691691
for iter.Next() {
692-
if bytes.Equal(iter.FieldKey(), timeBytes) {
692+
if bytes.Equal(iter.FieldKey(), TimeBytes) {
693693
continue
694694
}
695695
validField = true

0 commit comments

Comments
 (0)