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

add option for _ingest.timestamp to use new ZonedDateTime (5.x backport) #24030

Merged
merged 1 commit into from
May 8, 2017

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Apr 10, 2017

This is a backport-veresion of the update to 6.0 that defaults this new behavior: #23174.

I'd like to merge this in first, then remove the setting in master as a follow-up

Previously, Mustache would call toString on the _ingest.timestamp
field and return a date format that did not match Elasticsearch's
defaults for date-mapping parsing. The new ZonedDateTime class in Java 8
happens to do format itself in the same way ES is expecting.

Fixes #23168.

This new fix can be found in the form of a cluster setting called
ingest.new_date_format. By default, in 5.x, the existing behavior
will remain the same. One will set this property to true in order to
take advantage of this update for ingest-pipeline convenience.

@talevy talevy added :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v6.0.0-alpha1 labels Apr 10, 2017
@talevy talevy added v5.5.0 and removed v5.4.0 labels Apr 18, 2017
@talevy talevy requested a review from martijnvg May 2, 2017 16:30
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I Left two comments.

@@ -51,6 +51,7 @@

private final Pipeline.Factory factory = new Pipeline.Factory();
private final Map<String, Processor.Factory> processorFactories;
private final boolean newDateFormat;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to newIngestTimestampFormat, since it only applies to ingest timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do, guess I took it for granted that this resides in an ingest-specific class.

/**
* Holder class for several ingest related services.
*/
public class IngestService {
public static final Setting<Boolean> NEW_DATE_FORMAT =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my previous comment makes sense then this should be renamed as well.

/**
* Holder class for several ingest related services.
*/
public class IngestService {
public static final Setting<Boolean> NEW_DATE_FORMAT =
Setting.boolSetting("ingest.new_date_format", false, Property.NodeScope, Property.Dynamic, Property.Deprecated);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not set the the dynamic flag here, because this setting isn't actually updated at runtime in PipelineStore (it is an immutable property).

Or instead we should make it a setting that can be setting that can be changed dynamically at runtime. (by using ClusterSettings#addSettingsUpdateConsumer(...) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martijnvg I am a bit new to how settings are managed here. Since we want this setting to be applied to all ingest-nodes, not just one...

is it right to leave it NodeScope+Dynamic and implement the addSettingsUpdateConsumer and keep the setting-flag up-to-date? Having this be non-dynamic and set per-node sounds dangerous since one ingest-node may do one thing, while another does something else, etc.

@talevy
Copy link
Contributor Author

talevy commented May 8, 2017

@martijnvg thanks for the review, I've updated it to properly register a settingUpdater, thanks for teaching me about that!

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment. Otherwise LGTM.

@@ -51,16 +52,23 @@

private final Pipeline.Factory factory = new Pipeline.Factory();
private final Map<String, Processor.Factory> processorFactories;
private Boolean newIngestDateFormat;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field should be 'volatile now, since it gets updated by a different thread than it is read from.
Maybe also change the type to a primitive boolean?

@talevy
Copy link
Contributor Author

talevy commented May 8, 2017

thanks! good catch, also fixed some long-lines

This is a backport of the update to 6.0 that defaults this new behavior.

Previously, Mustache would call `toString` on the `_ingest.timestamp`
field and return a date format that did not match Elasticsearch's
defaults for date-mapping parsing. The new ZonedDateTime class in Java 8
happens to do format itself in the same way ES is expecting.

Fixes elastic#23168.

This new fix can be found in the form of a cluster setting called
`ingest.new_date_format`. By default, in 5.x, the existing behavior
will remain the same. One will set this property to `true` in order to
take advantage of this update for ingest-pipeline convenience.
@talevy
Copy link
Contributor Author

talevy commented May 8, 2017

rebased to include latest master commits fixing unrelated test failures

@talevy
Copy link
Contributor Author

talevy commented May 8, 2017

will merge this into both master and 5.x then follow-up with appropriate documentation updates for 5.x and 6.0 as well as code removal for master

@talevy talevy merged commit 423b0f5 into elastic:master May 8, 2017
@talevy talevy deleted the fix-23168-5x branch May 8, 2017 22:06
talevy added a commit that referenced this pull request May 8, 2017
Previously, Mustache would call `toString` on the `_ingest.timestamp`
field and return a date format that did not match Elasticsearch's
defaults for date-mapping parsing. The new ZonedDateTime class in Java 8
happens to do format itself in the same way ES is expecting.

This commit adds support for a feature flag that enables the usage of this new date format
that has more native behavior.

Fixes #23168.

This new fix can be found in the form of a cluster setting called
`ingest.new_date_format`. By default, in 5.x, the existing behavior
will remain the same. One will set this property to `true` in order to
take advantage of this update for ingest-pipeline convenience.
@talevy
Copy link
Contributor Author

talevy commented May 8, 2017

merged change into 5.x: 38ac92a

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request May 9, 2017
* master:
  Increase compilation limit in ingest tests
  Mark 6.0.0-alpha1 as prerelease
  Updated release notes for 6.0.0-alpha1
  Fix single shard scroll within a cluster with nodes in version >= 5.3 and <= 5.3 (elastic#24512)
  add option for _ingest.timestamp to use new ZonedDateTime (elastic#24030)
  Fixes inefficient loading of snapshot repository data (elastic#24510)
  Scripting: Deprecate file scripts (elastic#24552)
  Remove commented code from ESILRTC
  Ensure test replicas have valid recovery state
  Add global checkpoint assertion in index shard
  Improve bootstrap checks error messages
  Refactor UpdateHelper into unit-testable pieces
  Fix cache expire after access
  Document work-around for jar hell in idea_rt.jar file (elastic#24523)
  Move MockLogAppender to elasticsearch test (elastic#24542)
  Remove gap skipping when opening engine
  documentation of preserve existing settings
  remove duplicated import in AppendProcessor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v5.5.0 v6.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ingest timestamp is not parseable as a valid ES date
3 participants