From 3c6a221ee14372573ed65f51cc5e56ec24ce804f Mon Sep 17 00:00:00 2001 From: Dipesh Dhameliya Date: Mon, 8 Jan 2024 11:59:30 +0530 Subject: [PATCH] Provide flexibility to provide different SLA time for parallel query testing and unblock few more tests for parallel query testing (#2188) This commit introduces two changes: 1. It adds flexibility to provide different SLA time for parallel query testing. User can now use flag sla_for_parallel_query_enforced to specify different SLA time to be considered when tests file runs with parallel query enforced. 2. It unblocks few more tests for parallel query testing Task: BABEL-4392 Signed-off-by: Dipesh Dhameliya --- test/JDBC/README.md | 5 +++-- test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix | 1 + .../input/errorHandling/TestSimpleErrors.sql | 1 + .../sys-has_perms_by_name-vu-verify.mix | 1 + test/JDBC/input/sp_columns_100.sql | 1 + test/JDBC/parallel_query_jdbc_schedule | 18 ++---------------- .../main/java/com/sqlsamples/batch_run.java | 10 +++++++++- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/test/JDBC/README.md b/test/JDBC/README.md index 69ef41f32b..546898ef8a 100644 --- a/test/JDBC/README.md +++ b/test/JDBC/README.md @@ -405,11 +405,12 @@ After building the modified PostgreSQL engine and Babelfish extensions using the mvn test ``` 5. If the expected output is different when run in parallel query mode and in normal mode, one can add a different expected output specially for parallel query mode in `expected/parallel_query/` folder. Additionally, one needs to add `-- parallel_query_expected` flag in the corresponding input file. -6. Cleanup all the objects, users, roles and databases created while running the tests: +6. If you want to have different SLA timeout when test runs in parallel query mode then use `-- sla_for_parallel_query_enforced` flag in the corresponding input file. +7. Cleanup all the objects, users, roles and databases created while running the tests: ```bash ./cleanup.sh ``` -7. Please note that when you have completed testing with parallel query mode enabled, you should unset the `isParallelQueryMode` environment variable that was previously set to `true`. This ensures that all tests run in the normal Babelfish mode (without parallel query): +8. Please note that when you have completed testing with parallel query mode enabled, you should unset the `isParallelQueryMode` environment variable that was previously set to `true`. This ensures that all tests run in the normal Babelfish mode (without parallel query): ```bash unset isParallelQueryMode diff --git a/test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix b/test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix index d03354f012..26a3c005a9 100644 --- a/test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix +++ b/test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix @@ -1,4 +1,5 @@ -- sla 10000 +-- sla_for_parallel_query_enforced 15000 -- tsql CREATE DATABASE db1 GO diff --git a/test/JDBC/input/errorHandling/TestSimpleErrors.sql b/test/JDBC/input/errorHandling/TestSimpleErrors.sql index 95832cfe32..8d103d4f0e 100644 --- a/test/JDBC/input/errorHandling/TestSimpleErrors.sql +++ b/test/JDBC/input/errorHandling/TestSimpleErrors.sql @@ -1,3 +1,4 @@ +-- sla_for_parallel_query_enforced 100000 CREATE TABLE simpleErrorTable (a varchar(15) UNIQUE NOT NULL, b nvarchar(25), c int PRIMARY KEY, d char(15) DEFAULT 'Whoops!', e nchar(25), f datetime, g numeric(4,1) CHECK (g >= 103.5)) GO diff --git a/test/JDBC/input/functions/sys-has_perms_by_name-vu-verify.mix b/test/JDBC/input/functions/sys-has_perms_by_name-vu-verify.mix index 46dfb6b743..288b7ac3e3 100644 --- a/test/JDBC/input/functions/sys-has_perms_by_name-vu-verify.mix +++ b/test/JDBC/input/functions/sys-has_perms_by_name-vu-verify.mix @@ -1,3 +1,4 @@ +-- sla_for_parallel_query_enforced 70000 -- tsql -- reset the login password ALTER LOGIN user_perms_by_name WITH PASSWORD='test'; diff --git a/test/JDBC/input/sp_columns_100.sql b/test/JDBC/input/sp_columns_100.sql index 0f222c21d3..a0e9e847e5 100644 --- a/test/JDBC/input/sp_columns_100.sql +++ b/test/JDBC/input/sp_columns_100.sql @@ -1,3 +1,4 @@ +-- sla_for_parallel_query_enforced 55000 -- create tables with most of the datatypes create table var(a char(10), b nchar(9), c nvarchar(8), d varchar(7), e text, f ntext, g varbinary(10), h binary(9), i image, j xml) go diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index 8607bc38ab..fcf3848dcb 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -51,27 +51,13 @@ ignore#!#Test-sp_addrolemember-dep-vu-verify ignore#!#Test-sp_droprolemember-dep-vu-verify ignore#!#babel_table_type -# These test should not ger run in parallel query +# These test should not get ran in parallel query ignore#!#BABEL-1363 # Taking too much time to complete. (TIME-OUT FAILURES) ignore#!#BABEL-SP_TABLE_PRIVILIGES-vu-verify -ignore#!#BABEL-SP_COLUMNS_MANAGED-dep-vu-verify -ignore#!#BABEL-SP_TABLES -ignore#!#ISC-Domains-vu-verify -ignore#!#Test-sp_rename-vu-prepare -ignore#!#Test-sp_rename-vu-verify -ignore#!#Test-sp_rename-vu-cleanup ignore#!#BABEL-3013 -ignore#!#BABEL-SP_COLUMN_PRIVILEGES ignore#!#BABEL-SP_TABLE_PRIVILEGES ignore#!#ISC-Columns-vu-verify -ignore#!#TestSimpleErrors -ignore#!#ISC-Views -ignore#!#TestSimpleErrorsWithXactAbort -ignore#!#BABEL-2513 -ignore#!#TestDatetime-numeric-representation-vu-prepare -ignore#!#TestDatetime-numeric-representation-vu-verify ignore#!#four-part-names-vu-verify -ignore#!#sp_columns_100 -ignore#!#sys-has_perms_by_name-vu-verify +#ignore#!#sys-has_perms_by_name-vu-verify diff --git a/test/JDBC/src/main/java/com/sqlsamples/batch_run.java b/test/JDBC/src/main/java/com/sqlsamples/batch_run.java index 20406176ae..6603495c4d 100644 --- a/test/JDBC/src/main/java/com/sqlsamples/batch_run.java +++ b/test/JDBC/src/main/java/com/sqlsamples/batch_run.java @@ -24,6 +24,7 @@ static void batch_run_sql(Connection con_bbl, BufferedWriter bw, String testFile boolean tsqlDialect = false; boolean psqlDialect = false; boolean customSLA = false; + boolean customSLAWithParallelQueryEnforced = false; if (testFilePath.contains(".mix")) { isCrossDialectFile = true; @@ -273,7 +274,14 @@ static void batch_run_sql(Connection con_bbl, BufferedWriter bw, String testFile } } else { customSLA = strLine.toLowerCase().startsWith("-- sla"); - if (customSLA){ + if (!customSLAWithParallelQueryEnforced && customSLA){ + String[] tokens=strLine.split(" "); + sla = Long.parseLong(tokens[2]); + sla = sla*(1000000L); + continue; + } + customSLAWithParallelQueryEnforced = isParallelQueryMode && strLine.toLowerCase().startsWith("-- sla_for_parallel_query_enforced"); + if (customSLAWithParallelQueryEnforced){ String[] tokens=strLine.split(" "); sla = Long.parseLong(tokens[2]); sla = sla*(1000000L);