Issue Details (XML | Word | Printable)

Key: CORE-4713
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 2
Operations

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

"BLOB not found" error at rollback after insert into table with expression index

Created: 18/Mar/15 04:29 PM   Updated: 25/Sep/15 01:19 PM
Component/s: None
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

Issue Links:
Relate
 

QA Status: Done successfully
Test Details:
2.5.3 (WI-V2.5.3.26780): no error.
2.5.2 (WI-V2.5.2.26540):
   Statement failed, SQLSTATE = HY000
   BLOB not found
   . . .
   Statement failed, SQLSTATE = 08003
   invalid transaction handle (expecting explicit transaction start)
2.5.1 (WI-V2.5.1.26351):
   the same as 2.5.2 + crash ("08006 / -Error reading data from the connection")


 Description  « Hide
create table T1 (
     ID integer not null,
     N1 blob sub_type text,
);
create index T_IDX on T1 computed by (cast(substring(N1 from 1 for 100) as varchar(100)));
commit;

insert into T1 (ID, N1) values (1, 'www');
rollback;

Result:
Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements.
BLOB not found.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 18/Mar/15 04:43 PM
The issue is that garbage collection first removes blobs and then index entries - obviously, index expression can't find just removed blob.

The issue present at least since expression indices was implemented but it was almost not visible to end user as error was hidded
inside the engine. Only v2.5 re-raised it and only at rollback. Both v2.1 and v3 still hides it. Only possibility to see bug effect is to look
at index statistics (by gstat) and see not cleared index entries.

Note, index entries not removed during any kind of garbage collection
- rollback
- regular garbage collection of obsolete record versions
- update in place

The solution is to change order of GC operations - first remove index entries and then remove blobs.