Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions regression-test/data/workload_manager_p0/test_curd_wlg.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
2

-- !show_1 --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 10% true 2147483647 0 0 0%

-- !mem_limit_1 --
2

-- !mem_limit_2 --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 11% true 2147483647 0 0 0%

-- !mem_overcommit_1 --
Expand All @@ -23,24 +23,24 @@ test_group 10 11% true 2147483647 0 0 0%
2

-- !mem_overcommit_3 --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 11% false 2147483647 0 0 0%

-- !cpu_hard_limit_1 --
2

-- !cpu_hard_limit_2 --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 11% false 2147483647 0 0 20%

-- !queue_1 --
2

-- !show_queue --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 11% false 100 0 0 20%

-- !select_tvf_1 --
normal 20 50% true 2147483647 0 0 0%
normal 20 50% true 2147483647 0 0 1%
test_group 10 11% false 100 0 0 20%

132 changes: 69 additions & 63 deletions regression-test/suites/workload_manager_p0/test_curd_wlg.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ suite("test_crud_wlg") {
sql "alter workload group normal properties ( 'max_concurrency'='2147483647' );"
sql "alter workload group normal properties ( 'max_queue_size'='0' );"
sql "alter workload group normal properties ( 'queue_timeout'='0' );"
sql "alter workload group normal properties ( 'cpu_hard_limit'='1%' );"

sql "set workload_group=normal;"

Expand All @@ -89,10 +90,10 @@ suite("test_crud_wlg") {

qt_cpu_share_2 """ select count(1) from ${table_name} """

try {
test {
sql "alter workload group normal properties ( 'cpu_share'='-2' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("requires a positive integer"));

exception "requires a positive integer"
}

sql "drop workload group if exists test_group;"
Expand All @@ -109,61 +110,65 @@ suite("test_crud_wlg") {
qt_show_1 "select name,cpu_share,memory_limit,enable_memory_overcommit,max_concurrency,max_queue_size,queue_timeout,cpu_hard_limit from workload_groups() order by name;"

// test memory_limit
try {
test {
sql "alter workload group test_group properties ( 'memory_limit'='100%' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("cannot be greater than"));

exception "cannot be greater than"
}

sql "alter workload group test_group properties ( 'memory_limit'='11%' );"
qt_mem_limit_1 """ select count(1) from ${table_name} """
qt_mem_limit_2 "select name,cpu_share,memory_limit,enable_memory_overcommit,max_concurrency,max_queue_size,queue_timeout,cpu_hard_limit from workload_groups() order by name;"

// test enable_memory_overcommit
try {
test {
sql "alter workload group test_group properties ( 'enable_memory_overcommit'='1' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("must be true or false"));

exception "must be true or false"
}

sql "alter workload group test_group properties ( 'enable_memory_overcommit'='true' );"
qt_mem_overcommit_1 """ select count(1) from ${table_name} """
sql "alter workload group test_group properties ( 'enable_memory_overcommit'='false' );"
qt_mem_overcommit_2 """ select count(1) from ${table_name} """
qt_mem_overcommit_3 "select name,cpu_share,memory_limit,enable_memory_overcommit,max_concurrency,max_queue_size,queue_timeout,cpu_hard_limit from workload_groups() order by name;"

// test cpu_hard_limit
try {
test {
sql "alter workload group test_group properties ( 'cpu_hard_limit'='101%' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("can not be greater than 100%"));

exception "can not be greater than 100%"
}

try {
sql "alter workload group test_group properties ( 'cpu_hard_limit'='99%' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("can not be greater than 100%"));
sql "alter workload group test_group properties ( 'cpu_hard_limit'='99%' );"

test {
sql "alter workload group normal properties ( 'cpu_hard_limit'='2%' );"

exception "can not be greater than 100%"
}

sql "alter workload group test_group properties ( 'cpu_hard_limit'='20%' );"
qt_cpu_hard_limit_1 """ select count(1) from ${table_name} """
qt_cpu_hard_limit_2 "select name,cpu_share,memory_limit,enable_memory_overcommit,max_concurrency,max_queue_size,queue_timeout,cpu_hard_limit from workload_groups() order by name;"

// test query queue
try {
test {
sql "alter workload group test_group properties ( 'max_concurrency'='-1' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("requires a positive integer"));

exception "requires a positive integer"
}

try {
test {
sql "alter workload group test_group properties ( 'max_queue_size'='-1' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("requires a positive integer"));

exception "requires a positive integer"
}

try {
test {
sql "alter workload group test_group properties ( 'queue_timeout'='-1' );"
} catch (Exception e) {
assertTrue(e.getMessage().contains("requires a positive integer"));

exception "requires a positive integer"
}

sql "alter workload group test_group properties ( 'max_concurrency'='100' );"
Expand All @@ -172,76 +177,77 @@ suite("test_crud_wlg") {

// test create group failed
// failed for cpu_share
try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='-1', " +
" 'memory_limit'='1%', " +
" 'enable_memory_overcommit'='true' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("requires a positive integer"));

exception "requires a positive integer"
}

// failed for mem_limit
try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='10', " +
" 'memory_limit'='200%', " +
" 'enable_memory_overcommit'='true' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("cannot be greater than"))

exception "cannot be greater than"
}

try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='10', " +
" 'memory_limit'='99%', " +
" 'enable_memory_overcommit'='true' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("cannot be greater than"))

exception "cannot be greater than"
}


// failed for mem_overcommit
try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='10', " +
" 'memory_limit'='3%', " +
" 'enable_memory_overcommit'='1', " +
" 'cpu_hard_limit'='1%' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("must be true or false"));

exception "must be true or false"
}

// failed for cpu_hard_limit
try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='10', " +
" 'memory_limit'='3%', " +
" 'enable_memory_overcommit'='true', " +
" 'cpu_hard_limit'='120%' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("can not be greater than"));

exception "can not be greater than"
}

try {
test {
sql "create workload group if not exists test_group2 " +
"properties ( " +
" 'cpu_share'='10', " +
" 'memory_limit'='3%', " +
" 'enable_memory_overcommit'='true', " +
" 'cpu_hard_limit'='99%' " +
");"
} catch (Exception e) {
assertTrue(e.getMessage().contains("can not be greater than"));

exception "can not be greater than"
}

// test show workload groups
Expand Down Expand Up @@ -272,42 +278,42 @@ suite("test_crud_wlg") {
}

// test query queue limit
sql "ADMIN SET FRONTEND CONFIG ('query_queue_update_interval_ms' = '1000');"
sql "ADMIN SET FRONTEND CONFIG ('query_queue_update_interval_ms' = '500');"
sql "set workload_group=test_group;"
sql "alter workload group test_group properties ( 'max_concurrency'='0' );"
sql "alter workload group test_group properties ( 'max_queue_size'='0' );"
Thread.sleep(3000);
try {
sql "select * from ${table_name};"
} catch (Exception e) {
assertTrue(e.getMessage().contains("query waiting queue is full"));
Thread.sleep(5000);
test {
sql "select /*+SET_VAR(parallel_fragment_exec_instance_num=1)*/ * from ${table_name};"

exception "query waiting queue is full"
}

// test insert into select will go to queue
try {
sql "insert into ${table_name2} select * from ${table_name};"
} catch (Exception e) {
assertTrue(e.getMessage().contains("query waiting queue is full"));
test {
sql "insert into ${table_name2} select /*+SET_VAR(parallel_fragment_exec_instance_num=1)*/ * from ${table_name};"

exception "query waiting queue is full"
}

// test create table as select will go to queue
try {
sql "create table ${table_name3} PROPERTIES('replication_num' = '1') as select * from ${table_name};"
} catch (Exception e) {
assertTrue(e.getMessage().contains("query waiting queue is full"));
test {
sql "create table ${table_name3} PROPERTIES('replication_num' = '1') as select /*+SET_VAR(parallel_fragment_exec_instance_num=1)*/ * from ${table_name};"

exception "query waiting queue is full"
}

sql "alter workload group test_group properties ( 'max_queue_size'='1' );"
sql "alter workload group test_group properties ( 'queue_timeout'='500' );"
Thread.sleep(3000);
try {
sql "select * from ${table_name};"
} catch (Exception e) {
assertTrue(e.getMessage().contains("query wait timeout"));
Thread.sleep(5000);
test {
sql "select /*+SET_VAR(parallel_fragment_exec_instance_num=1)*/ * from ${table_name};"

exception "query wait timeout"
}

sql "alter workload group test_group properties ( 'max_concurrency'='10' );"
Thread.sleep(3000);
Thread.sleep(5000);
sql "select 1;"
sql "set workload_group=normal;"
sql "drop workload group test_group;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,60 +56,60 @@ suite("test_workload_sched_policy") {
sql "alter workload schedule policy full_policy_policy properties('priority'='2', 'enabled'='false');"

// create failed check
try {
test {
sql "create workload schedule policy failed_policy " +
"conditions(abc > 123) actions(cancel_query);"
} catch(Exception e) {
assertTrue(e.getMessage().contains("invalid metric name"))

exception "invalid metric name"
}

try {
test {
sql "create workload schedule policy failed_policy " +
"conditions(query_time > 123) actions(abc);"
} catch(Exception e) {
assertTrue(e.getMessage().contains("invalid action type"))

exception "invalid action type"
}

try {
test {
sql "alter workload schedule policy full_policy_policy properties('priority'='abc');"
} catch (Exception e) {
assertTrue(e.getMessage().contains("invalid priority property value"))

exception "invalid priority property value"
}

try {
test {
sql "alter workload schedule policy full_policy_policy properties('enabled'='abc');"
} catch (Exception e) {
assertTrue(e.getMessage().contains("invalid enabled property value"))

exception "invalid enabled property value"
}

try {
test {
sql "alter workload schedule policy full_policy_policy properties('priority'='10000');"
} catch (Exception e) {
assertTrue(e.getMessage().contains("priority can only between"))

exception "priority can only between"
}

try {
test {
sql "create workload schedule policy conflict_policy " +
"conditions (username = 'root')" +
"actions(cancel_query, move_query_to_group 'normal');"
} catch (Exception e) {
assertTrue(e.getMessage().contains("can not exist in one policy at same time"))

exception "can not exist in one policy at same time"
}

try {
test {
sql "create workload schedule policy conflict_policy " +
"conditions (username = 'root') " +
"actions(cancel_query, cancel_query);"
} catch (Exception e) {
assertTrue(e.getMessage().contains("duplicate action in one policy"))

exception "duplicate action in one policy"
}

try {
test {
sql "create workload schedule policy conflict_policy " +
"conditions (username = 'root') " +
"actions(set_session_variable 'workload_group=normal', set_session_variable 'workload_group=abc');"
} catch (Exception e) {
assertTrue(e.getMessage().contains("duplicate set_session_variable action args one policy"))

exception "duplicate set_session_variable action args one policy"
}

// drop
Expand Down