Skip to content

Commit a9c6cad

Browse files
committed
Switched to use sequence for savepoint names.
Removed calls to `dbms_transaction` as they were causing library pin locks on our tests.
1 parent 0089bee commit a9c6cad

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

source/core/types/ut_suite_item.tpb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ create or replace type body ut_suite_item as
5454
begin
5555
if get_rollback_type() = ut_utils.gc_rollback_auto then
5656
l_savepoint := ut_utils.gen_savepoint_name();
57-
dbms_transaction.savepoint(l_savepoint);
57+
execute immediate 'savepoint ' || l_savepoint;
5858
end if;
5959
return l_savepoint;
6060
end;
@@ -65,7 +65,7 @@ create or replace type body ut_suite_item as
6565
pragma exception_init(ex_savepoint_not_exists, -1086);
6666
begin
6767
if get_rollback_type() = ut_utils.gc_rollback_auto and a_savepoint is not null then
68-
dbms_transaction.rollback_savepoint( a_savepoint );
68+
execute immediate 'rollback to ' || a_savepoint;
6969
end if;
7070
exception
7171
when ex_savepoint_not_exists then

source/core/ut_savepoint_seq.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
create sequence ut_savepoint_seq
2+
/*
3+
utPLSQL - Version 3
4+
Copyright 2016 - 2018 utPLSQL Project
5+
Licensed under the Apache License, Version 2.0 (the "License"):
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
start with 1 cache 20;

source/core/ut_utils.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ create or replace package body ut_utils is
5252

5353
function gen_savepoint_name return varchar2 is
5454
begin
55-
return '"'|| utl_raw.cast_to_varchar2(utl_encode.base64_encode(sys_guid()))||'"';
55+
return 's'||trim(to_char(ut_savepoint_seq.nextval,'0000000000000000000000000000'));
5656
end;
5757

5858
procedure debug_log(a_message varchar2) is

source/install.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ alter session set current_schema = &&ut3_owner;
5050
@@install_component.sql 'core/types/ut_reporters_info.tps'
5151
@@install_component.sql 'core/ut_utils.pks'
5252
@@install_component.sql 'core/ut_metadata.pks'
53+
@@install_component.sql 'core/ut_savepoint_seq.sql'
5354
@@install_component.sql 'core/ut_utils.pkb'
5455
@@install_component.sql 'core/ut_metadata.pkb'
5556
@@install_component.sql 'reporters/ut_ansiconsole_helper.pks'

source/uninstall_objects.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ drop package ut_ansiconsole_helper;
179179

180180
drop package ut_utils;
181181

182+
drop sequence ut_savepoint_seq;
183+
182184
drop type ut_documentation_reporter force;
183185

184186
drop type ut_teamcity_reporter force;

test/api/test_ut_run.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,9 @@ Failures:%
808808
procedure drop_test_suite is
809809
pragma autonomous_transaction;
810810
begin
811+
drop_db_link;
811812
execute immediate 'drop package stateful_package';
812813
execute immediate 'drop package test_stateful';
813-
drop_db_link;
814814
end;
815815

816816
procedure run_in_invalid_state is
@@ -1007,9 +1007,9 @@ Failures:%
10071007
procedure drop_suite_with_link is
10081008
pragma autonomous_transaction;
10091009
begin
1010+
drop_db_link;
10101011
execute immediate 'drop table tst';
10111012
execute immediate 'drop package test_distributed_savepoint';
1012-
drop_db_link;
10131013
end;
10141014

10151015
end;

0 commit comments

Comments
 (0)