Merge pull request from influxdata/0.13

Merge 0.13 release candidate back to master
pull/6606/head
Jonathan A. Sternberg 2016-05-11 13:04:26 -04:00
commit 89346bb618
6 changed files with 55 additions and 7 deletions

View File

@ -73,6 +73,7 @@ With this release InfluxDB is moving to Go v1.6.
- [#6496](https://github.com/influxdata/influxdb/issues/6496): Fix parsing escaped series key when loading database index
- [#6495](https://github.com/influxdata/influxdb/issues/6495): Fix aggregate returns when data is missing from some shards.
- [#6439](https://github.com/influxdata/influxdb/issues/6439): Overwriting points returning old values
- [#6261](https://github.com/influxdata/influxdb/issues/6261): High CPU usage and slow query with DISTINCT
## v0.12.2 [2016-04-20]

View File

@ -11,8 +11,6 @@ import (
"runtime"
"strconv"
"time"
"github.com/BurntSushi/toml"
)
const logo = `
@ -202,7 +200,7 @@ func (cmd *Command) ParseConfig(path string) (*Config, error) {
log.Printf("Using configuration at: %s\n", path)
config := NewConfig()
if _, err := toml.DecodeFile(path, &config); err != nil {
if err := config.FromTomlFile(path); err != nil {
return nil, err
}

View File

@ -2,14 +2,18 @@ package run
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/user"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"github.com/BurntSushi/toml"
"github.com/influxdata/influxdb/cluster"
"github.com/influxdata/influxdb/monitor"
"github.com/influxdata/influxdb/services/admin"
@ -116,6 +120,30 @@ func NewDemoConfig() (*Config, error) {
return c, nil
}
// FromTomlFile loads the config from a TOML file.
func (c *Config) FromTomlFile(fpath string) error {
bs, err := ioutil.ReadFile(fpath)
if err != nil {
return err
}
return c.FromToml(string(bs))
}
// FromToml loads the config from TOML.
func (c *Config) FromToml(input string) error {
// Replace collectd and opentsdb sections in the old format with the new.
// TODO(jsternberg): Remove for 1.0.
re := regexp.MustCompile(`(?m)^\s*\[(collectd|opentsdb)\]`)
input = re.ReplaceAllStringFunc(input, func(in string) string {
in = strings.TrimSpace(in)
out := "[" + in + "]"
log.Printf("deprecated config option %s replaced with %s; %s will not be supported in a future release\n", in, out, in)
return out
})
_, err := toml.Decode(input, c)
return err
}
// Validate returns an error if the config is invalid.
func (c *Config) Validate() error {
if err := c.Meta.Validate(); err != nil {

View File

@ -66,7 +66,7 @@ func (cmd *PrintConfigCommand) parseConfig(path string) (*Config, error) {
}
config := NewConfig()
if _, err := toml.DecodeFile(path, &config); err != nil {
if err := config.FromTomlFile(path); err != nil {
return nil, err
}
return config, nil

View File

@ -12,7 +12,7 @@ import (
func TestConfig_Parse(t *testing.T) {
// Parse configuration.
var c run.Config
if _, err := toml.Decode(`
if err := c.FromToml(`
join = "foo:123,bar:456"
[meta]
@ -61,7 +61,7 @@ enabled = true
[continuous_queries]
enabled = true
`, &c); err != nil {
`); err != nil {
t.Fatal(err)
}
@ -242,3 +242,24 @@ enabled = false
t.Fatalf("got nil, expected error")
}
}
func TestConfig_DeprecatedOptions(t *testing.T) {
// Parse configuration.
var c run.Config
if err := c.FromToml(`
[collectd]
bind-address = ":1000"
[opentsdb]
bind-address = ":2000"
`); err != nil {
t.Fatal(err)
}
// Validate configuration.
if c.CollectdInputs[0].BindAddress != ":1000" {
t.Fatalf("unexpected collectd bind address: %s", c.CollectdInputs[0].BindAddress)
} else if c.OpenTSDBInputs[0].BindAddress != ":2000" {
t.Fatalf("unexpected opentsdb bind address: %s", c.OpenTSDBInputs[0].BindAddress)
}
}

View File

@ -1220,7 +1220,7 @@ func NewTagValuesIterator(sh *Shard, opt influxql.IteratorOptions) (influxql.Ite
switch e.Op {
case influxql.EQ, influxql.NEQ, influxql.EQREGEX, influxql.NEQREGEX:
tag, ok := e.LHS.(*influxql.VarRef)
if !ok || tag.Val == "name" || strings.HasPrefix(tag.Val, "_") {
if !ok || strings.HasPrefix(tag.Val, "_") {
return nil
}
}