Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent results when working with GLOBAL TEMPORARY TABLE ON COMMIT PRESERVE ROWS [CORE5837] #6098

Closed
firebird-issue-importer opened this issue May 30, 2018 · 7 comments

Comments

@firebird-issue-importer

Submitted by: @hvlad

One attachment could see data of GTT instance of another attachment.
Bugcheck 185 or 186 could happens on rollback if transaction works with some GTT.

GTT here is GLOBAL TEMPORARY TABLE ON COMMIT PRESERVE ROWS.
GLOBAL TEMPORARY TABLE ON COMMIT DELETE ROWS is not affected.

Commits: 4defdea eca3fc6

====== Test Details ======

Test was splitted on two parts (to be sure that no affect can occur from 1st to 2nd when they run)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 30, 2018

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 30, 2018

Commented by: @hvlad

To reproduce one need a database with one GTT and two isql sessions.
The GTT definition is

GLOBAL TEMPORARY TABLE GTT (ID INT) ON COMMIT PRESERVE ROWS

Case 1:
1>
isql inet://s:\Temp\A.30.FDB
select count(*) from gtt;

            COUNT

=====================
0

2>
isql inet://s:\Temp\A.30.FDB
select count(*) from gtt;

            COUNT

=====================
0

1>
insert into gtt values (1);
rollback;

2>
insert into gtt (id) values (2);
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
select count(*) from gtt;

            COUNT

=====================
256

commit;

1>
-- here we see data of session (2)
select count(*) from gtt;

            COUNT

=====================
163

select first 1 * from gtt;

      ID

============
2

insert into gtt values (3);
rollback;
Statement failed, SQLSTATE = 08001
I/O error during "WriteFile" operation for file "S:\TEMP\A.30.FDB"
-Error while trying to write to file
-Неверный дескриптор.
Statement failed, SQLSTATE = XX000
internal Firebird consistency check (can't continue after bugcheck)

Firebird log contains message with bugcheck 185:

Database: S:\\TEMP\\A\.30\.FDB
internal Firebird consistency check \(wrong record version \(185\), file: vio\.cpp line: 3876\)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 30, 2018

Commented by: @hvlad

Case 2:

1>
isql inet://s:\Temp\A.30.FDB
select count(*) from gtt;

            COUNT

=====================
0

2>
isql inet://s:\Temp\A.30.FDB
select count(*) from gtt;

            COUNT

=====================
0

1>
insert into gtt values (1);
insert into gtt values (1);

2>
insert into gtt (id) values (2);

1>
rollback;

2>
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
insert into gtt (id) select id from gtt;
select count(*) from gtt;

            COUNT

=====================
256

commit;

1>
insert into gtt values (1);
insert into gtt values (1);
rollback;

Statement failed, SQLSTATE = 08001
I/O error during "WriteFile" operation for file "S:\TEMP\A.30.FDB"
-Error while trying to write to file
-Неверный дескриптор.
Statement failed, SQLSTATE = XX000
internal Firebird consistency check (can't continue after bugcheck)

Firebird log contains message with bugcheck 186:

Database: S:\\TEMP\\A\.30\.FDB
internal Firebird consistency check \(record disappeared \(186\), file: vio\.cpp line: 3868\)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 7, 2018

Commented by: @hvlad

Fix confirmed by user after week of testing

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 7, 2018

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

Fix Version: 3.0.4 [ 10863 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 11, 2018

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

Test Details: Test was splitted on two parts (to be sure that no affect can occur from 1st to 2nd when they run)

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 11, 2018

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment