Skip to content

Commit

Permalink
Make engine configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolep committed Sep 17, 2015
1 parent 6d4319d commit e4fde99
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/influxd/run/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error) {
}

// Copy TSDB configuration.
s.TSDBStore.EngineOptions.EngineVersion = c.Data.Engine
s.TSDBStore.EngineOptions.MaxWALSize = c.Data.MaxWALSize
s.TSDBStore.EngineOptions.WALFlushInterval = time.Duration(c.Data.WALFlushInterval)
s.TSDBStore.EngineOptions.WALPartitionFlushDelay = time.Duration(c.Data.WALPartitionFlushDelay)
Expand Down
3 changes: 3 additions & 0 deletions etc/config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ reporting-disabled = false
[data]
dir = "/var/opt/influxdb/data"

# Controls the engine type for new shards.
# engine ="bz1"

# The following WAL settings are for the b1 storage engine used in 0.9.2. They won't
# apply to any new shards created after upgrading to a version > 0.9.3.
max-wal-size = 104857600 # Maximum size the WAL can reach before a flush. Defaults to 100MB.
Expand Down
7 changes: 6 additions & 1 deletion tsdb/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
)

const (
// DefaultEngine is the default engine for new shards
DefaultEngine = "bz1"

// DefaultMaxWALSize is the default size of the WAL before it is flushed.
DefaultMaxWALSize = 100 * 1024 * 1024 // 100MB

Expand Down Expand Up @@ -43,7 +46,8 @@ const (
)

type Config struct {
Dir string `toml:"dir"`
Dir string `toml:"dir"`
Engine string `toml:"engine"`

// WAL config options for b1 (introduced in 0.9.2)
MaxWALSize int `toml:"max-wal-size"`
Expand All @@ -62,6 +66,7 @@ type Config struct {

func NewConfig() Config {
return Config{
Engine: DefaultEngine,
MaxWALSize: DefaultMaxWALSize,
WALFlushInterval: toml.Duration(DefaultWALFlushInterval),
WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),
Expand Down
3 changes: 0 additions & 3 deletions tsdb/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ var (
ErrFormatNotFound = errors.New("format not found")
)

// DefaultEngine is the default engine used by the shard when initializing.
const DefaultEngine = "bz1"

// Engine represents a swappable storage engine for the shard.
type Engine interface {
Open() error
Expand Down

0 comments on commit e4fde99

Please sign in to comment.