Address PR feedback

pull/10234/head
Edd Robinson 2018-08-09 23:07:02 +01:00
parent e651153f1c
commit 76237d80f2
2 changed files with 7 additions and 15 deletions

View File

@ -27,7 +27,7 @@ import (
const IndexName = tsdb.TSI1IndexName const IndexName = tsdb.TSI1IndexName
// DefaultSeriesIDSetCacheSize is the default number of series ID sets to cache. // DefaultSeriesIDSetCacheSize is the default number of series ID sets to cache.
const DefaultSeriesIDSetCacheSize = 10 const DefaultSeriesIDSetCacheSize = 100
// ErrCompactionInterrupted is returned if compactions are disabled or // ErrCompactionInterrupted is returned if compactions are disabled or
// an index is closed while a compaction is occurring. // an index is closed while a compaction is occurring.
@ -1120,12 +1120,3 @@ func IsIndexDir(path string) (bool, error) {
} }
return false, nil return false, nil
} }
// ssElement is is stored within the LRU. It makes it possible to do constant
// time access via a hashmap and also storage inside a linked list.
type ssElement struct {
name []byte
key []byte
value []byte
SeriesIDSet *tsdb.SeriesIDSet
}

View File

@ -525,7 +525,7 @@ func (f *LogFile) AddSeriesList(seriesSet *tsdb.SeriesIDSet, names [][]byte, tag
continue continue
} }
writeRequired = true writeRequired = true
entries = append(entries, LogEntry{SeriesID: seriesIDs[i], name: names[i], tags: tagsSlice[i], cached: true}) entries = append(entries, LogEntry{SeriesID: seriesIDs[i], name: names[i], tags: tagsSlice[i], cached: true, batchidx: i})
} }
seriesSet.RUnlock() seriesSet.RUnlock()
@ -544,7 +544,7 @@ func (f *LogFile) AddSeriesList(seriesSet *tsdb.SeriesIDSet, names [][]byte, tag
entry := &entries[i] entry := &entries[i]
if seriesSet.ContainsNoLock(entry.SeriesID) { if seriesSet.ContainsNoLock(entry.SeriesID) {
// We don't need to allocate anything for this series. // We don't need to allocate anything for this series.
seriesIDs[i] = 0 seriesIDs[entry.batchidx] = 0
continue continue
} }
if err := f.appendEntry(entry); err != nil { if err := f.appendEntry(entry); err != nil {
@ -1064,9 +1064,10 @@ type LogEntry struct {
Checksum uint32 // checksum of flag/name/tags. Checksum uint32 // checksum of flag/name/tags.
Size int // total size of record, in bytes. Size int // total size of record, in bytes.
cached bool // Hint to LogFile that series data is already parsed cached bool // Hint to LogFile that series data is already parsed
name []byte // series naem, this is a cached copy of the parsed measurement name name []byte // series naem, this is a cached copy of the parsed measurement name
tags models.Tags // series tags, this is a cached copied of the parsed tags tags models.Tags // series tags, this is a cached copied of the parsed tags
batchidx int // position of entry in batch.
} }
// UnmarshalBinary unmarshals data into e. // UnmarshalBinary unmarshals data into e.