2015-05-28 21:47:47 +00:00
|
|
|
package tsdb
|
|
|
|
|
2015-05-29 19:50:05 +00:00
|
|
|
import (
|
2015-10-27 18:57:21 +00:00
|
|
|
"errors"
|
|
|
|
"fmt"
|
2015-05-29 19:50:05 +00:00
|
|
|
"time"
|
|
|
|
|
2017-01-17 22:50:35 +00:00
|
|
|
"github.com/influxdata/influxdb/monitor/diagnostics"
|
2016-02-10 17:26:18 +00:00
|
|
|
"github.com/influxdata/influxdb/toml"
|
2015-05-29 19:50:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2015-09-17 02:05:20 +00:00
|
|
|
// DefaultEngine is the default engine for new shards
|
2016-01-11 19:02:36 +00:00
|
|
|
DefaultEngine = "tsm1"
|
2015-09-17 02:05:20 +00:00
|
|
|
|
2016-11-14 15:55:40 +00:00
|
|
|
// DefaultIndex is the default index for new shards
|
2018-08-21 13:32:30 +00:00
|
|
|
DefaultIndex = InmemIndexName
|
2016-11-14 15:55:40 +00:00
|
|
|
|
2015-08-18 20:59:54 +00:00
|
|
|
// tsdb/engine/wal configuration options
|
|
|
|
|
2015-12-06 23:50:39 +00:00
|
|
|
// Default settings for TSM
|
2015-12-02 18:01:13 +00:00
|
|
|
|
2015-12-06 23:50:39 +00:00
|
|
|
// DefaultCacheMaxMemorySize is the maximum size a shard's cache can
|
|
|
|
// reach before it starts rejecting writes.
|
2016-10-26 02:49:43 +00:00
|
|
|
DefaultCacheMaxMemorySize = 1024 * 1024 * 1024 // 1GB
|
2015-12-02 18:01:13 +00:00
|
|
|
|
2015-12-06 23:50:39 +00:00
|
|
|
// DefaultCacheSnapshotMemorySize is the size at which the engine will
|
|
|
|
// snapshot the cache and write it to a TSM file, freeing up memory
|
2017-12-12 16:59:39 +00:00
|
|
|
DefaultCacheSnapshotMemorySize = 25 * 1024 * 1024 // 25MB
|
2015-12-06 23:50:39 +00:00
|
|
|
|
|
|
|
// DefaultCacheSnapshotWriteColdDuration is the length of time at which
|
|
|
|
// the engine will snapshot the cache and write it to a new TSM file if
|
2015-12-07 19:47:17 +00:00
|
|
|
// the shard hasn't received writes or deletes
|
2016-10-26 02:49:43 +00:00
|
|
|
DefaultCacheSnapshotWriteColdDuration = time.Duration(10 * time.Minute)
|
2015-12-06 23:50:39 +00:00
|
|
|
|
|
|
|
// DefaultCompactFullWriteColdDuration is the duration at which the engine
|
|
|
|
// will compact all TSM files in a shard if it hasn't received a write or delete
|
2016-10-26 02:49:43 +00:00
|
|
|
DefaultCompactFullWriteColdDuration = time.Duration(4 * time.Hour)
|
2015-12-06 23:50:39 +00:00
|
|
|
|
2018-06-04 19:44:32 +00:00
|
|
|
// DefaultCompactThroughput is the rate limit in bytes per second that we
|
|
|
|
// will allow TSM compactions to write to disk. Not that short bursts are allowed
|
|
|
|
// to happen at a possibly larger value, set by DefaultCompactThroughputBurst.
|
|
|
|
// A value of 0 here will disable compaction rate limiting
|
|
|
|
DefaultCompactThroughput = 48 * 1024 * 1024
|
|
|
|
|
|
|
|
// DefaultCompactThroughputBurst is the rate limit in bytes per second that we
|
|
|
|
// will allow TSM compactions to write to disk. If this is not set, the burst value
|
|
|
|
// will be set to equal the normal throughput
|
|
|
|
DefaultCompactThroughputBurst = 48 * 1024 * 1024
|
|
|
|
|
2015-12-06 23:50:39 +00:00
|
|
|
// DefaultMaxPointsPerBlock is the maximum number of points in an encoded
|
|
|
|
// block in a TSM file
|
|
|
|
DefaultMaxPointsPerBlock = 1000
|
2016-07-21 12:11:06 +00:00
|
|
|
|
2024-12-17 21:03:32 +00:00
|
|
|
// AggressiveMaxPointsPerBlock is used when we want to further compact blocks
|
|
|
|
// it is 100 times the default amount of points we use per block
|
|
|
|
AggressiveMaxPointsPerBlock = 100000
|
|
|
|
|
2017-03-24 15:48:10 +00:00
|
|
|
// DefaultMaxSeriesPerDatabase is the maximum number of series a node can hold per database.
|
|
|
|
// This limit only applies to the "inmem" index.
|
2017-03-24 19:16:00 +00:00
|
|
|
DefaultMaxSeriesPerDatabase = 1000000
|
2016-10-05 05:52:49 +00:00
|
|
|
|
|
|
|
// DefaultMaxValuesPerTag is the maximum number of values a tag can have within a measurement.
|
|
|
|
DefaultMaxValuesPerTag = 100000
|
2017-05-01 17:11:29 +00:00
|
|
|
|
|
|
|
// DefaultMaxConcurrentCompactions is the maximum number of concurrent full and level compactions
|
2017-09-20 21:27:34 +00:00
|
|
|
// that can run at one time. A value of 0 results in 50% of runtime.GOMAXPROCS(0) used at runtime.
|
2017-05-01 17:11:29 +00:00
|
|
|
DefaultMaxConcurrentCompactions = 0
|
2018-04-02 17:47:59 +00:00
|
|
|
|
|
|
|
// DefaultMaxIndexLogFileSize is the default threshold, in bytes, when an index
|
|
|
|
// write-ahead log file will compact into an index file.
|
|
|
|
DefaultMaxIndexLogFileSize = 1 * 1024 * 1024 // 1MB
|
2019-01-24 12:05:04 +00:00
|
|
|
|
2022-01-13 19:04:57 +00:00
|
|
|
// DefaultMaxConcurrentDeletes is the default number of concurrent DELETE calls on a shard.
|
|
|
|
DefaultMaxConcurrentDeletes = 1
|
|
|
|
|
2019-01-24 12:05:04 +00:00
|
|
|
// DefaultSeriesIDSetCacheSize is the default number of series ID sets to cache in the TSI index.
|
2020-08-07 18:05:00 +00:00
|
|
|
DefaultSeriesIDSetCacheSize = 100
|
2019-07-30 17:34:06 +00:00
|
|
|
|
|
|
|
// DefaultSeriesFileMaxConcurrentSnapshotCompactions is the maximum number of concurrent series
|
|
|
|
// partition snapshot compactions that can run at one time.
|
|
|
|
// A value of 0 results in runtime.GOMAXPROCS(0).
|
|
|
|
DefaultSeriesFileMaxConcurrentSnapshotCompactions = 0
|
2015-05-29 19:50:05 +00:00
|
|
|
)
|
2015-05-29 15:53:33 +00:00
|
|
|
|
2016-02-10 20:04:18 +00:00
|
|
|
// Config holds the configuration for the tsbd package.
|
2015-05-28 21:47:47 +00:00
|
|
|
type Config struct {
|
2016-03-08 19:59:33 +00:00
|
|
|
Dir string `toml:"dir"`
|
2016-10-24 21:19:11 +00:00
|
|
|
Engine string `toml:"-"`
|
2016-11-21 17:11:59 +00:00
|
|
|
Index string `toml:"index-version"`
|
2015-08-18 20:59:54 +00:00
|
|
|
|
2016-03-20 19:33:45 +00:00
|
|
|
// General WAL configuration options
|
2016-10-24 21:19:11 +00:00
|
|
|
WALDir string `toml:"wal-dir"`
|
2015-09-17 02:26:23 +00:00
|
|
|
|
2017-03-10 17:10:19 +00:00
|
|
|
// WALFsyncDelay is the amount of time that a write will wait before fsyncing. A duration
|
|
|
|
// greater than 0 can be used to batch up multiple fsync calls. This is useful for slower
|
|
|
|
// disks or when WAL write contention is seen. A value of 0 fsyncs every write to the WAL.
|
|
|
|
WALFsyncDelay toml.Duration `toml:"wal-fsync-delay"`
|
|
|
|
|
2018-05-02 17:16:55 +00:00
|
|
|
// Enables unicode validation on series keys on write.
|
|
|
|
ValidateKeys bool `toml:"validate-keys"`
|
|
|
|
|
2021-07-14 21:11:09 +00:00
|
|
|
// When true, skips size validation on fields
|
|
|
|
SkipFieldSizeValidation bool `toml:"skip-field-size-validation"`
|
|
|
|
|
2020-12-31 02:22:43 +00:00
|
|
|
// Enables strict error handling. For example, forces SELECT INTO to err out on INF values.
|
|
|
|
StrictErrorHandling bool `toml:"strict-error-handling"`
|
|
|
|
|
2015-09-17 02:26:23 +00:00
|
|
|
// Query logging
|
|
|
|
QueryLogEnabled bool `toml:"query-log-enabled"`
|
2015-12-02 18:01:13 +00:00
|
|
|
|
2015-12-06 23:50:39 +00:00
|
|
|
// Compaction options for tsm1 (descriptions above with defaults)
|
2017-09-27 22:27:18 +00:00
|
|
|
CacheMaxMemorySize toml.Size `toml:"cache-max-memory-size"`
|
|
|
|
CacheSnapshotMemorySize toml.Size `toml:"cache-snapshot-memory-size"`
|
2015-12-06 23:50:39 +00:00
|
|
|
CacheSnapshotWriteColdDuration toml.Duration `toml:"cache-snapshot-write-cold-duration"`
|
|
|
|
CompactFullWriteColdDuration toml.Duration `toml:"compact-full-write-cold-duration"`
|
2018-06-04 19:44:32 +00:00
|
|
|
CompactThroughput toml.Size `toml:"compact-throughput"`
|
|
|
|
CompactThroughputBurst toml.Size `toml:"compact-throughput-burst"`
|
2015-12-14 23:58:27 +00:00
|
|
|
|
2021-02-02 20:10:41 +00:00
|
|
|
// Options for ingress metrics
|
|
|
|
IngressMetricByMeasurement bool `toml:"ingress-metric-by-measurement-enabled"`
|
feat: measurement metrics by login (#20687)
After turning on authentication and both forms of ingress metrics:
"ingress": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"cq","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":76}},
"ingress:1": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"database","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":152}},
"ingress:2": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"httpd","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":874}},
"ingress:3": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"ingress","rp":"monitor"},"values":{"pointsWritten":534,"valuesWritten":1068}},
"ingress:4": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"localStore","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":76}},
"ingress:5": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"queryExecutor","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":190}},
"ingress:6": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"runtime","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":570}},
"ingress:7": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"shard","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":836}},
"ingress:8": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"subscriber","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":114}},
"ingress:9": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"tsm1_cache","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":684}},
"ingress:10": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"tsm1_engine","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":2204}},
"ingress:11": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"tsm1_filestore","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":152}},
"ingress:12": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"tsm1_wal","rp":"monitor"},"values":{"pointsWritten":76,"valuesWritten":304}},
"ingress:13": {"name":"ingress","tags":{"db":"_internal","login":"_systemuser_monitor","measurement":"write","rp":"monitor"},"values":{"pointsWritten":38,"valuesWritten":342}},
"ingress:14": {"name":"ingress","tags":{"db":"telegraf","login":"admin","measurement":"cpu","rp":"autogen"},"values":{"pointsWritten":1,"valuesWritten":1}},
"ingress:15": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"cpu","rp":"autogen"},"values":{"pointsWritten":1316,"valuesWritten":13160}},
"ingress:16": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"disk","rp":"autogen"},"values":{"pointsWritten":642,"valuesWritten":4494}},
"ingress:17": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"diskio","rp":"autogen"},"values":{"pointsWritten":214,"valuesWritten":2354}},
"ingress:18": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"mem","rp":"autogen"},"values":{"pointsWritten":107,"valuesWritten":963}},
"ingress:19": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"processes","rp":"autogen"},"values":{"pointsWritten":107,"valuesWritten":856}},
"ingress:20": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"swap","rp":"autogen"},"values":{"pointsWritten":214,"valuesWritten":642}},
"ingress:21": {"name":"ingress","tags":{"db":"telegraf","login":"telegraf","measurement":"system","rp":"autogen"},"values":{"pointsWritten":321,"valuesWritten":749}},
Only by login:
"ingress": {"name":"ingress","tags":{"login":"_systemuser_monitor"},"values":{"pointsWritten":42,"valuesWritten":354}},
"ingress:1": {"name":"ingress","tags":{"login":"admin"},"values":{"pointsWritten":1,"valuesWritten":1}},
"ingress:2": {"name":"ingress","tags":{"login":"telegraf"},"values":{"pointsWritten":3547,"valuesWritten":28246}},
Notice writes by users 'telegraf', '_systemuser_monitor', and 'admin'.
2021-02-04 16:52:53 +00:00
|
|
|
IngressMetricByLogin bool `toml:"ingress-metric-by-login-enabled"`
|
2021-02-02 20:10:41 +00:00
|
|
|
|
2016-07-21 12:11:06 +00:00
|
|
|
// Limits
|
|
|
|
|
2017-03-24 15:48:10 +00:00
|
|
|
// MaxSeriesPerDatabase is the maximum number of series a node can hold per database.
|
|
|
|
// When this limit is exceeded, writes return a 'max series per database exceeded' error.
|
|
|
|
// A value of 0 disables the limit. This limit only applies when using the "inmem" index.
|
2017-03-24 19:16:00 +00:00
|
|
|
MaxSeriesPerDatabase int `toml:"max-series-per-database"`
|
2016-07-21 12:11:06 +00:00
|
|
|
|
2016-10-05 05:52:49 +00:00
|
|
|
// MaxValuesPerTag is the maximum number of tag values a single tag key can have within
|
|
|
|
// a measurement. When the limit is execeeded, writes return an error.
|
|
|
|
// A value of 0 disables the limit.
|
|
|
|
MaxValuesPerTag int `toml:"max-values-per-tag"`
|
|
|
|
|
2017-05-01 17:11:29 +00:00
|
|
|
// MaxConcurrentCompactions is the maximum number of concurrent level and full compactions
|
|
|
|
// that can be running at one time across all shards. Compactions scheduled to run when the
|
|
|
|
// limit is reached are blocked until a running compaction completes. Snapshot compactions are
|
|
|
|
// not affected by this limit. A value of 0 limits compactions to runtime.GOMAXPROCS(0).
|
|
|
|
MaxConcurrentCompactions int `toml:"max-concurrent-compactions"`
|
|
|
|
|
2018-04-02 17:47:59 +00:00
|
|
|
// MaxIndexLogFileSize is the threshold, in bytes, when an index write-ahead log file will
|
|
|
|
// compact into an index file. Lower sizes will cause log files to be compacted more quickly
|
|
|
|
// and result in lower heap usage at the expense of write throughput. Higher sizes will
|
|
|
|
// be compacted less frequently, store more series in-memory, and provide higher write throughput.
|
|
|
|
MaxIndexLogFileSize toml.Size `toml:"max-index-log-file-size"`
|
|
|
|
|
2022-01-13 19:04:57 +00:00
|
|
|
// MaxConcurrentDeletes is the maximum number of simultaneous DELETE calls on a shard
|
|
|
|
// The default is 1, which was the previous hard-coded value.
|
|
|
|
MaxConcurrentDeletes int `toml:"max-concurrent-deletes"`
|
|
|
|
|
2019-01-24 12:05:04 +00:00
|
|
|
// SeriesIDSetCacheSize is the number items that can be cached within the TSI index. TSI caching can help
|
|
|
|
// with query performance when the same tag key/value predicates are commonly used on queries.
|
|
|
|
// Setting series-id-set-cache-size to 0 disables the cache.
|
|
|
|
SeriesIDSetCacheSize int `toml:"series-id-set-cache-size"`
|
|
|
|
|
2019-07-30 17:34:06 +00:00
|
|
|
// SeriesFileMaxConcurrentSnapshotCompactions is the maximum number of concurrent snapshot compactions
|
|
|
|
// that can be running at one time across all series partitions in a database. Snapshots scheduled
|
|
|
|
// to run when the limit is reached are blocked until a running snaphsot completes. Only snapshot
|
|
|
|
// compactions are affected by this limit. A value of 0 limits snapshot compactions to the lesser of
|
|
|
|
// 8 (series file partition quantity) and runtime.GOMAXPROCS(0).
|
|
|
|
SeriesFileMaxConcurrentSnapshotCompactions int `toml:"series-file-max-concurrent-snapshot-compactions"`
|
|
|
|
|
2016-07-07 15:27:09 +00:00
|
|
|
TraceLoggingEnabled bool `toml:"trace-logging-enabled"`
|
2018-08-03 13:07:46 +00:00
|
|
|
|
|
|
|
// TSMWillNeed controls whether we hint to the kernel that we intend to
|
|
|
|
// page in mmap'd sections of TSM files. This setting defaults to off, as it has
|
|
|
|
// been found to be problematic in some cases. It may help users who have
|
|
|
|
// slow disks.
|
|
|
|
TSMWillNeed bool `toml:"tsm-use-madv-willneed"`
|
2015-05-28 21:47:47 +00:00
|
|
|
}
|
2015-05-29 19:50:05 +00:00
|
|
|
|
2016-02-10 20:04:18 +00:00
|
|
|
// NewConfig returns the default configuration for tsdb.
|
2015-05-29 19:50:05 +00:00
|
|
|
func NewConfig() Config {
|
|
|
|
return Config{
|
2016-03-20 19:33:45 +00:00
|
|
|
Engine: DefaultEngine,
|
2016-11-14 15:55:40 +00:00
|
|
|
Index: DefaultIndex,
|
2016-03-20 19:33:45 +00:00
|
|
|
|
2020-12-31 02:22:43 +00:00
|
|
|
StrictErrorHandling: false,
|
|
|
|
QueryLogEnabled: true,
|
2015-12-02 18:01:13 +00:00
|
|
|
|
2017-09-27 22:27:18 +00:00
|
|
|
CacheMaxMemorySize: toml.Size(DefaultCacheMaxMemorySize),
|
|
|
|
CacheSnapshotMemorySize: toml.Size(DefaultCacheSnapshotMemorySize),
|
2015-12-06 23:50:39 +00:00
|
|
|
CacheSnapshotWriteColdDuration: toml.Duration(DefaultCacheSnapshotWriteColdDuration),
|
|
|
|
CompactFullWriteColdDuration: toml.Duration(DefaultCompactFullWriteColdDuration),
|
2018-06-04 19:44:32 +00:00
|
|
|
CompactThroughput: toml.Size(DefaultCompactThroughput),
|
|
|
|
CompactThroughputBurst: toml.Size(DefaultCompactThroughputBurst),
|
2015-12-15 21:15:38 +00:00
|
|
|
|
2017-05-01 17:11:29 +00:00
|
|
|
MaxSeriesPerDatabase: DefaultMaxSeriesPerDatabase,
|
|
|
|
MaxValuesPerTag: DefaultMaxValuesPerTag,
|
|
|
|
MaxConcurrentCompactions: DefaultMaxConcurrentCompactions,
|
2022-01-13 19:04:57 +00:00
|
|
|
MaxConcurrentDeletes: DefaultMaxConcurrentDeletes,
|
2016-07-21 12:11:06 +00:00
|
|
|
|
2019-01-24 12:05:04 +00:00
|
|
|
MaxIndexLogFileSize: toml.Size(DefaultMaxIndexLogFileSize),
|
|
|
|
SeriesIDSetCacheSize: DefaultSeriesIDSetCacheSize,
|
2018-04-02 17:47:59 +00:00
|
|
|
|
2019-07-30 17:34:06 +00:00
|
|
|
SeriesFileMaxConcurrentSnapshotCompactions: DefaultSeriesFileMaxConcurrentSnapshotCompactions,
|
|
|
|
|
2016-07-07 15:27:09 +00:00
|
|
|
TraceLoggingEnabled: false,
|
2018-08-03 13:07:46 +00:00
|
|
|
TSMWillNeed: false,
|
2015-05-29 19:50:05 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-27 18:57:21 +00:00
|
|
|
|
2016-02-10 20:04:18 +00:00
|
|
|
// Validate validates the configuration hold by c.
|
2015-10-27 18:57:21 +00:00
|
|
|
func (c *Config) Validate() error {
|
|
|
|
if c.Dir == "" {
|
|
|
|
return errors.New("Data.Dir must be specified")
|
|
|
|
} else if c.WALDir == "" {
|
|
|
|
return errors.New("Data.WALDir must be specified")
|
|
|
|
}
|
|
|
|
|
2017-05-01 17:11:29 +00:00
|
|
|
if c.MaxConcurrentCompactions < 0 {
|
2019-01-24 12:05:04 +00:00
|
|
|
return errors.New("max-concurrent-compactions must be non-negative")
|
|
|
|
}
|
|
|
|
|
2022-01-13 19:04:57 +00:00
|
|
|
if c.MaxConcurrentDeletes <= 0 {
|
|
|
|
return errors.New("max-concurrent-deletes must be positive")
|
|
|
|
}
|
|
|
|
|
2019-01-24 12:05:04 +00:00
|
|
|
if c.SeriesIDSetCacheSize < 0 {
|
|
|
|
return errors.New("series-id-set-cache-size must be non-negative")
|
2017-05-01 17:11:29 +00:00
|
|
|
}
|
|
|
|
|
2019-07-30 17:34:06 +00:00
|
|
|
if c.SeriesFileMaxConcurrentSnapshotCompactions < 0 {
|
|
|
|
return errors.New("series-file-max-concurrent-compactions must be non-negative")
|
|
|
|
}
|
|
|
|
|
2015-10-27 18:57:21 +00:00
|
|
|
valid := false
|
|
|
|
for _, e := range RegisteredEngines() {
|
|
|
|
if e == c.Engine {
|
|
|
|
valid = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !valid {
|
|
|
|
return fmt.Errorf("unrecognized engine %s", c.Engine)
|
|
|
|
}
|
|
|
|
|
2017-02-03 11:57:41 +00:00
|
|
|
valid = false
|
|
|
|
for _, e := range RegisteredIndexes() {
|
|
|
|
if e == c.Index {
|
|
|
|
valid = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !valid {
|
|
|
|
return fmt.Errorf("unrecognized index %s", c.Index)
|
|
|
|
}
|
|
|
|
|
2015-10-27 18:57:21 +00:00
|
|
|
return nil
|
|
|
|
}
|
2017-01-17 22:50:35 +00:00
|
|
|
|
|
|
|
// Diagnostics returns a diagnostics representation of a subset of the Config.
|
|
|
|
func (c Config) Diagnostics() (*diagnostics.Diagnostics, error) {
|
|
|
|
return diagnostics.RowFromMap(map[string]interface{}{
|
2019-07-30 17:34:06 +00:00
|
|
|
"dir": c.Dir,
|
|
|
|
"wal-dir": c.WALDir,
|
|
|
|
"wal-fsync-delay": c.WALFsyncDelay,
|
2020-12-31 02:22:43 +00:00
|
|
|
"strict-error-handling": c.StrictErrorHandling,
|
2019-07-30 17:34:06 +00:00
|
|
|
"cache-max-memory-size": c.CacheMaxMemorySize,
|
|
|
|
"cache-snapshot-memory-size": c.CacheSnapshotMemorySize,
|
|
|
|
"cache-snapshot-write-cold-duration": c.CacheSnapshotWriteColdDuration,
|
|
|
|
"compact-full-write-cold-duration": c.CompactFullWriteColdDuration,
|
|
|
|
"max-series-per-database": c.MaxSeriesPerDatabase,
|
|
|
|
"max-values-per-tag": c.MaxValuesPerTag,
|
|
|
|
"max-concurrent-compactions": c.MaxConcurrentCompactions,
|
|
|
|
"max-index-log-file-size": c.MaxIndexLogFileSize,
|
|
|
|
"series-id-set-cache-size": c.SeriesIDSetCacheSize,
|
|
|
|
"series-file-max-concurrent-compactions": c.SeriesFileMaxConcurrentSnapshotCompactions,
|
2017-01-17 22:50:35 +00:00
|
|
|
}), nil
|
|
|
|
}
|