Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change configuration package to influxdata/config #5401

Closed
wants to merge 2 commits into from
Closed

Conversation

timraymond
Copy link
Contributor

We are unifying the way that we handle configuration across the products into
the influxdata/config package. This provides the same API as the
BurntSushi/toml package used previously, but uses influxdata/toml under the
hood (which is a fork of naoina/toml). The underlying toml parser has been
changed because Telegraf uses specific features of this parser that cannot be
easily replicated with the BurntSushi parser. Our fork of naoina/toml provides
support for maps and pointers within structs and toml documentation[1]
facilities, which the original does not, at present time (pull requests have
been submitted with no response with no response from the maintainer).

[1] This is accessible by adding a “doc” struct tag with a comment describing a
particular field of a config struct. When marshalling that struct as TOML, the
“doc” struct tag will be placed appropriately to
document that field in the resultant TOML output.

@timraymond timraymond force-pushed the tr-config branch 2 times, most recently from b1ce6f8 to 840714d Compare February 16, 2016 16:25
@timraymond
Copy link
Contributor Author

This has now been rebased on top of the renaming work

@jwilder
Copy link
Contributor

jwilder commented Feb 23, 2016

Needs a rebase.

@nathanielc
Copy link
Contributor

@timraymond @jwilder I rebased :) I need this to move forward for the Kapacitor changes.

@nathanielc
Copy link
Contributor

Getting these errors which seem unrelated:

--- FAIL: Test_IntegerEncoder_Quick (0.00s)
    int_test.go:443: mismatch:

        exp=[]

        got=[]

--- FAIL: Test_StringEncoder_Quick (0.00s)
    string_test.go:118: mismatch:

        exp=[]

        got=[]

Any idea what is up?

@jwilder
Copy link
Contributor

jwilder commented Mar 2, 2016

@nathanielc I think your rebase didn't pick up a fix for that (#5860). That is was reported in #5854 which seems to be caused by builds with go tip. Circle shouldn't be building with go tip anymore, but it looks like this PR is still building with it.

@nathanielc
Copy link
Contributor

@jwilder Thanks another rebase fixed it.

@nathanielc
Copy link
Contributor

@jwilder @mjdesa What kind of extra testing do we want to do with this config change?

@jwilder
Copy link
Contributor

jwilder commented Mar 4, 2016

Just tried this with a few configs and it causes the server to abort startup with errors whereas current code does not.

@jwilder
Copy link
Contributor

jwilder commented Mar 4, 2016

Some examples:

2016/03/04 13:44:50 Using configuration at: influx.conf
run: open server: open meta service: raft: new raft: Heartbeat timeout is too low
influxdb:n2 jason$ influxd -config influx.conf

But I don't have a raft timeout configured in my config so I'm not quite sure why this is failing now. With the current config libs, it starts up without error.

Here it is reporting an error on a config option that I don't think is valid anymore, but previously that option would be ignored. This will likely prevent upgrades from running smoothly as the config format options change periodically and I'm sure there are old/unused options in many configs out there.

2016/03/04 13:47:52 Using configuration at: influx.conf
run: parse config: toml: unmarshal: line 24: field corresponding to `bind-address' is not defined in `*cluster.Config'

@nathanielc
Copy link
Contributor

@jwilder Yes, old configs should be logged but not error out the parsing. I'll see what I can do about that.

@nathanielc
Copy link
Contributor

@timraymond Digging in the error is triggered from within the Unmarshaling code in our fork of naiona/toml. I see a few paths forward...

  1. Ignore the error entirely.
  2. Ignore the error and change our fork to log it somehow. This seems difficult as its deep in the parsing code.

In either case we are making breaking changes to our fork. I am not sure about the state of our fork and if we are trying to stay close to upstream etc.

@nathanielc
Copy link
Contributor

Possible solution influxdata/toml#4

@nathanielc nathanielc force-pushed the tr-config branch 2 times, most recently from 1874e76 to a2f56eb Compare March 10, 2016 16:08
We are unifying the way that we handle configuration across the products
into the influxdata/config package. This provides the same API as
BurntSushi/toml package used previously, but uses influxdata/toml under
the hood (which is a fork of naoina/toml). The underlying toml parser
has been changed because Telegraf uses specific features of this parser
that cannot be easily replicated with the BurntSushi parser.
Furthermore, our fork of naoina/toml provides support for maps and
pointers within structs and toml documentation facilities[1].

[1] This is accessible by adding a "doc" struct tag with a comment
describing a particular field of a config struct. When marshalling that
struct as TOML, the "doc" struct tag will be placed appropriately to
document that field in the resultant TOML output.
@nathanielc
Copy link
Contributor

@jwilder @timraymond I think this is now ready to go.

Extra configs are now logged and then skipped.
All configs parse.
The default generated config is more readable and can contain doc comments of they exist.

I did have to modify some code that is going to get removed soon but it was necessary in order to get a complete test in.

@nathanielc
Copy link
Contributor

@jwilder @timraymond @rossmcdonald

I found too many bugs in the https://github.com/naoina/toml version. Looking at the code it will take significant rewrite to get it to behave the way we expect.

For now I am going to abandon this PR. :( We will need to revisit the influxdb/config package later and probably start with the BurntSushi option and move forward on it since it has been a reliable implementation so far.

@toddboom
Copy link
Contributor

@nathanielc is it safe to close this out?

@nathanielc
Copy link
Contributor

@toddboom Yes, let's close it out. We can open a new PR when/if the time comes as it will be significantly different than this one.

@nathanielc nathanielc closed this Apr 11, 2016
@nathanielc nathanielc deleted the tr-config branch May 19, 2016 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants