Issue Details (XML | Word | Printable)

Key: CORE-4382
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dimitry Sibiryakov
Reporter: Dimitry Sibiryakov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

User savepoints are not released on commit

Created: 04/Apr/14 12:59 PM   Updated: 23/Sep/15 11:21 AM
Component/s: Engine
Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.1.5 Update 1, 2.5.2 Update 1, 3.0 Alpha 1, 3.0 Alpha 2, 2.1.6, 2.5.3, 3.0 Beta 1, 2.1.7, 2.5.3 Update 1
Fix Version/s: 2.5.4, 3.0 Beta 2

File Attachments: 1. File tra.diff (0.8 kB)


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


 Description  « Hide
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

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov made changes - 04/Apr/14 01:01 PM
Field Original Value New Value
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
Dmitry Yemanov made changes - 07/Feb/15 07:12 PM
Affects Version/s 2.5.3 Update 1 [ 10650 ]
Affects Version/s 2.1.7 [ 10651 ]
Affects Version/s 3.0 Beta 1 [ 10332 ]
Affects Version/s 2.5.3 [ 10461 ]
Affects Version/s 2.1.6 [ 10460 ]
Affects Version/s 3.0 Alpha 1 [ 10331 ]
Affects Version/s 2.5.2 Update 1 [ 10521 ]
Affects Version/s 2.1.5 Update 1 [ 10522 ]
Affects Version/s 2.5.2 [ 10450 ]
Affects Version/s 2.5.0 [ 10221 ]
Dmitry Yemanov made changes - 11/Feb/15 12:42 PM
Assignee Dmitry Yemanov [ dimitr ]
Dmitry Yemanov made changes - 19/Feb/15 09:46 AM
Summary Savepoints are not released on commit User savepoints are not released on commit
Dmitry Yemanov made changes - 19/Feb/15 02:40 PM
Status Open [ 1 ] Resolved [ 5 ]
Assignee Dmitry Yemanov [ dimitr ] Dimitry Sibiryakov [ aafemt ]
Fix Version/s 2.5.4 [ 10585 ]
Fix Version/s 3.0 Beta 2 [ 10586 ]
Resolution Fixed [ 1 ]
Pavel Zotov made changes - 27/May/15 06:46 PM
Status Resolved [ 5 ] Resolved [ 5 ]
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
QA Status Done successfully
Pavel Cisar made changes - 23/Sep/15 11:21 AM
Status Resolved [ 5 ] Closed [ 6 ]