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

Check stv_inflight for query PID for redshift cancel #375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MasterOdin
Copy link
Contributor

@MasterOdin MasterOdin commented Jan 6, 2022

This PR modifies the cancel method for redshift to consider both STV_INFLIGHT over STV_RECENTS system tables. For some setups of Redshift, we are finding that getting the currently running query is more reliable to search the STV_INFLIGHT over STV_RECENTS. In these setups, the query will show up in the former table and not in the latter table until after the query has finished. I'm not totally certain why that is, but suspect it's something to do with the nature of cluster nodes, but the whole thing is opaque and I couldn't find any good concrete information on googling. A downside here is that STV_INFLIGHT includes a lot less query text (100 vs 600) for some reason, so inclusion of both tables seems the best strategy. One thought would be to prepend the comment with run information (followed by a newline) to the query so that it's always at the beginning and so therefore always present before truncation.

The join here shouldn't add too much additional overhead, but I don't have a heavily used Redshift cluster to verify against.

Signed-off-by: Matthew Peveler <matt@popsql.com>
@MasterOdin
Copy link
Contributor Author

Not sure why the build suite is failing here, and I don't know enough about Ruby ecosystem or this project to know where to start.

@ankane
Copy link
Owner

ankane commented Feb 2, 2022

Hey @MasterOdin, thanks for the PR! Will dig into this next time I'm working with Redshift (not sure when that'll be exactly).

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

2 participants