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

kvserver: MVCC-compliant RevertRange variant #70416

Closed
erikgrinaker opened this issue Sep 20, 2021 · 3 comments · Fixed by #76478
Closed

kvserver: MVCC-compliant RevertRange variant #70416

erikgrinaker opened this issue Sep 20, 2021 · 3 comments · Fixed by #76478
Labels
A-kv-server Relating to the KV-level RPC server C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@erikgrinaker
Copy link
Contributor

erikgrinaker commented Sep 20, 2021

As described in #69380, we need an MVCC-compliant variant of RevertRange that allows us to undo recent changes to a key span, typically in order to cancel bulk operations such as IMPORT INTO. Conceptually, this needs to iterate across the visible keys at the target revert time (including tombstones), and any keys that have a different most-recent value must be replaced by its original value. In the case of deletes, if there are long runs of keys to delete, it should drop an MVCC range tombstone instead.

To accomplish this, we should add a lower timestamp predicate to DeleteRange that will only drop tombstones over keys that have a timestamp at or later than the given lower timestamp. It should use range tombstones where possible, to delete long runs of matching keys, but fall back to point tombstones when necessary.

See also the (currently internal) design document.

Epic CRDB-2624

Jira issue: CRDB-10066

@erikgrinaker erikgrinaker added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-kv-server Relating to the KV-level RPC server T-kv KV Team labels Sep 20, 2021
@erikgrinaker erikgrinaker self-assigned this Feb 12, 2022
@erikgrinaker erikgrinaker changed the title kvserver: add lower timestamp predicate for DeleteRange kvserver: MVCC-compliant RevertRange variant Feb 12, 2022
@erikgrinaker
Copy link
Contributor Author

@dt I agree with what you said before about an MVCC-compliant RevertRange making more sense than a timestamp predicate for DeleteRange, so I'm going with that. For completeness, I'm also going to make it so that it will update any modified keys back to their original value, which should be straightforward.

@erikgrinaker
Copy link
Contributor Author

This PR got reverted, we'll hold it for 22.2.

@erikgrinaker
Copy link
Contributor Author

erikgrinaker commented Jun 27, 2022

The intended functionality here, i.e. MVCC-compliant import rollbacks, will use DeleteRange instead and is tracked in #76722.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-kv-server Relating to the KV-level RPC server C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant