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

Invalid BLOB ID when working with monitoring tables [CORE2632] #3040

Closed
firebird-automations opened this issue Sep 16, 2009 · 8 comments
Closed

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @hvlad

Is related to QA245

If first query with monitoring tables in transaction not returned blob fields to the client (i.e. blob fields was not present in SELECT list) than subsequent queries in the same transaction which referenced blob fields will fail with "Invalid BLOB ID" error.

The reason is :
- first query in transaction involving any monitoring table triggers creation of monitoring snapshot for this transaction
- when snapshot is created some temporary blobs is created too and bound to the transaction and to the request
- if this blobs not passed to the client its remains bound to the request
- when request finish its execution all temporary blobs bound to it released
- when another request going to open blob it fails

Example

firebird\bin>isql -user SYSDBA -pass masterkey s:\TEST.FDB -ch UNICODE_FSS
Database: s:\TEST.FDB, User: SYSDBA
SQL> select 1 from mon$database;

CONSTANT

============
1

SQL> select mon$sql_text from mon$statements;

 MON$SQL\_TEXT

=================
0:1

MON$SQL_TEXT:
Statement failed, SQLSTATE = 42000
invalid BLOB ID

SQL> commit;
SQL> select mon$sql_text from mon$statements;

 MON$SQL\_TEXT

=================
0:1

MON$SQL_TEXT:
select mon$sql_text from mon$statements

SQL> select mon$sql_text from mon$statements;

 MON$SQL\_TEXT

=================
0:1

MON$SQL_TEXT:
select mon$sql_text from mon$statements

SQL> exit;

Note, i used UNICODE_FSS connection charset. This is needed to avoid involving transliteration filter which is used by the engine if connection charset is different from blob field charset (see also patch for CORE2602)

Commits: f51d9e5 d9d8bf7

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

The solution is to unbind from request temporary blob's created for monitoring tables

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5 RC1 [ 10362 ]

Fix Version: 2.1.4 [ 10361 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Workaround for FB 2.1.3 could be

a) Issue only one query of monitoring tables in transaction, or

b) Run
select mon$sql_text from mon$statements where mon$sql_text is not null

as the first query in transaction (you don't have to read blobs, just obtain its ID's)

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is related to QA245 [ QA245 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

QA test added.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: Done successfully

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