-
Notifications
You must be signed in to change notification settings - Fork 60
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
Extract query ID from all kill_query procedure variations #425
base: main
Are you sure you want to change the base?
Extract query ID from all kill_query procedure variations #425
Conversation
0f19b85
to
1ad0e45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine .. I wish we would not have to mock around for stuff like that but a full integration test seems worse..
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
1ad0e45
to
a8355b6
Compare
a8355b6
to
83760bd
Compare
gateway-ha/src/main/java/io/trino/gateway/ha/handler/ProxyUtils.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/handler/TestQueryIdCachingProxyHandler.java
Outdated
Show resolved
Hide resolved
9a00f3e
to
95e782a
Compare
gateway-ha/src/main/java/io/trino/gateway/ha/handler/ProxyUtils.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regular expression is incorrect in some cases.
95e782a
to
c311199
Compare
Needs a rebase now.. |
c311199
to
e9226b6
Compare
{ | ||
assertThat( | ||
extractQueryIdIfPresent( | ||
prepareMockRequestWithBody("CALL system.runtime.kill_query(query_id => '20200416_160256_03078_6b4yt', message => 'If he dies, he dies')"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test case with uppercase procedure name KILL_QUERY
.
assertThat(extractQueryIdIfPresent(prepareMockRequestWithBody("call Kill_Query('20200416_160256_03078_6b4yt')"), ImmutableList.of())) | ||
.isEqualTo("20200416_160256_03078_6b4yt"); | ||
|
||
assertThat(extractQueryIdIfPresent(prepareMockRequestWithBody("select * from postgres.query_logs.queries where sql LIKE '%kill_query(''20200416_160256%' "), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uppercase select
, from
and where
.
assertThat(extractQueryIdIfPresent( | ||
prepareMockRequestWithBody("select * from postgres.query_logs.queries where sql LIKE 'CALL kill_query(_20200416_160256_03078_6b4yt_)' "), | ||
ImmutableList.of())) | ||
.isNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more test cases. e.g.
The procedure exists in a comment
// CALL kill_query('20200416_160256_03078_6b4yt', 'If he dies, he dies')
SELECT 1
Spaces exists
CALL kill_query ( '20200416_160256_03078_6b4yt', 'If he dies, he dies')
New lines exist
CALL kill_query(
'20200416_160256_03078_6b4yt',
'If he dies, he dies')
Description
Trino Gateway attempts to extract the query id from the body of queries using the runtime.kill_query procedure from the system catalog. This adds a test for this functionality.
Additional context and related issues
Release notes
( x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: