-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Fix DateMathExpressionResolverTests tests #37037 #37059
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
Conversation
I lost quite a few hours looking into this. My first commit wasn't a complete fix, there were other instances of Thanks to freenode #java for the pointer |
Pinging @elastic/es-core-infra |
test this please |
@rjernst would you have a chance to look into this one and the related test failures? |
server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java
Outdated
Show resolved
Hide resolved
@javanna, can you ask the bot to retest? |
@jsoref could you also check out and unmute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few notes about the file structure finder files. Please revert the changes to (only) the file structure finder files in this PR. I know I need to do work on this for 6.7 but it's not quite the same as the other changes in this PR and I would rather separate it out.
...n/ml/src/main/java/org/elasticsearch/xpack/ml/filestructurefinder/TimestampFormatFinder.java
Outdated
Show resolved
Hide resolved
https://www.juandebravo.com/2015/04/10/java-yyyy-date-format/ In short for the Java SimpleDateFormat class: YYYY is "4 digit year for use with week number notation" yyyy is "4 digit year for use with month day notation" See https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html Roughly, cases with YYYY/YY + W/WW/WWW should be using YYYY/YY, and pretty much everything else wants yyyy/yy. Notably: Joda's DateTimeFormat class is different: https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html
@droberts195: done |
Thanks @jsoref. Next time please push a new commit rather than amending an existing one that someone has commented on, because amending the commit that has comments stops others viewing the full context around the comments. But I can see you've removed all the files related to the file structure finder so don't worry about it this time. I no longer have an objection to this PR being merged once @rjernst and @javanna are happy. |
retest this please |
run gradle build tests 2 |
One of the core issues of the
|
@javanna is this me? |
@jsoref I am not sure :) You mean if you should make the change that @spinscale suggested? |
Well, both the last build failure (default-distro) and also that change... I'm really just trying to make a small incremental change. It shouldn't really be blocked on every possible thing in your codebase... It sounds like @spinscale understands the change -- to me it seems better for that to be authored by @spinscale than by me... |
I agree @jsoref it sounds like the suggested change can be made as a follow-up. I think the build bit that was red is not your fault, I need to re-run it, let me find the magic command to run only that part... ;) |
run sample packaging tests |
ops, wrong one :) |
run default distro tests |
1 similar comment
run default distro tests |
FYI the changes to the structure finder that I said I would do in #37059 (review) are in #37306. |
Is this something that we would like to get in? Is it worth addressing merge conflicts or? Please can you comment @rjernst , @spinscale or re-assign? |
Jenkins test this please |
I think it would be good to get this merged into master before 7.0 and 7.x are branched. On 31st December 2018 a whole load of CI builds failed due to YYYY meaning week year in Java time. If we don't merge this then this year the same tests will fail on both 30th and 31st December (due to the way week years diverge from "normal" calendar years on 0-3 days). Also, it's setting a bad example to people who copy the formats from the code if we're still using YYYY in formats that are going to be used by the Java time parser. I merged latest master into the PR branch to try to progress this. But I think approval to merge should come from someone who is working on the Java time project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a few changes that look like they happened by search & replace, that should be reverted
server/src/main/java/org/joda/time/format/StrictISODateTimeFormat.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/common/time/DateFormattersTests.java
Outdated
Show resolved
Hide resolved
@@ -201,7 +201,7 @@ October 28, 2015 | |||
they did before the upgrade. For example if `watcher.dynamic_indices.time_zone` | |||
setting was set to `+01:00` and a watch has the following index name | |||
`<logstash-{now/d}>` then after the upgrade you need to update this watch to | |||
use the following index name `<logstash-{now/d{YYYY.MM.dd|+01:00}}>`. | |||
use the following index name `<logstash-{now/d{yyyy.MM.dd|+01:00}}>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are old release notes, that might be outdated in other ways as well, I am not sure if it is worth updating?
@@ -232,8 +232,8 @@ public void testYearOfEra() { | |||
} | |||
|
|||
public void testToString1() { | |||
assertMethodDeprecation(() -> assertThat(javaTime.toString("YYYY/MM/dd HH:mm:ss.SSS"), | |||
equalTo(jodaTime.toString("YYYY/MM/dd HH:mm:ss.SSS"))), "toString(String)", "a DateTimeFormatter"); | |||
assertMethodDeprecation(() -> assertThat(javaTime.toString("yyyy/MM/dd HH:mm:ss.SSS"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by reading this. Shouldnt one be in capital letters and one not in order for this to work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java time cares significantly about Y
vs y
. Afaict, Joda time only uses Y
vs y
to exclude 0
and negative numbers (actually, the documentation I can find differs about whether or not 0
is a valid value, but...).
That said, y
in joda is the "year" w/o the constraint, which is a closer map to Java y
.
...lugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/history/HistoryStoreField.java
Outdated
Show resolved
Hide resolved
@@ -70,7 +70,7 @@ | |||
Setting.affixKeySetting("xpack.monitoring.exporters.","index.name.time_format", | |||
key -> Setting.simpleString(key, Property.Dynamic, Property.NodeScope)); | |||
|
|||
private static final String INDEX_FORMAT = "YYYY.MM.dd"; | |||
private static final String INDEX_FORMAT = "yyyy.MM.dd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the monitoring side of things is fixed in #35809
Thank you for your PR but it seems that this has been fixed meanwhile in #38376. I hope that you understand that I therefore close this PR unmerged. |
@danielmitterdorfer: I understand in some ways. At the end of the day, I don't care who gets credit for fixing things -- I just want the thing fixed so it doesn't interfere with whatever I'm actually trying to accomplish. From a process perspective, I'm disappointed in the way it was managed. Ideally if someone wants to adopt a ticket the previous person working on it should be informed so they can stop worrying about it/working on it. There's clearly enough information in GitHub for this to happen -- both PRs were tied to the same issue. I'm glad to be informed, but a month delay in being informed seems a bit long. I hope you understand that perspective. |
https://www.juandebravo.com/2015/04/10/java-yyyy-date-format/
In short:
YYYY is "4 digit year for use with week number notation"
yyyy is "4 digit year for use with month day notation"
#37037