Skip to content

Commit d802ff0

Browse files
committed
Fix backstop in gin test if injection point is not reached
Per Tom Lane's observation that the test got stuck in infinite loop if the injection_points module was not loaded. It was supposed to give up after 10000 iterations, but the backstop was broken. Discussion: https://www.postgresql.org/message-id/2498595.1710511222%40sss.pgh.pa.us
1 parent 85f65d7 commit d802ff0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/test/modules/gin/expected/gin_incomplete_splits.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ declare
4545
i integer;
4646
begin
4747
-- Insert arrays with 'step' elements each, until an error occurs.
48+
i := 0;
4849
loop
4950
begin
5051
select insert_n(next_i, step) into next_i;
@@ -53,12 +54,12 @@ begin
5354
exit;
5455
end;
5556

56-
-- The caller is expected to set an injection point that eventuall
57+
-- The caller is expected to set an injection point that eventually
5758
-- causes an error. But bail out if still no error after 10000
5859
-- attempts, so that we don't get stuck in an infinite loop.
5960
i := i + 1;
6061
if i = 10000 then
61-
raise 'no error on inserts after ';
62+
raise 'no error on inserts after % iterations', i;
6263
end if;
6364
end loop;
6465

src/test/modules/gin/sql/gin_incomplete_splits.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ declare
4848
i integer;
4949
begin
5050
-- Insert arrays with 'step' elements each, until an error occurs.
51+
i := 0;
5152
loop
5253
begin
5354
select insert_n(next_i, step) into next_i;
@@ -56,12 +57,12 @@ begin
5657
exit;
5758
end;
5859

59-
-- The caller is expected to set an injection point that eventuall
60+
-- The caller is expected to set an injection point that eventually
6061
-- causes an error. But bail out if still no error after 10000
6162
-- attempts, so that we don't get stuck in an infinite loop.
6263
i := i + 1;
6364
if i = 10000 then
64-
raise 'no error on inserts after ';
65+
raise 'no error on inserts after % iterations', i;
6566
end if;
6667
end loop;
6768

0 commit comments

Comments
 (0)