Skip to content

Fix: terminate running Redshift queries when SQLMesh is interrupted - #6144

Draft
gandeevanraghuramandd wants to merge 2 commits into
SQLMesh:mainfrom
gandeevanraghuramandd:graghura/redshift-terminate-queries-on-interrupt
Draft

gandeevanraghuramandd wants to merge 2 commits into
SQLMesh:mainfrom
gandeevanraghuramandd:graghura/redshift-terminate-queries-on-interrupt

Conversation

@gandeevanraghuramandd

Copy link
Copy Markdown

Description

Test Plan

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

On Ctrl-C, SnapshotEvaluator.concurrent_context() recycles the adapter
before the context closes it. ThreadLocalConnectionPool.close_all() clears
every thread's attributes, so close() no longer found the backend PIDs of
queries still running on worker threads and left them running on Redshift.

RedshiftEngineAdapter now terminates running queries in both recycle() and
close(), before the pool is closed. If the calling thread was interrupted
mid-query or mid-transaction, its connection is closed and the sessions are
terminated from a new one.

Also removes the SIGTERM-to-SIGINT mapping in the CLI, which is deferred to
a follow-up so this change is scoped to Ctrl-C.
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.

1 participant