Skip to content

GetDBInformation cannot decode the transaction markers (info tags 104-107): every accessor raises 'Invalid Request for Output Block Type' #4

Description

@mariuz

Summary

The four transaction-marker database info items — isc_info_oldest_transaction (104), isc_info_oldest_active (105), isc_info_oldest_snapshot (106) and isc_info_next_transaction (107) — cannot be read through IAttachment.GetDBInformation at all: every accessor on the returned item raises EIBClientError: Invalid Request for Output Block Type.

Cause

TDBInformation.DoParseBuffer (client/FBOutputBlock.pas) has no case for tags 104–107, so they fall through to the catch-all AddSpecialItem branch. The clumplet is sized correctly (the overridden AddSpecialItem reads the 2-byte length), but the item is typed dtSpecial — and dtSpecial has no working accessor: getAsInteger, GetAsBytes, etc. all raise ibxeOutputBlockTypeError. The values are therefore unreachable even though the server sent them.

Reproduction

Against Firebird 6.0 (LI-T6.0.0.2076, Linux aarch64, fpc 3.2.2):

Info := Attachment.GetDBInformation([isc_info_oldest_transaction,
  isc_info_oldest_active, isc_info_oldest_snapshot, isc_info_next_transaction]);
Info.GetItem(0).getAsInteger;   // raises 'Invalid Request for Output Block Type'
Info.GetItem(0).GetAsBytes;     // same exception

Found while writing the on-disk-structure companion sample for a Firebird architecture paper (https://github.com/mariuz/conceptual-architecture-for-firebird-paper, samples/fpc/ods_header.pas) — it wanted to show the TIP markers three ways (MON$DATABASE, GetDBInformation, raw page 0) and the middle way turned out to be impossible.

Fix

Add the four tags to the AddIntegerItem case — as variable-length integers (dtInteger), not dtIntegerFixed, since these markers are 4 bytes today but may be 8 bytes with 48-bit transaction ids, and dtInteger decodes with the clumplet-declared length. PR follows: with the fix, getAsInteger returns e.g. OIT=921, OAT=922, OST=922, Next=922 where every call raised before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions