Skip to content

Commit

Permalink
Version based connection reset using queries (babelfish-for-postgresq…
Browse files Browse the repository at this point in the history
…l#3423)

Resetting connection after each test instead of closing for versions > 16.6. Also disabling pg_hint for tests that left it open, as the enabled pg_hint setting leaks into other tests when resetting connections.

We can expect 5-6 mins of improvements for version upgrade tests with base > 16.6 and dump-restore tests. For other version upgrade tests these improvements are around 2-3 mins.

Key changes:

    Implemented connection reset for SQL servers (versions > 16.6) post-test.
    Replaced redundant 'isUpgradeTestMode' config variable with 'allowConnectionReset'.
    Eliminated dependency on GitHub Actions workflows to ensure consistent test behavior across environments.
    Optimized test execution to reduce overall completion time.

Task: BABEL-5630

Signed-off-by: Siddharth Sengar [email protected]
  • Loading branch information
SiddharthBITS authored Feb 17, 2025
1 parent 061730b commit 9e5dd9b
Show file tree
Hide file tree
Showing 33 changed files with 278 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ runs:
tar_dir: ${{ matrix.upgrade-path.last_version }}
run: |
cd test/JDBC/
export isUpgradeTestMode=true
if [[ ${{ inputs.server_collation_name }} != "default" ]]; then
export serverCollationName=${{ inputs.server_collation_name }}
fi
Expand Down
1 change: 0 additions & 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,6 @@ runs:
touch dummy_schedule
echo "all" > dummy_schedule
export scheduleFile=dummy_schedule
export isUpgradeTestMode=true
if [[ ${{ inputs.server_collation_name }} != "default" ]]; then
export serverCollationName=${{ inputs.server_collation_name }}
fi
Expand Down
2 changes: 0 additions & 2 deletions .github/composite-actions/setup-base-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ runs:
export serverCollationName=${{ inputs.server_collation_name }}
fi
if [[ "$migr_mode" == "multi-db" ]];then
export isUpgradeTestMode=true
base_dir=${{ matrix.upgrade-path.path[0] }}
if [[ "$base_dir" == *"latest"* || ${{ inputs.dump_restore }} == 'true' ]]; then
base_dir="latest"
Expand All @@ -210,7 +209,6 @@ runs:
exit 1
fi
done
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: 8 additions & 0 deletions test/JDBC/expected/BABEL-3291.out
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,13 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3291_t1
go
8 changes: 8 additions & 0 deletions test/JDBC/expected/BABEL-3292.out
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3292_schema.t1
go

Expand Down
8 changes: 8 additions & 0 deletions test/JDBC/expected/BABEL-3293.out
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3293_schema.t1
go

Expand Down
8 changes: 8 additions & 0 deletions test/JDBC/expected/BABEL-3294.out
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,13 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3294_t1
go
8 changes: 8 additions & 0 deletions test/JDBC/expected/BABEL-3295.out
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3295_t1
go

Expand Down
14 changes: 14 additions & 0 deletions test/JDBC/expected/BABEL-3512.out
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,20 @@ Babelfish T-SQL Batch Parsing Time: 0.084 ms


-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false)
Result
~~END~~

~~START~~
text
Babelfish T-SQL Batch Parsing Time: 0.117 ms
~~END~~


SET babelfish_showplan_all OFF
GO

Expand Down
6 changes: 6 additions & 0 deletions test/JDBC/expected/BABEL-3513-vu-prepare.out
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@ go

exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off'
go
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,9 @@ go

exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off'
go
14 changes: 14 additions & 0 deletions test/JDBC/expected/BABEL-3592.out
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,20 @@ Babelfish T-SQL Batch Parsing Time: 0.080 ms


-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false)
Result
~~END~~

~~START~~
text
Babelfish T-SQL Batch Parsing Time: 0.121 ms
~~END~~


set babelfish_showplan_all off
go

Expand Down
8 changes: 8 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3291.out
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,13 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3291_t1
go
8 changes: 8 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3292.out
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3292_schema.t1
go

Expand Down
8 changes: 8 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3293.out
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3293_schema.t1
go

Expand Down
8 changes: 8 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3294.out
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,13 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3294_t1
go
8 changes: 8 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3295.out
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
off
~~END~~


drop table babel_3295_t1
go

Expand Down
14 changes: 14 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3512.out
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,20 @@ Babelfish T-SQL Batch Parsing Time: 0.071 ms


-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false)
Result
~~END~~

~~START~~
text
Babelfish T-SQL Batch Parsing Time: 0.193 ms
~~END~~


SET babelfish_showplan_all OFF
GO

Expand Down
6 changes: 6 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ go

exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off'
go
14 changes: 14 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-3592.out
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,20 @@ Babelfish T-SQL Batch Parsing Time: 0.078 ms


-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go
~~START~~
text
Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false)
Result
~~END~~

~~START~~
text
Babelfish T-SQL Batch Parsing Time: 0.193 ms
~~END~~


set babelfish_showplan_all off
go

Expand Down
5 changes: 4 additions & 1 deletion test/JDBC/input/pg_hint_plan/BABEL-3291.mix
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ set babelfish_showplan_all off
go

-- cleanup
drop table babel_3291_t1
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

drop table babel_3291_t1
go
3 changes: 3 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3292.mix
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

drop table babel_3292_schema.t1
go

Expand Down
5 changes: 4 additions & 1 deletion test/JDBC/input/pg_hint_plan/BABEL-3293.mix
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

drop table babel_3293_schema.t1
go

Expand All @@ -261,4 +264,4 @@ drop table babel_3293_t3
go

drop schema babel_3293_schema
go
go
3 changes: 3 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3294.mix
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,8 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

drop table babel_3294_t1
go
3 changes: 3 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3295.mix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ set babelfish_showplan_all off
go

-- cleanup
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

drop table babel_3295_t1
go

Expand Down
3 changes: 3 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3512.mix
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ EXEC babel_3512_comment_test_2
GO

-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

SET babelfish_showplan_all OFF
GO

Expand Down
6 changes: 6 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ go

exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off'
go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ go

exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server'
go

exec sp_babelfish_configure 'enable_pg_hint', 'off'
go
3 changes: 3 additions & 0 deletions test/JDBC/input/pg_hint_plan/BABEL-3592.mix
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ EXEC babel_3592_proc_mixed_statements
GO

-- clean up
select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false);
go

set babelfish_showplan_all off
go

Expand Down
Loading

0 comments on commit 9e5dd9b

Please sign in to comment.