Merge pull request #9970 from influxdata/dn-show-tag-keys-perf

fix SHOW TAG KEYS perfomance regression
pull/9978/head
David Norton 2018-06-15 17:35:06 -04:00 committed by GitHub
commit aa61f5016e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -1111,6 +1111,16 @@ type IndexSet struct {
fieldSets []*MeasurementFieldSet // field sets for _all_ indexes in this set's DB.
}
// HasInmemIndex returns true if any in-memory index is in use.
func (is IndexSet) HasInmemIndex() bool {
for _, idx := range is.Indexes {
if idx.Type() == "inmem" {
return true
}
}
return false
}
// Database returns the database name of the first index.
func (is IndexSet) Database() string {
if len(is.Indexes) == 0 {
@ -1561,6 +1571,10 @@ func (is IndexSet) tagValueIterator(name, key []byte) (TagValueIterator, error)
// TagKeyHasAuthorizedSeries determines if there exists an authorized series for
// the provided measurement name and tag key.
func (is IndexSet) TagKeyHasAuthorizedSeries(auth query.Authorizer, name, tagKey []byte) (bool, error) {
if !is.HasInmemIndex() && query.AuthorizerIsOpen(auth) {
return true, nil
}
release := is.SeriesFile.Retain()
defer release()