Skip to content

Commit

Permalink
[OSS-ONLY] Update JDBC Framework to run under a single connection (#3240
Browse files Browse the repository at this point in the history
)

With this commit we enforce JDBC framework to use and keep re-using only 1 connection through it's entirety. We enable this only for non-upgrade tests for now.
To do so we execute the sp_reset_connection after each test file, using the same connection object. In case of crossdialect files (.mix) we still keep reusing the the same connection unless the user has specified their own --tsql/--psql connections.
While enabling this we encountered a lot of bugs which we fixed and add explicit tests under Test-sp_reset_connection.mix but there are other issues that using one connections bring with it like the drawback of not able to unload pg_hint_plan from the current session and other bugs. To avoid them from failing we update these test files as .mix files with their own "--tsql" connection which gets disconnected at the end of the file.

Issues Resolved
BABEL-5255

Signed-off-by: Kushaal Shroff <kushaal@amazon.com>
  • Loading branch information
KushaalShroff authored Jan 16, 2025
1 parent 2634a7f commit 5c002ca
Show file tree
Hide file tree
Showing 90 changed files with 401 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ runs:
tar_dir: ${{ matrix.upgrade-path.last_version }}
run: |
cd test/JDBC/
export isUpgradeTestMode=false
export isUpgradeTestMode=true
if [[ ${{ inputs.server_collation_name }} != "default" ]]; then
export serverCollationName=${{ inputs.server_collation_name }}
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/composite-actions/run-verify-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
touch dummy_schedule
echo "all" > dummy_schedule
export scheduleFile=dummy_schedule
export isUpgradeTestMode=false
export isUpgradeTestMode=true
if [[ ${{ inputs.server_collation_name }} != "default" ]]; then
export serverCollationName=${{ inputs.server_collation_name }}
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/composite-actions/setup-base-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ runs:
exit 1
fi
done
export isUpgradeTestMode=false
export isUpgradeTestMode=true
export inputFilesPath=input
for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do
sed -i "s/\b$filename[ ]*\b$/$filename-vu-prepare/g" upgrade/$base_dir/schedule
Expand Down
8 changes: 0 additions & 8 deletions test/JDBC/expected/BABEL-2955-vu-cleanup.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,3 @@ go

drop table babel_2955_vu_prepare_t2
go

SELECT set_config('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false')
go
~~START~~
text
ignore
~~END~~

8 changes: 8 additions & 0 deletions test/JDBC/expected/BABEL-2955-vu-prepare.out
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ insert into babel_2955_vu_prepare_t2 values (1)
GO
~~ROW COUNT: 1~~


SELECT set_config('babelfishpg_tsql.escape_hatch_storage_options', 'ignore', 'false')
go
~~START~~
text
ignore
~~END~~

10 changes: 6 additions & 4 deletions test/JDBC/expected/BABEL-3156.out
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,17 @@ int#!#varchar#!#int#!#nvarchar#!#smallint#!#tinyint#!#tinyint#!#int#!#varchar#!#
~~ERROR (Message: column "not_a_col" of relation "babel_3156" does not exist)~~



exec sp_describe_undeclared_parameters
N'UPDATE BABEL_3156 SET a=@P1 WHERE not_a_col=@P2';
G
DROP TABLE BABEL_3156;
GO
~~START~~
int#!#varchar#!#int#!#nvarchar#!#smallint#!#tinyint#!#tinyint#!#int#!#varchar#!#varchar#!#varchar#!#nvarchar#!#int#!#varchar#!#varchar#!#varchar#!#bit#!#bit#!#bit#!#bit#!#bit#!#varchar#!#int#!#int
~~ERROR (Code: 33557097)~~

~~ERROR (Message: syntax error near 'DROP' at line 4 and character position 0)~~
~~ERROR (Message: column "not_a_col" of relation "babel_3156" does not exist)~~


DROP TABLE BABEL_3156;
GO
DROP TABLE dbo.performancetable;
GO
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3291.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop table if exists babel_3291_t1
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3292.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop table if exists babel_3292_t1
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3293.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop table if exists babel_3293_t1
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3294.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop table if exists babel_3294_t1
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3295.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop table if exists babel_3295_t1
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3512.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql

/*
* Test stored procs WITH hints. All tests examine the query plan AND the
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-3592.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
drop procedure if exists babel_3592_insert_multiline
go

Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/BABEL-4294-vu-verify.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql

-- Test to check if initialisation of Parallel Worker crash when babelfishpg_tsql.enable_pg_hint is set
/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
-- Nulls check
SELECT * FROM babel_index_nulls_order_before_15_5_a_v1
go
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/babel_index_nulls_order-vu-verify.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
-- Nulls check
SELECT * FROM babel_index_nulls_order_a_v1
go
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/linked_servers-vu-verify.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
-- Check if the linked server added is reflected in the system view
SELECT name, product, provider, data_source, provider_string, catalog, is_linked FROM sys.servers WHERE name NOT LIKE 'bbf_server%' AND name NOT LIKE 'server_4229%' ORDER BY name
GO
Expand Down
1 change: 1 addition & 0 deletions test/JDBC/expected/linked_srv_4229-vu-verify.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- tsql
-- Call OPENQUERY() / four-part-object name from a database other than master
USE tempdb
CREATE TABLE t_tempdb_babel_4229 (a int)
Expand Down
Loading

0 comments on commit 5c002ca

Please sign in to comment.