Skip to content

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

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

Merged

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
16 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants