From 4ad142fabd6b6c189bab2f7e5ee11aceeeb0ebe5 Mon Sep 17 00:00:00 2001 From: Todd Persen Date: Mon, 21 Apr 2014 13:51:32 -0400 Subject: [PATCH] Fix #458. Correct sequence number calculation during continuous query interpolation. --- src/coordinator/coordinator.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/coordinator/coordinator.go b/src/coordinator/coordinator.go index 6bd2388b2fb..d2f10130660 100644 --- a/src/coordinator/coordinator.go +++ b/src/coordinator/coordinator.go @@ -538,15 +538,17 @@ func (self *CoordinatorImpl) InterpolateValuesAndCommit(query string, db string, fieldIndex := series.GetFieldIndex(fieldName) return point.GetFieldValueAsString(fieldIndex) }) - cleanedTargetName := strings.Map(replaceInvalidCharacters, targetNameWithValues) + + sanitizedTargetName := strings.Map(replaceInvalidCharacters, targetNameWithValues) if assignSequenceNumbers { - sequenceMap[sequenceKey{targetName, *point.Timestamp}] += 1 - sequenceNumber := uint64(sequenceMap[sequenceKey{targetName, *point.Timestamp}]) + key := sequenceKey{sanitizedTargetName, *point.Timestamp} + sequenceMap[key] += 1 + sequenceNumber := uint64(sequenceMap[key]) point.SequenceNumber = &sequenceNumber } - newSeries := &protocol.Series{Name: &cleanedTargetName, Fields: series.Fields, Points: []*protocol.Point{point}} + newSeries := &protocol.Series{Name: &sanitizedTargetName, Fields: series.Fields, Points: []*protocol.Point{point}} if e := self.CommitSeriesData(db, []*protocol.Series{newSeries}); e != nil { log.Error("Couldn't write data for continuous query: ", e) }