Skip to content

YAML config file parsing behaviour changed between 5.x and master #24006

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

Closed
spinscale opened this issue Apr 10, 2017 · 1 comment
Closed

YAML config file parsing behaviour changed between 5.x and master #24006

spinscale opened this issue Apr 10, 2017 · 1 comment
Labels
:Core/Infra/Settings Settings infrastructure and APIs discuss >upgrade

Comments

@spinscale
Copy link
Contributor

The root of this change is #22225

The following configuration file works in 5.x (tested with a 5.4 snapshot from https://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/distribution/zip/elasticsearch/5.4.0-SNAPSHOT/), but throws an exception in master, tested with a snapshot from https://oss.sonatype.org/content/repositories/snapshots/org/elasticsearch/distribution/zip/elasticsearch/6.0.0-alpha1-SNAPSHOT/

node:
  name: node1

node:
  attr:
    rack: r1

This stacktrace is shown on master

Exception in thread "main" SettingsException[Failed to load settings from /tmp/test-nesting/elasticsearch-6.0.0-alpha1-SNAPSHOT/config/elasticsearch.yml]; nested: JsonParseException[Duplicate field 'node'
...
; line: 4, column: 5]];
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:104)
	at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:63)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:58)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
	at org.elasticsearch.cli.Command.main(Command.java:88)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
Caused by: com.fasterxml.jackson.core.JsonParseException: Duplicate field 'node'
 at [Source: node:
  name: node1

node:
  attr:
    rack: r1
...
; line: 4, column: 5]
	at com.fasterxml.jackson.core.json.JsonReadContext._checkDup(JsonReadContext.java:204)
	at com.fasterxml.jackson.core.json.JsonReadContext.setCurrentName(JsonReadContext.java:198)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:372)
	at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:52)
	at org.elasticsearch.common.settings.loader.XContentSettingsLoader.serializeObject(XContentSettingsLoader.java:105)
	at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:75)
	at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:52)
	at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:50)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1046)
	at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1035)
	at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:102)
	... 6 more

I do consider this a good thing, just something we should be aware of that needs to be kept in mind when upgrading (part of the upgrade docs, as it is hard to warn about before the upgrade I suppose).

Feel free to close without comment if not considered an issue.

@jasontedor
Copy link
Member

jasontedor commented Apr 10, 2017

I think it's fine as this is a good change, and the effort to work around this is minimal. I think that it just needs to be documented so I opened #24022.

@colings86 colings86 added the :Core/Infra/Settings Settings infrastructure and APIs label Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Settings Settings infrastructure and APIs discuss >upgrade
Projects
None yet
Development

No branches or pull requests

3 participants