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

XPack: core/ccr/Security-cli migration to java-time #38415

Merged
merged 7 commits into from
Feb 5, 2019

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Feb 5, 2019

part of the migrating joda time work.
refactoring x-pack plugins usages of joda to java-time
refers #27330

@pgomulka pgomulka self-assigned this Feb 5, 2019
@pgomulka pgomulka added the :Core/Infra/Core Core issues without another label label Feb 5, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@@ -29,7 +29,8 @@
public class ScheduledEventTests extends AbstractSerializingTestCase<ScheduledEvent> {

public static ScheduledEvent createScheduledEvent(String calendarId) {
ZonedDateTime start = ZonedDateTime.ofInstant(Instant.ofEpochMilli(new DateTime(randomDateTimeZone()).getMillis()), ZoneOffset.UTC);
long millis = Clock.system(randomZone()).millis();// TODO we are converting to UTC anyway??
ZonedDateTime start = Instant.ofEpochMilli(millis).atZone(ZoneOffset.UTC);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure we need to do soo many convertions here. maybe using just 'ZonedDateTime.now(UTC)` ?

Copy link
Contributor

Choose a reason for hiding this comment

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

ack. can you check why we need random timezone here at all?

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@spinscale spinscale left a comment

Choose a reason for hiding this comment

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

I left few comments to be sure this works. especially when in 'mixed mode' during rolling upgrades (I do not know if anything gets serialized over the write, but it might be worth checking)

@@ -220,7 +220,7 @@
rolledDateHisto.interval(source.interval());
}

String timezone = source.timeZone() == null ? DateTimeZone.UTC.toString() : source.timeZone().toString();
String timezone = source.timeZone() == null ? ZoneOffset.UTC.toString() : source.timeZone().toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

does this get serialized over the wire somewhere? If so we may need to convert it using DateUtils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is read in ValuesSourceAggregationBuilder so I guess it is already taken care of?
with

 if (in.getVersion().before(Version.V_7_0_0)) {
            timeZone = DateUtils.dateTimeZoneToZoneId(in.readOptionalTimeZone());
        } else {
            timeZone = in.readOptionalZoneId();
        }

Copy link
Contributor

Choose a reason for hiding this comment

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

++

@@ -288,7 +288,7 @@ static QueryBuilder rewriteQuery(QueryBuilder builder, Set<RollupJobCaps> jobCap
String fieldName = range.fieldName();
// Many range queries don't include the timezone because the default is UTC, but the query
// builder will return null so we need to set it here
String timeZone = range.timeZone() == null ? DateTimeZone.UTC.toString() : range.timeZone();
String timeZone = range.timeZone() == null ? ZoneOffset.UTC.toString() : range.timeZone();
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is read from RangeQueryBuilder
does not seem to be using DateUtils
timeZone = in.readOptionalZoneId();
do you think that should be fixed in server?

Copy link
Contributor

Choose a reason for hiding this comment

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

please open an issue for that, so we do not forget about it

@@ -29,7 +29,8 @@
public class ScheduledEventTests extends AbstractSerializingTestCase<ScheduledEvent> {

public static ScheduledEvent createScheduledEvent(String calendarId) {
ZonedDateTime start = ZonedDateTime.ofInstant(Instant.ofEpochMilli(new DateTime(randomDateTimeZone()).getMillis()), ZoneOffset.UTC);
long millis = Clock.system(randomZone()).millis();// TODO we are converting to UTC anyway??
ZonedDateTime start = Instant.ofEpochMilli(millis).atZone(ZoneOffset.UTC);
Copy link
Contributor

Choose a reason for hiding this comment

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

ack. can you check why we need random timezone here at all?

@dimitris-athanasiou
Copy link
Contributor

Looks good for the ML changes.

@pgomulka
Copy link
Contributor Author

pgomulka commented Feb 5, 2019

this is failing the build because of change in RollupRequestTranslator.java
String timezone = source.timeZone() == null ? DateTimeZone.UTC.toString() : source.timeZone().toString();
to this
String timezone = source.timeZone() == null ? ZoneOffset.UTC.toString() : source.timeZone().toString();
This should be fixed in https://github.com/elastic/elasticsearch/pull/36237/files and the string comparison won't be necessary

@pgomulka pgomulka changed the title XPack: core/rollup/ccr/Security-cli migration to java-time XPack: core/ccr/Security-cli migration to java-time Feb 5, 2019
@pgomulka
Copy link
Contributor Author

pgomulka commented Feb 5, 2019

@elasticmachine run elasticsearch-ci/1

@pgomulka pgomulka merged commit afcdbd2 into elastic:master Feb 5, 2019
@polyfractal
Copy link
Contributor

Re: the rollup bits, I've updated #36237 and will try to get it merged soon

droberts195 added a commit to droberts195/elasticsearch that referenced this pull request Feb 6, 2019
The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by elastic#38415 and the fix is
identical to the one that was made in elastic#38405.
droberts195 added a commit that referenced this pull request Feb 6, 2019
The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by #38415 and the fix is
identical to the one that was made in #38405.
droberts195 added a commit to droberts195/elasticsearch that referenced this pull request Feb 6, 2019
)

The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by elastic#38415 and the fix is
identical to the one that was made in elastic#38405.
droberts195 added a commit to droberts195/elasticsearch that referenced this pull request Feb 6, 2019
)

The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by elastic#38415 and the fix is
identical to the one that was made in elastic#38405.
alpar-t pushed a commit to jasontedor/elasticsearch that referenced this pull request Feb 7, 2019
)

The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by elastic#38415 and the fix is
identical to the one that was made in elastic#38405.
droberts195 added a commit that referenced this pull request Feb 8, 2019
The clock resolution changed from jdk8 to jdk10, hence the
test is passing in jdk8 but failing in jdk10.  Scheduled
events are serialised and deserialised with millisecond
precision, making test fail in jdk 10 and higher.

Fixes a problem introduced by #38415 and the fix is
identical to the one that was made in #38405.

Backport of #38506
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Feb 11, 2019
* master:
  Add an authentication cache for API keys (elastic#38469)
  Fix exit code in certutil packaging test (elastic#38393)
  Enable logs for intermittent test failure (elastic#38426)
  Disable BWC to backport recovering retention leases (elastic#38477)
  Enable bwc tests now that elastic#38443 is backported. (elastic#38462)
  Fix Master Failover and DataNode Leave Blocking Snapshot (elastic#38460)
  Recover retention leases during peer recovery (elastic#38435)
  Set update mappings mater node timeout to 30 min (elastic#38439)
  Assert job is not null in FullClusterRestartIT (elastic#38218)
  Update ilm-api.asciidoc, point to REMOVE policy (elastic#38235) (elastic#38463)
  SQL: Fix esType for DATETIME/DATE and INTERVALS (elastic#38179)
  Handle deprecation header-AbstractUpgradeTestCase (elastic#38396)
  XPack: core/ccr/Security-cli migration to java-time (elastic#38415)
  Disable bwc tests for elastic#38443 (elastic#38456)
  Bubble-up exceptions from scheduler (elastic#38317)
  Re-enable TasksClientDocumentationIT.testCancelTasks (elastic#38234)
  Allow custom authorization with an authorization engine  (elastic#38358)
  CRUDDocumentationIT fix documentation references
  Remove support for internal versioning for concurrency control (elastic#38254)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants