Skip to content

Make randomInstantBetween always return value in range [minInstant, maxInstant]#114177

Merged
parkertimmins merged 5 commits intoelastic:mainfrom
parkertimmins:fix-test-random-instant-function
Oct 7, 2024
Merged

Make randomInstantBetween always return value in range [minInstant, maxInstant]#114177
parkertimmins merged 5 commits intoelastic:mainfrom
parkertimmins:fix-test-random-instant-function

Conversation

@parkertimmins
Copy link
Contributor

Currently, randomInstantBetween can produce a result which is not within the minInstant, maxInstant range. This occurs when the epoch seconds picked matches the minInstant seconds and the nanos are below the minInstant nanos, or the epoch second picked matches the maxInstant seconds and nanos are above the maxInstant nanos.

Currently, randomInstantBetween can produce a result which
is not within the minInstant, maxInstant range. This occurs
when the second picked matches the min bound and the nanos
are below the min nanos, or the second picked matches the max
bound seconds and nanos are above the max bound nanos.
@parkertimmins parkertimmins requested a review from timgrein October 4, 2024 21:43
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.0.0 labels Oct 4, 2024
@parkertimmins parkertimmins added >bug :Core/Infra/Metrics Metrics and metering infrastructure and removed needs:triage Requires assignment of a team area label v9.0.0 labels Oct 4, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Oct 4, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@parkertimmins parkertimmins removed the request for review from timgrein October 4, 2024 21:46
@elasticsearchmachine
Copy link
Collaborator

Hi @parkertimmins, I've created a changelog YAML for you.

Copy link
Contributor

@mosche mosche left a comment

Choose a reason for hiding this comment

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

lgtm

@parkertimmins parkertimmins merged commit fe36a45 into elastic:main Oct 7, 2024
@parkertimmins parkertimmins deleted the fix-test-random-instant-function branch October 7, 2024 13:34
matthewabbott pushed a commit to matthewabbott/elasticsearch that referenced this pull request Oct 10, 2024
…lastic#114177)

randomInstantBetween can produce a result which is not within the [minInstant, maxInstant] range. This occurs when the epoch second picked matches the min bound and the nanos are below the min nanos, or the second picked matches the max bound seconds and nanos are above the max bound nanos. This change fixes the function by setting a bound on which nano values can be picked if the min or max epoch second value is picked.
davidkyle pushed a commit to davidkyle/elasticsearch that referenced this pull request Oct 13, 2024
…lastic#114177)

randomInstantBetween can produce a result which is not within the [minInstant, maxInstant] range. This occurs when the epoch second picked matches the min bound and the nanos are below the min nanos, or the second picked matches the max bound seconds and nanos are above the max bound nanos. This change fixes the function by setting a bound on which nano values can be picked if the min or max epoch second value is picked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Core/Infra/Metrics Metrics and metering infrastructure Team:Core/Infra Meta label for core/infra team v8.16.0 v9.0.0

3 participants