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

Creation/altering of trigger with invalid BLR leaves its definition in the metadata cache [CORE4390] #4712

Open
firebird-automations opened this issue Apr 13, 2014 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: prenosil (prenosil)

Is related to CORE3305

In my database there is one table I am UPDATing (works fine),
and another table that has trigger referencing first table.

By mistake I run ALTER TRIGGER which referenced non existing exception,
which raised (as excpected) error:

Statement failed, SQLCODE = -104
invalid request BLR at offset 34
-exception ... not defined

However, since this moment I am not able to update the first table,
attempt to prepare the UPDATE will raise error

Statement failed, SQLCODE = -901
BLOB not found

Note 1 - there are no blobs in either of tables
Note 2 - the problem disappears after closing all connections (i.e. no permanent damage to the database)
Note 3 - tried with latest snapshots (FB2.5, FB3)
Note 4 - I was not able to create simple test script, however I will send database for testing (fresh/empty one)

Commits: 7b9be79 FirebirdSQL/fbt-repository@fab228f

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

I have a feeling that the problematic blob is either RDB$TRIGGER_BLR or even more likely RDB$DEBUG_INFO. That said, surely a BLR parsing exception should not affect existing attachments, so it smells like a bug. I need a test database to validate the issue deeper, please send it to me directly or make it available for download. I will report back once I have it confirmed and debugged.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Now I can confirm the problem. The origin of the issue is that somehow the new trigger definition (the invalid one, referencing non-existent exception) gets loaded into the metadata cache. When it's implicitly referenced by UPDATE, it gets compiled but fails when trying to read its debug info (blob was lost after rollback / backout so its blob id is no longer valid). The blob error is easy to fix but the issue persists, now the same error "exception ... not defined" is raised for UPDATE -- because the trigger is still invalid. The only solution is to disconnect (just current session for CS/SC or everybody for SS) and reconnect back.

I will post an update once the underlying caching issue is found and fixed.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is related to CORE3305 [ CORE3305 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Component: Engine [ 10000 ]

summary: "BLOB not found" error caused by "exception not defined" exception => Creation/altering of trigger with invalid BLR leaves its definition in the metadata cache

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

As both tickets (CORE3305 and CORE4390) reference the same issue consisting of two independent bugs, I'm renaming CORE3305 to describe the "invalid BLOB ID" bug while CORE4390 will describe the metadata cache bug.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Version: 3.0 Alpha 1 [ 10331 ]

Version: 2.1.5 Update 1 [ 10522 ]

Version: 2.5.2 [ 10450 ]

Version: 2.1.5 [ 10420 ]

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