Skip to content

Commit

Permalink
Fix #458. Correct sequence number calculation during continuous query…
Browse files Browse the repository at this point in the history
… interpolation.
  • Loading branch information
toddboom authored and pauldix committed May 27, 2014
1 parent 6a6f792 commit 7017a65
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 7017a65

Please sign in to comment.