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

INSERT ... SELECTs are not cancelled on session disconnect #18715

Closed
teskje opened this issue Apr 11, 2023 · 0 comments · Fixed by #19315
Closed

INSERT ... SELECTs are not cancelled on session disconnect #18715

teskje opened this issue Apr 11, 2023 · 0 comments · Fixed by #19315
Assignees
Labels
A-ADAPTER Topics related to the ADAPTER layer C-bug Category: something is broken

Comments

@teskje
Copy link
Contributor

teskje commented Apr 11, 2023

What version of Materialize are you using?

main

How did you install Materialize?

Built from source

What is the issue?

When one performs an INSERT ... SELECT statement with a long-running SELECT query, and then disconnects the session, adapter does not cancel the in-progress peek.

To reproduce (courtesy of @philip-stoev):

  1. Start a long-running INSERT ... SELECT, e.g.:

    CREATE TABLE t1 (f1 INTEGER);
    INSERT INTO t1 WITH MUTUALLY RECURSIVE flip(x INTEGER) AS (VALUES(1) EXCEPT ALL SELECT * FROM flip) SELECT * FROM flip;

    Note that this example uses WMR, which needs to be enable through --unsafe-mode or the feature flag, to produce a divergent query that will never return. Any other slow query works too.

  2. Forcefully disconnect the session from another terminal, e.g.:

    $ killall psql
    

Observe that adapter is not immediately cancelling the in-progress peek with the compute controller. The cancellation only happens when the statement timeout occurs. This behavior is different than for regular SELECT queries, which are cancelled immediately on session disconnect.

Note that the bug might be difficult to observe, depending on your test query. For example, the above divergent WMR query will never stop running regardless of whether the peek was cancelled or not (#16800). I suggest you instrument the code to print when the compute controller receives a CancelPeeks command.

Relevant log output

No response

@teskje teskje added C-bug Category: something is broken A-ADAPTER Topics related to the ADAPTER layer labels Apr 11, 2023
@chaas chaas removed their assignment Apr 19, 2023
@andrewrodriguez-m andrewrodriguez-m self-assigned this Apr 27, 2023
andrewrodriguez-m added a commit that referenced this issue May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ADAPTER Topics related to the ADAPTER layer C-bug Category: something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants