6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_3549_test.py

70 lines
1.8 KiB
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-3905
ISSUE: 3905
TITLE: Database corruption after end of session : page xxx is of wrong type expected 4 found 7
DESCRIPTION:
JIRA: CORE-3549
FBTEST: bugs.core_3549
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
# Calculation depends on page_size=4096 !!!
db = db_factory(page_size=4096)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
-- NOTE: could NOT reproduce on official 2.5.1 (WI-V2.5.1.26351, issued 03-oct-2011).
-- Fix for this ticket in 2.5.1 was before official 2.5.1 release: 17-jul-2011, rev. 53327
set list on;
select rdb$page_type pg_type, count(distinct rdb$page_sequence) pg_seq_distinct
from rdb$pages
where rdb$relation_id = 0 and rdb$page_type=3 -- page_type = '3' --> TIP
group by 1;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
commit;
set autoddl off;
create global temporary table gtt_test(x int) on commit preserve rows;
create index gtt_test_x on gtt_test(x);
commit;
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
set term ^;
execute block as
declare variable i integer = 0;
begin
while (i < 16384) do -- start page_size * 4 transactions
begin
in autonomous transaction do
execute statement 'insert into gtt_test values (1)';
i = i + 1;
end
2022-01-22 21:59:15 +01:00
end
2021-04-26 20:07:00 +02:00
^
set term ;^
2022-01-22 21:59:15 +01:00
2021-04-26 20:07:00 +02:00
select rdb$page_type pg_type, count(distinct rdb$page_sequence) pg_seq_distinct
from rdb$pages
where rdb$relation_id = 0 and rdb$page_type=3
group by 1;
commit;
connect '$(DSN)' user 'SYSDBA' password 'masterkey';
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
PG_TYPE 3
PG_SEQ_DISTINCT 1
PG_TYPE 3
PG_SEQ_DISTINCT 2
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00