Skip to content

Commit

Permalink
Fix data not getting reloaded
Browse files Browse the repository at this point in the history
The optimization to speed up shard loading had the side effect of
skipping adding series to the index that already exist.  The skipping
was in the wrong location and also skipped the shards measurementFields
index which is required in order to query that series in the shard.
  • Loading branch information
jwilder committed May 18, 2016
1 parent 2ba03aa commit b5cfb0e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tsdb/engine/tsm1/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,6 @@ func (e *Engine) readFileFromBackup(tr *tar.Reader, shardRelativePath string) er
// database index and measurement fields
func (e *Engine) addToIndexFromKey(shardID uint64, key string, fieldType influxql.DataType, index *tsdb.DatabaseIndex) error {
seriesKey, field := seriesAndFieldFromCompositeKey(key)
// Have we already indexed this series?
ss := index.Series(seriesKey)
if ss != nil {
return nil
}

measurement := tsdb.MeasurementFromSeriesKey(seriesKey)

m := index.CreateMeasurementIndexIfNotExists(measurement)
Expand All @@ -400,6 +394,14 @@ func (e *Engine) addToIndexFromKey(shardID uint64, key string, fieldType influxq
return err
}

// Have we already indexed this series?
ss := index.Series(seriesKey)
if ss != nil {
// Add this shard to the existing series
ss.AssignShard(shardID)
return nil
}

// ignore error because ParseKey returns "missing fields" and we don't have
// fields (in line protocol format) in the series key
_, tags, _ := models.ParseKey(seriesKey)
Expand Down

0 comments on commit b5cfb0e

Please sign in to comment.