|
|
|
@ -540,7 +540,6 @@ func (l *LevelDBMetricPersistence) AppendSamples(samples model.Samples) (err err
|
|
|
|
|
var ( |
|
|
|
|
fingerprintToSamples = groupByFingerprint(samples) |
|
|
|
|
indexErrChan = make(chan error) |
|
|
|
|
doneCommitting sync.WaitGroup |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
go func(groups map[model.Fingerprint]model.Samples) { |
|
|
|
@ -555,11 +554,8 @@ func (l *LevelDBMetricPersistence) AppendSamples(samples model.Samples) (err err
|
|
|
|
|
indexErrChan <- l.indexMetrics(metrics) |
|
|
|
|
}(fingerprintToSamples) |
|
|
|
|
|
|
|
|
|
go func() { |
|
|
|
|
doneCommitting.Add(1) |
|
|
|
|
samplesBatch := leveldb.NewBatch() |
|
|
|
|
defer samplesBatch.Close() |
|
|
|
|
defer doneCommitting.Done() |
|
|
|
|
|
|
|
|
|
for fingerprint, group := range fingerprintToSamples { |
|
|
|
|
for { |
|
|
|
@ -601,9 +597,7 @@ func (l *LevelDBMetricPersistence) AppendSamples(samples model.Samples) (err err
|
|
|
|
|
if err != nil { |
|
|
|
|
panic(err) |
|
|
|
|
} |
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
doneCommitting.Wait() |
|
|
|
|
err = <-indexErrChan |
|
|
|
|
if err != nil { |
|
|
|
|
panic(err) |
|
|
|
|