Skip to content

tree: harden constant resolution#85966

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:constants
Aug 16, 2022
Merged

tree: harden constant resolution#85966
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:constants

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich commented Aug 11, 2022

This commit makes it so that the resolution of NumVal constants is
done at most once for each possible type in all code paths. The idea is
that the first time we resolve the value as a particular type, we
memorize the resolved value (which we were already doing previously) and
memorize the fact that the resolution to that particular type has been
done previously. Since the NumVal expressions should not change, the
next time we need to do its resolution, we can just the cached value
directly. This required splitting out int64 and int32 to use different
datums under the hood since the resolution of those two types can be
different (with values outside of int32 range).

Fixes: #85934.

Release note: None

This commit makes it so that the resolution of `NumVal` constants is
done at most once for each possible type in all code paths. The idea is
that the first time we resolve the value as a particular type, we
memorize the resolved value (which we were already doing previously) and
memorize the fact that the resolution to that particular type has been
done previously. Since the `NumVal` expressions should not change, the
next we need to do its resolution, we can just the cached value
directly. This required splitting out int64 and int32 to use different
datums under the hood since the resolution of those two types can be
different (with values outside of int32 range).

Release note: None
@yuzefovich yuzefovich requested review from a team and mgartner August 11, 2022 16:21
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner)

@yuzefovich
Copy link
Copy Markdown
Member Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 15, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 15, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 16, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 16, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 16, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 16, 2022

Build succeeded:

@craig craig bot merged commit 8f1b11e into cockroachdb:master Aug 16, 2022
@yuzefovich yuzefovich deleted the constants branch August 16, 2022 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: race in TestCancelMultipleQueued under stress

3 participants