Skip to content
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

Handle JDBC tests failure when parallel query is enforced. #2196

Merged
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
4 changes: 2 additions & 2 deletions test/JDBC/expected/parallel_query/BABEL-328-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Engineering
Administration
Sales
Sales
Marketing
Finance
Marketing
skumawat2025 marked this conversation as resolved.
Show resolved Hide resolved
~~END~~


Expand All @@ -41,8 +41,8 @@ Engineering
Administration
Sales
Sales
Marketing
Finance
Marketing
~~END~~


Expand Down
14 changes: 7 additions & 7 deletions test/JDBC/expected/parallel_query/TestSQLQueries.out
Original file line number Diff line number Diff line change
Expand Up @@ -622,17 +622,17 @@ int#!#int#!#text#!#int
SELECT * FROM temp1 LEFT OUTER JOIN temp2 ON temp1.i=temp2.k;
skumawat2025 marked this conversation as resolved.
Show resolved Hide resolved
~~START~~
int#!#int#!#text#!#int#!#int
1#!#4#!#one#!#<NULL>#!#<NULL>
2#!#3#!#two#!#2#!#2
3#!#2#!#three#!#<NULL>#!#<NULL>
4#!#1#!#four#!#2#!#4
5#!#0#!#five#!#<NULL>#!#<NULL>
6#!#6#!#six#!#<NULL>#!#<NULL>
7#!#7#!#seven#!#<NULL>#!#<NULL>
8#!#8#!#eight#!#<NULL>#!#<NULL>
0#!#<NULL>#!#zero#!#<NULL>#!#0
<NULL>#!#<NULL>#!#<NULL>#!#<NULL>#!#<NULL>
<NULL>#!#0#!#zero#!#<NULL>#!#<NULL>
<NULL>#!#<NULL>#!#<NULL>#!#<NULL>#!#<NULL>
8#!#8#!#eight#!#<NULL>#!#<NULL>
6#!#6#!#six#!#<NULL>#!#<NULL>
7#!#7#!#seven#!#<NULL>#!#<NULL>
5#!#0#!#five#!#<NULL>#!#<NULL>
1#!#4#!#one#!#<NULL>#!#<NULL>
3#!#2#!#three#!#<NULL>#!#<NULL>
~~END~~


Expand Down
56 changes: 14 additions & 42 deletions test/JDBC/expected/parallel_query/pgr_select_distinct.out
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ int#!#varchar#!#int
--
-- Check mentioning same column more than once
--
select set_config('babelfishpg_tsql.explain_verbose', 'on', false);
GO
~~START~~
text
on
~~END~~


select set_config('babelfishpg_tsql.explain_costs', 'off', false);
GO
~~START~~
Expand All @@ -142,20 +134,14 @@ GO
text
Query Text: SELECT count(*) FROM (SELECT DISTINCT two, four, two FROM tenk1) ss
Aggregate
Output: count(*)
-> Unique
Output: tenk1.two, tenk1.four, tenk1.two
-> Sort
Output: tenk1.two, tenk1.four, tenk1.two
Sort Key: tenk1.two, tenk1.four
-> Gather
Output: tenk1.two, tenk1.four, tenk1.two
Workers Planned: 4
-> HashAggregate
Output: tenk1.two, tenk1.four, tenk1.two
Group Key: tenk1.two, tenk1.four, tenk1.two
-> Parallel Seq Scan on master_dbo.tenk1
Output: tenk1.two, tenk1.four, tenk1.two
Group Key: tenk1.two, tenk1.four
-> Parallel Seq Scan on tenk1
~~END~~


Expand All @@ -167,20 +153,14 @@ text
Query Text: SELECT count(*) FROM
(SELECT DISTINCT two, four, two FROM tenk1) ss
Aggregate
Output: count(*)
-> Unique
Output: tenk1.two, tenk1.four, tenk1.two
-> Sort
Output: tenk1.two, tenk1.four, tenk1.two
Sort Key: tenk1.two, tenk1.four
-> Gather
Output: tenk1.two, tenk1.four, tenk1.two
Workers Planned: 4
-> HashAggregate
Output: tenk1.two, tenk1.four, tenk1.two
Group Key: tenk1.two, tenk1.four, tenk1.two
-> Parallel Seq Scan on master_dbo.tenk1
Output: tenk1.two, tenk1.four, tenk1.two
Group Key: tenk1.two, tenk1.four
-> Parallel Seq Scan on tenk1
~~END~~


Expand Down Expand Up @@ -230,17 +210,12 @@ GO
text
Query Text: SELECT DISTINCT g%1000 FROM generate_series(0,9999) g
Gather
Output: ((g % 1000))
Workers Planned: 1
Single Copy: true
-> Unique
Output: ((g % 1000))
-> Sort
Output: ((g % 1000))
Sort Key: ((g.g % 1000))
-> Function Scan on pg_catalog.generate_series g
Output: (g % 1000)
Function Call: generate_series(0, 9999)
Sort Key: ((g % 1000))
-> Function Scan on generate_series g
~~END~~


Expand Down Expand Up @@ -294,15 +269,11 @@ GO
text
Query Text: SELECT DISTINCT g%1000 FROM generate_series(0,9999) g
Gather
Output: ((g % 1000))
Workers Planned: 1
Single Copy: true
-> HashAggregate
Output: ((g % 1000))
Group Key: (g.g % 1000)
-> Function Scan on pg_catalog.generate_series g
Output: (g % 1000)
Function Call: generate_series(0, 9999)
Group Key: (g % 1000)
-> Function Scan on generate_series g
~~END~~


Expand Down Expand Up @@ -488,11 +459,12 @@ GO
~~START~~
text
Unique
-> Sort
Sort Key: (distinct_func(1))
-> Gather
Workers Planned: 4
-> Parallel Seq Scan on tenk1
-> Gather Merge
Workers Planned: 4
-> Unique
-> Sort
Sort Key: (distinct_func(1))
-> Parallel Seq Scan on tenk1
~~END~~


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
32 changes: 11 additions & 21 deletions test/JDBC/parallel_query_jdbc_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@
# These tests are crashing/failing with parallel query mode is on.

# These tests are hanging in 16.1 with parallel query mode on
# JIRA - BABEL-4668
ignore#!#545_1

# JIRA - BABEL-4669
ignore#!#BABEL-3092

# JIRA - BABEL-4670
ignore#!#BABEL-SEQUENCE

# JIRA - BABEL-4671
ignore#!#TestSPPrepare

# Hangs with unknown cause
ignore#!#sp_who-vu-prepare
ignore#!#sp_who-vu-verify
ignore#!#sp_who-vu-cleanup

# Test failures in BABEL_4_X_DEV
ignore#!#BABEL-328-vu-verify
ignore#!#pgr_select_distinct
ignore#!#TestSQLQueries

# Group 1: BABEL-4481
ignore#!#Test-sp_addrolemember-vu-prepare
ignore#!#Test-sp_addrolemember-vu-verify
Expand All @@ -46,27 +50,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
Loading