Subject Re: [firebird-support] BLOB Not Found error
Author Helen Borrie
> 16.03.2018 14:47, shg_sistemas@... [firebird-support] wrote:
>> Since some days ago I'm getting (it seems very occasionally and randomly) a "blob not
>> found" error.
>> As far as I remember the problem happens during read operations: with "locate" commands or
>> inside a "while not eof" loop...

Dmitry S. wrote

> You should use "Repeatable Read" or "Snapshot" transaction isolation mode. In "Read
> Committed" you can get this error if record has been deleted and garbage collected before
> you start reading the BLOB.

Also bear in mind that:

1. If no blob has ever been stored for that field in a record, then
no blob id exists for it. For editing, you should test for NULL at
some appropriate point in your query or your client code and handle it.

2. When you "edit" a blob, the original blob is copied in memory to a
new blob with a temporary blob id. The temporary blob is visible only
to the transaction in which it is created and, within that
transaction, the original blob content is invalidated as garbage by
the Post action from the client application.

3. On commit, the temporary blob is copied to a new location, with a
new blob id, and becomes visible to other transactions from that
point. It will not go to the same physical location as the original
blob, because that location remains "interesting" to the garbage
collector until it is able to be released by a future GC.

4. Be aware that, if you try to edit the same blob field more than
once in the same transaction, the initial view of the original blob is
not there any more. AFAIR, the Firebird engine began enforcing
read-only on changed records from v.2.5 onward, so you would encounter
a different error if your app was trying to post multiple edits of
non-blob fields from the same transaction. I can't say for sure
whether that restriction could apply to blob edits since the new blob
id is not known until the commit has occurred. Also, I don't know
whether your IBDAC components are aware of the restriction on multiple
edits. It is probably something you should ask Devart.

Helen