-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Optimise rejection of out-of-range long
values
#40325
Optimise rejection of out-of-range long
values
#40325
Conversation
Today if you try and insert a very large number like `1e9999999` into a long field we first construct this number as a `BigDecimal`, convert this to a `BigInteger` and then reject it because it is out of range. Unfortunately making such a large `BigInteger` is rather expensive. We can avoid this expense by performing a (weaker) range check on the `BigDecimal` representation of incoming `long`s too. Relates elastic#26137 Closes elastic#40323
Pinging @elastic/es-search |
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.
Good catch. The change looks good to me. I'm wondering whether the timeouts on tests are left-overs?
@@ -27,19 +28,26 @@ | |||
|
|||
public class NumbersTests extends ESTestCase { | |||
|
|||
@Timeout(millis = 10000) |
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.
does it take that long?
@@ -367,17 +368,20 @@ public void testEmptyName() throws IOException { | |||
} | |||
} | |||
|
|||
@Timeout(millis = 30000) |
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.
Is it taking that long?
I was unsure about whether to include these timeouts. The tests complete in milliseconds today with the fix, but I'm nervous about short timeouts adding to CI flakiness. Without the fix or the timeout these tests take a very long time to fail which I think isn't great either. I don't feel strongly, however, and will take them out if you think it better. |
Today if you try and insert a very large number like `1e9999999` into a long field we first construct this number as a `BigDecimal`, convert this to a `BigInteger` and then reject it because it is out of range. Unfortunately making such a large `BigInteger` is rather expensive. We can avoid this expense by performing a (weaker) range check on the `BigDecimal` representation of incoming `long`s too. Relates #26137 Closes #40323
Today if you try and insert a very large number like `1e9999999` into a long field we first construct this number as a `BigDecimal`, convert this to a `BigInteger` and then reject it because it is out of range. Unfortunately making such a large `BigInteger` is rather expensive. We can avoid this expense by performing a (weaker) range check on the `BigDecimal` representation of incoming `long`s too. Relates #26137 Closes #40323
* master: (25 commits) [DOCS] Correct keystore commands for Email and Jira actions in Watcher (elastic#40417) [DOCS] Document common settings for snapshot repository plugins (elastic#40475) Remove with(out)-system-key tests (elastic#40547) Geo Point parse error fix (elastic#40447) Handle null retention leases in WaitForNoFollowersStep (elastic#40477) [DOCS] Adds anchors for ruby client (elastic#39867) Mute DataFrameAuditorIT#testAuditorWritesAudits Disable integTest when Docker is not available (elastic#40585) Add randomScore function in script_score query (elastic#40186) Test fixtures krb5 (elastic#40297) Correct ILM metadata minimum compatibility version (elastic#40569) SQL: Centralize SQL test dependencies version handling (elastic#40551) Mute testTracerLog Mute testHttpInput Include functions' aliases in the list of functions (elastic#40584) Optimise rejection of out-of-range `long` values (elastic#40325) Add docs for cluster.remote.*.proxy setting (elastic#40281) Migrate systemd packaging tests from bats to java (elastic#39954) Move top-level pipeline aggs out of QuerySearchResult (elastic#40319) Use openjdk 12 in packer cache script (elastic#40498) ...
* elastic/7.0: (50 commits) Fix more broken links in plugins docs Fix archives links in plugins docs Disable integTest when Docker is not available (elastic#40585) Add docs for bundled jdk (elastic#40487) [DOCS] Correct keystore commands for Email and Jira actions in Watcher (elastic#40417) (elastic#40613) Add usage indicators for the bundled JDK (elastic#40616) Add ability to mute and mute flaky fixture (elastic#40630) Test fixtures krb5 (elastic#40297) Update docs for the DFR similarity (elastic#40579) Update ingest jdocs that a null return value will drop the current document. (elastic#40359) [DOCS] Document common settings for snapshot repository plugins (elastic#40475) (elastic#40607) [DOCS] Fixes formatting in breaking changes Handle null retention leases in WaitForNoFollowersStep (elastic#40477) Correct ILM metadata minimum compatibility version (elastic#40569) Mute SpecificMasterNodesIT.testElectOnlyBetweenMasterNodes() Mute testHttpInput Include functions' aliases in the list of functions (elastic#40584) Optimise rejection of out-of-range `long` values (elastic#40325) Add docs for cluster.remote.*.proxy setting (elastic#40281) Mute WatchAckTests.testAckAllActions ...
Today if you try and insert a very large number like `1e9999999` into a long field we first construct this number as a `BigDecimal`, convert this to a `BigInteger` and then reject it because it is out of range. Unfortunately making such a large `BigInteger` is rather expensive. We can avoid this expense by performing a (weaker) range check on the `BigDecimal` representation of incoming `long`s too. Relates #26137 Closes #40323
Today if you try and insert a very large number like
1e9999999
into a longfield we first construct this number as a
BigDecimal
, convert this to aBigInteger
and then reject it because it is out of range. Unfortunatelymaking such a large
BigInteger
is rather expensive.We can avoid this expense by performing a (weaker) range check on the
BigDecimal
representation of incominglong
s too.Relates #26137
Closes #40323