Fix race on Cache entry
parent
7fed382dbf
commit
d0b81c1e6c
|
@ -8,6 +8,7 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/influxdb/influxql"
|
||||
"github.com/influxdata/influxdb/models"
|
||||
"github.com/influxdata/influxdb/tsdb"
|
||||
"github.com/uber-go/zap"
|
||||
|
@ -147,6 +148,13 @@ func (e *entry) size() int {
|
|||
return sz
|
||||
}
|
||||
|
||||
// InfluxQLType returns for the entry the data type of its values.
|
||||
func (e *entry) InfluxQLType() (influxql.DataType, error) {
|
||||
e.mu.RLock()
|
||||
defer e.mu.RUnlock()
|
||||
return e.values.InfluxQLType()
|
||||
}
|
||||
|
||||
// Statistics gathered by the Cache.
|
||||
const (
|
||||
// levels - point in time measures
|
||||
|
|
|
@ -1331,7 +1331,7 @@ func (e *Engine) onFileStoreReplace(newFiles []TSMFile) {
|
|||
|
||||
// load metadata from the Cache
|
||||
e.Cache.ApplyEntryFn(func(key []byte, entry *entry) error {
|
||||
fieldType, err := entry.values.InfluxQLType()
|
||||
fieldType, err := entry.InfluxQLType()
|
||||
if err != nil {
|
||||
e.logger.Error(fmt.Sprintf("refresh index (3): %v", err))
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue