forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Add big query error in audit log (StarRocks#49611)
Why I'm doing: When exceeding the thredsholds of big_query_cpu_second_limit or big_query_scan_rows_limit, the query will be failed. However, we don't know a query is killed by which big query thredsholds or other reasons. What I'm doing: Add BIG_QUERY_CPU_SECOND_LIMIT_EXCEEDED and BIG_QUERY_SCAN_ROWS_LIMIT_EXCEEDED to TStatusCode. Signed-off-by: zihe.liu <[email protected]>
- Loading branch information
Showing
10 changed files
with
161 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
test/sql/test_resource_group/R/test_resource_group_big_query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- name: test_resource_group_big_query | ||
create table t1 ( | ||
k1 int | ||
) | ||
duplicate key(k1) | ||
distributed by hash(k1) buckets 32 | ||
properties("replication_num" = "1"); | ||
-- result: | ||
-- !result | ||
insert into t1 select generate_series FROM TABLE(generate_series(1, 65535)); | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
insert into t1 select k1 from t1; | ||
-- result: | ||
-- !result | ||
create resource group rg_${uuid0} | ||
to ( user='user_${uuid0}' ) | ||
with ('cpu_core_limit' = '1', 'mem_limit' = '0.99', 'big_query_cpu_second_limit'='1'); | ||
-- result: | ||
-- !result | ||
with w1 as (select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1) | ||
select /*+SET_VAR(resource_group='rg_${uuid0}')*/ count(1) from w1; | ||
-- result: | ||
[REGEX].*exceed big query cpu limit: current is \d+ns but limit is 1000000000ns.* | ||
-- !result | ||
alter resource group rg_${uuid0} with ('big_query_cpu_second_limit'='0','big_query_scan_rows_limit'='1'); | ||
-- result: | ||
-- !result | ||
select /*+SET_VAR(resource_group='rg_${uuid0}')*/ count(1) from t1; | ||
-- result: | ||
[REGEX].*exceed big query scan_rows limit: current is \d+ but limit is 1.* | ||
-- !result | ||
select count(1) from t1; | ||
-- result: | ||
33553920 | ||
-- !result |
38 changes: 38 additions & 0 deletions
38
test/sql/test_resource_group/T/test_resource_group_big_query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- name: test_resource_group_big_query | ||
create table t1 ( | ||
k1 int | ||
) | ||
duplicate key(k1) | ||
distributed by hash(k1) buckets 32 | ||
properties("replication_num" = "1"); | ||
|
||
insert into t1 select generate_series FROM TABLE(generate_series(1, 65535)); | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
insert into t1 select k1 from t1; | ||
|
||
create resource group rg_${uuid0} | ||
to ( user='user_${uuid0}' ) | ||
with ('cpu_core_limit' = '1', 'mem_limit' = '0.99', 'big_query_cpu_second_limit'='1'); | ||
|
||
|
||
with w1 as (select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1 | ||
union all select * from t1 union all select * from t1) | ||
select /*+SET_VAR(resource_group='rg_${uuid0}')*/ count(1) from w1; | ||
|
||
|
||
alter resource group rg_${uuid0} with ('big_query_cpu_second_limit'='0','big_query_scan_rows_limit'='1'); | ||
select /*+SET_VAR(resource_group='rg_${uuid0}')*/ count(1) from t1; | ||
|
||
|
||
select count(1) from t1; | ||
|
||
|