Skip to content

sql: make COPY TO/FROM respect timeouts and cancellation, and appear in SHOW QUERIES#97808

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
rafiss:use-conn-exec-for-copy
Mar 1, 2023
Merged

sql: make COPY TO/FROM respect timeouts and cancellation, and appear in SHOW QUERIES#97808
craig[bot] merged 2 commits intocockroachdb:masterfrom
rafiss:use-conn-exec-for-copy

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Feb 28, 2023

informs #94194

sql: use conn executor state machine for COPY FROM

Using the conn executor state machine allows a lot of bespoke logic to
be removed. (If we were to remove the copy_from_atomic_enabled setting
and make it always true, we could remove even more custom logic.)

This then makes it easy to hook up to cancellation and introspection.

Release note (bug fix): The COPY FROM command now respects the
statement_timeout and transaction_timeout settings.

Release note (bug fix): The COPY FROM command now appears in the results
of SHOW QUERIES.


sql: make stmt/txn timeout apply to COPY TO

This commit simplifies the conn executor state transitions a bit, and
adds in timers for stmt/txn timeouts analogously to how they were for
COPY FROM.

No release note since COPY TO is new.

@rafiss rafiss requested review from a team and otan February 28, 2023 20:06
@rafiss rafiss requested a review from a team as a code owner February 28, 2023 20:06
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rafiss rafiss force-pushed the use-conn-exec-for-copy branch from 422a954 to 85976ec Compare February 28, 2023 20:12
@otan
Copy link
Copy Markdown
Contributor

otan commented Feb 28, 2023

cc @cucaroach in case this influences any work you're doing on copy statement bundles

Copy link
Copy Markdown
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

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

did a first pass: some tests look like they need some fixing.

i also have a minor concern about how this affects retries - COPY FROM / TO should never retry (given it directly digests / spits out messages on the wire without buffering them). do you know if that is still valid / a test case already covers them?

@otan otan self-requested a review February 28, 2023 20:43
@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Feb 28, 2023

yes, there are tests. see TestCopyFromRetries

@rafiss rafiss force-pushed the use-conn-exec-for-copy branch from 85976ec to 7086a95 Compare February 28, 2023 21:16
Using the conn executor state machine allows a lot of bespoke logic to
be removed. (If we were to remove the copy_from_atomic_enabled setting
and make it always true, we could remove even more custom logic.)

This then makes it easy to hook up to cancellation and introspection.

Release note (bug fix): The COPY FROM command now respects the
statement_timeout and transaction_timeout settings.

Release note (bug fix): The COPY FROM command now appears in the results
of SHOW QUERIES.
This commit simplifies the conn executor state transitions a bit, and
adds in timers for stmt/txn timeouts analogously to how they were for
COPY FROM.

No release note since COPY TO is new.

Release note: None
@rafiss rafiss force-pushed the use-conn-exec-for-copy branch from 7086a95 to 78e6280 Compare February 28, 2023 21:17
@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Feb 28, 2023

i've fixed those test failures; the changes were pretty minor

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Mar 1, 2023

tftr!

bors r=otan

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 1, 2023

Build succeeded:

@craig craig bot merged commit a683fc7 into cockroachdb:master Mar 1, 2023
@rafiss rafiss deleted the use-conn-exec-for-copy branch March 1, 2023 15:37
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.

4 participants