Issue Details (XML | Word | Printable)

Key: CORE-3137
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Dmitry Yemanov
Reporter: Pavel Zotov
Votes: 0
Watchers: 0
Operations

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

Partial rollback is possible for a selectable procedure modifying data

Created: 17/Sep/10 12:55 PM   Updated: 23/Feb/11 10:13 AM
Component/s: Engine
Affects Version/s: 2.0.0, 1.5.4, 2.0.1, 2.0.2, 2.0.3, 1.5.5, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1, 2.0.5, 2.1.2, 2.5 Beta 1, 2.5 Beta 2, 2.1.3, 1.5.6, 3.0 Initial, 2.5 RC1, 2.5 RC2, 2.0.6, 2.5 RC3, 2.5.0
Fix Version/s: 2.1.4, 2.5.1, 2.0.7, 3.0 Alpha 1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
Test case:

  create table tab (col int);
  commit;

  insert into tab (col) values (1);
  commit;

  create procedure proc returns (ret int)
  as
  begin
    update tab set col = 2;
    begin
      update tab set col = 3;
      ret = 1;
      suspend;
    end
    when any do
    begin
      ret = 0;
      suspend;
    end
  end
  commit;

  select col from tab; -- returns 1
  commit;

  select ret from proc;
  rollback;

  select col from tab; -- returns 2!!!
  commit;

I.e. only the second update gets undone. Required prerequisite to step on this bug:

  * Selectable stored procedure
  * Multiple updates of the same record inside (so that update-in-place happens)
  * Those multiple updates belong to different savepoint levels (nested begin/end blocks)
  * Suspend is performed from the deepest savepoint level (same or deeper than the last update)
  * Transaction or savepoint rollback is issued afterwards

Perhaps the complete list is very rare in practice. Otherwise I'm clueless why nobody had noticed this issue during the past 10 years, as this bug is inherited from InterBase.

The fix will be committed into all the branches soon.

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.