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

User savepoints are not released on commit [CORE4382] #4704

Closed
firebird-automations opened this issue Apr 4, 2014 · 7 comments
Closed

User savepoints are not released on commit [CORE4382] #4704

firebird-automations opened this issue Apr 4, 2014 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @aafemt

Assigned to: @aafemt

Attachments:
tra.diff

Following script leaves in index several orphan nodes.

create database "g_test";
create table g_test (f integer);
create index g_ind on g_test (f);
insert into g_test values (1);
commit;
update g_test set f=2;
savepoint a;
update g_test set f=3;
savepoint b;
update g_test set f=4;
savepoint c;
update g_test set f=5;
savepoint d;
update g_test set f=6;
savepoint e;
update g_test set f=7;
commit;
select * from g_test;

Proposed patch is attached

Commits: 6abc6ae 90c04f7 FirebirdSQL/fbt-repository@7e8c45c FirebirdSQL/fbt-repository@074a99b

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

Confirmed result of "gstat -i"
1) for 3.0 Alpha1 & Alpha2:
Root page: 203, depth: 1, leaf buckets: 1, nodes: 6 // i.e. 6 orphans instead of expected 1

2) for 2.5.3:
Depth: 1, leaf buckets: 1, nodes: 6 // i.e. 6 orphans instead of expected 1

@firebird-automations
Copy link
Collaborator Author

Modified by: @aafemt

Attachment: tra.diff [ 12481 ]

description: Following script leaves in index several orphan nodes.

create database "g_test";
create table g_test (f integer);
create index g_ind on g_test (f);
insert into g_test values (1);
commit;
update g_test set f=2;
savepoint a;
update g_test set f=3;
savepoint b;
update g_test set f=4;
savepoint c;
update g_test set f=5;
savepoint d;
update g_test set f=6;
savepoint e;
update g_test set f=7;
commit;
select * from g_test;

Proposed patch:

Index: tra.cpp

--- tra.cpp (revision 59342)
+++ tra.cpp (working copy)
@@ -381,7 +381,15 @@
// Flush pages if transaction logically modified data

if \(transaction\-\>tra\_flags & TRA\_write\)

+ {
+ // Get rid of all savepoints except transaction one
+ // to let all intermediate garbage after update_in_place in indices and BLOBs to be cleaned up
+ while (transaction->tra_save_point && !(transaction->tra_save_point->sav_flags & SAV_trans_level))
+ {
+ VIO_verb_cleanup(tdbb, transaction);
+ }
transaction_flush(tdbb, FLUSH_TRAN, transaction->tra_number);
+ }
else if ((transaction->tra_flags & (TRA_prepare2 | TRA_reconnected)) ||
(sysTran->tra_flags & TRA_write))
{

=>

Following script leaves in index several orphan nodes.

create database "g_test";
create table g_test (f integer);
create index g_ind on g_test (f);
insert into g_test values (1);
commit;
update g_test set f=2;
savepoint a;
update g_test set f=3;
savepoint b;
update g_test set f=4;
savepoint c;
update g_test set f=5;
savepoint d;
update g_test set f=6;
savepoint e;
update g_test set f=7;
commit;
select * from g_test;

Proposed patch is attached

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Version: 2.5.3 Update 1 [ 10650 ]

Version: 2.1.7 [ 10651 ]

Version: 3.0 Beta 1 [ 10332 ]

Version: 2.5.3 [ 10461 ]

Version: 2.1.6 [ 10460 ]

Version: 3.0 Alpha 1 [ 10331 ]

Version: 2.5.2 Update 1 [ 10521 ]

Version: 2.1.5 Update 1 [ 10522 ]

Version: 2.5.2 [ 10450 ]

Version: 2.5.0 [ 10221 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

summary: Savepoints are not released on commit => User savepoints are not released on commit

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ] => Dimitry Sibiryakov [ aafemt ]

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.4 [ 10585 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Done successfully

Test Details: Confirmed result of "gstat -i"
1) for 3.0 Alpha1 & Alpha2:
Root page: 203, depth: 1, leaf buckets: 1, nodes: 6 // i.e. 6 orphans instead of expected 1

2) for 2.5.3:
Depth: 1, leaf buckets: 1, nodes: 6 // i.e. 6 orphans instead of expected 1

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

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