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_5980_test.py

47 lines
1.6 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-26 21:10:46 +01:00
"""
ID: issue-6232
ISSUE: 6232
TITLE: Firebird crashes due to concurrent operations with expression indices
DESCRIPTION:
Scenario for reproducing was given by Vlad, letter 25-02-2020 19:15.
Unfortuinately, this crash can occur only in developer build rather than release one.
Although issues from ticket can NOT be reproduced, it was encountered in 2.5.0.26074
that statements from here lead DB to be corrupted:
Error while commiting transaction:
- SQLCODE: -902
- database file appears corrupt...
- wrong page type
- page 0 is of wrong type (expected 6, found 1)
-902
335544335
No such problem in 2.5.1 and above.
Decided to add this test just for check that DB will not be corrupted.
TICKET ISSUE REMAINS IRREPRODUCIBLE (checked on following SuperServer builds: 2.5.1, 2.5.6, 2.5.9, 3.0.6, 4.0.0).
JIRA: CORE-5980
FBTEST: bugs.core_5980
2022-01-26 21:10:46 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
with act.db.connect() as con1, act.db.connect() as con2:
2021-12-10 19:50:31 +01:00
con1.execute_immediate('recreate table t1(id int)')
con1.execute_immediate('create index t1_idx on t1 computed by (id + 0)')
con1.commit()
c = con1.cursor()
c.execute('insert into t1(id) values(?)', [1])
con1.commit()
# this lead to corruption of database in 2.5.0
# page 0 is of wrong type (expected 6, found 1)
con2.execute_immediate('alter index t1_idx active')
con2.commit()