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

cherrypick-2.0: sql, kv: use Delete instead of DeleteRange to lessen impact on tscache #23289

Conversation

spencerkimball
Copy link
Member

@spencerkimball spencerkimball commented Mar 1, 2018

Previously, on the slow path for deletion from SQL, rows were deleted
using a call to DeleteRange in order to remove all column families
with a single statement. It turns out this is better done using one
call per column family to Delete. DeleteRange must update the
write timestamp cache in order to avoid lost update anomalies. By
lessening the pressure on the timestamp cache, we can avoid pushing
a transaction's commit timestamp forward and triggering a retry. This
allow substantially longer / larger DELETE FROM statements to run
to completion, assuming there is no other concurrency which will force
a retry.

In conjunction, a realization from #21165 was that large DELETE FROM
statements can end up running forever. This occurs because they are
retryable from the SQL executor and continue to get retryable errors
due to the timestamp cache being unable to avoid pushing their
timestamps forward.

Release note (sql change): will fix endless churn experienced from
large DELETE FROM statements, either by allowing them to complete,
or by exiting with an error message indicating the transaction is too
large to complete.

…impact on tscache

Previously, on the slow path for deletion from SQL, rows were deleted
using a call to `DeleteRange` in order to remove all column families
with a single statement. It turns out this is better done using one
call per column family to `Delete`. `DeleteRange` must update the
write timestamp cache in order to avoid lost update anomalies. By
lessening the pressure on the timestamp cache, we can avoid pushing
a transaction's commit timestamp forward and triggering a retry. This
allow substantially longer / larger `DELETE FROM` statements to run
to completion, assuming there is no other concurrency which will force
a retry.

In conjunction, a realization from cockroachdb#21165 was that large `DELETE FROM`
statements can end up running forever. This occurs because they are
retryable from the SQL executor and continue to get retryable errors
due to the timestamp cache being unable to avoid pushing their
timestamps forward.

Release note (sql change): will fix endless churn experienced from
large `DELETE FROM` statements, either by allowing them to complete,
or by exiting with an error message indicating the transaction is too
large to complete.
@spencerkimball spencerkimball requested review from bdarnell and a team March 1, 2018 21:18
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@spencerkimball spencerkimball changed the title cherrypick-2.0: sql, kv: use Delete instead of DeleteRange to lessen … cherrypick-2.0: sql, kv: use Delete instead of DeleteRange to lessen impact on tscache Mar 1, 2018
@spencerkimball spencerkimball merged commit 93d9b0f into cockroachdb:release-2.0 Mar 2, 2018
@spencerkimball spencerkimball deleted the cherrypick-delete-from branch March 2, 2018 00:42
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.

None yet

3 participants