Skip to content

Commit

Permalink
Provide flexibility to provide different SLA time for parallel query …
Browse files Browse the repository at this point in the history
…testing and unblock few more tests for parallel query testing (babelfish-for-postgresql#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 <[email protected]>
  • Loading branch information
Deepesh125 authored and ritanwar committed Jan 8, 2024
1 parent 1a5c560 commit 2998170
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 19 deletions.
5 changes: 3 additions & 2 deletions test/JDBC/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/input/BABEL-SP_COLUMN_PRIVILEGES.mix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- sla 10000
-- sla_for_parallel_query_enforced 15000
-- tsql
CREATE DATABASE db1
GO
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/input/errorHandling/TestSimpleErrors.sql
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- sla_for_parallel_query_enforced 70000
-- tsql
-- reset the login password
ALTER LOGIN user_perms_by_name WITH PASSWORD='test';
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/input/sp_columns_100.sql
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 2 additions & 16 deletions test/JDBC/parallel_query_jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,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
10 changes: 9 additions & 1 deletion test/JDBC/src/main/java/com/sqlsamples/batch_run.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2998170

Please sign in to comment.