Skip to content
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

storage: use new range tombstone stack for gc ops #86742

Merged
merged 1 commit into from
Aug 25, 2022

Conversation

aliher1911
Copy link
Contributor

This commit replaces bespoke range tombstone stack manipulation
logic with functions provided by MVCCRangeKeyStack type.

Release justification: code cleanup not changing functionality.
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

pkg/storage/mvcc.go Outdated Show resolved Hide resolved
pkg/storage/mvcc.go Show resolved Hide resolved
rangeTombstoneTss = rangeTombstoneTss[:0]
for _, v := range rangeKeys.Versions {
rangeTombstoneTss = append(rangeTombstoneTss, v.Timestamp)
// We can rely on range key changed iterator functionality here as we do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// We can rely on range key changed iterator functionality here as we do
// We can't rely on range key changed iterator functionality here as we do

Copy link
Contributor

Choose a reason for hiding this comment

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

RangeKeyChanged() does fire correctly on seek operations too, but one has to take care to track it for every positioning operation. I'm fine with not doing it now though, this is simple and more obviously correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think tracking for all Next() is a non-starter here for now. We rely on get metadata to seek and potentially Next() as a side effect +all the subsequent iterations. We'll have to hasChanged |= iter.RangeKeyChaneged() through the whole method till it reaches this point. That would be too fragile even if we know that key doesn't change while iterating key's versions.

This commit replaces bespoke range tombstone stack manipulation
logic with functions provided by MVCCRangeKeyStack type.

Release justification: code cleanup not changing functionality.
Release note: None
@aliher1911 aliher1911 force-pushed the gc_iter_use_new_iter branch from 9460e0f to 40962cf Compare August 24, 2022 13:20
@aliher1911 aliher1911 marked this pull request as ready for review August 24, 2022 13:51
@aliher1911 aliher1911 requested a review from a team as a code owner August 24, 2022 13:51
@aliher1911
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Aug 24, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 25, 2022

Build succeeded:

@craig craig bot merged commit 524fd14 into cockroachdb:master Aug 25, 2022
DrewKimball added a commit to DrewKimball/cockroach that referenced this pull request Sep 8, 2022
This commit modifies the sqlsmith logic to add all columns to the `OVER`
clause for all window functions except for the ranking functions. This is
necessary because all other window/aggregate functions can produce different
results for different rows within a peer group. Ordering on all columns
ensures that we are ordering on a key, which restricts each peer group to
one row (and therefore ensures there is only one possible order within each
peer group). This commit also reverts cockroachdb#86742, since window functions should
now be deterministic.

Fixes cockroachdb#87353

Release note: None
craig bot pushed a commit that referenced this pull request Sep 13, 2022
87591: roachtest: make window functions deterministic r=DrewKimball a=DrewKimball

This commit modifies the sqlsmith logic to add all columns to the `OVER` clause for all window functions except for the ranking functions. This is necessary because all other window/aggregate functions can produce different results for different rows within a peer group. Ordering on all columns ensures that we are ordering on a key, which restricts each peer group to one row (and therefore ensures there is only one possible order within each peer group). This commit also reverts #86742, since window functions should now be deterministic.

Fixes #87353

Release note: None

Co-authored-by: DrewKimball <[email protected]>
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.

3 participants