Skip to content

Support higher maximum blob segment size (#1197)#1264

Open
fdcastel wants to merge 1 commit into
FirebirdSQL:masterfrom
fdcastel:fix-issue-1197
Open

Support higher maximum blob segment size (#1197)#1264
fdcastel wants to merge 1 commit into
FirebirdSQL:masterfrom
fdcastel:fix-issue-1197

Conversation

@fdcastel

Copy link
Copy Markdown
Member

Fixes #1197.

Summary

This PR implements support for blob segment sizes up to 65535 bytes (64 KiB − 1), as supported by Firebird since version 2.1 (and fully reliable in Firebird 3.0+).

Changes

New BlobSegmentSize connection string property

  • BlobSegmentSize is a new connection string key (synonym: blobsegmentsize) that controls the segment size used when reading/writing blobs.
  • Valid range: 512–65535 bytes. Default: 8192 bytes (same as the old PacketSize default).
  • Exposed via FbConnectionStringBuilder.BlobSegmentSize and FbConnection.BlobSegmentSize.

PacketSize deprecation

  • FbConnectionStringBuilder.PacketSize and FbConnection.PacketSize are marked [Obsolete] with a message pointing to BlobSegmentSize.
  • PacketSize still works—it continues to control socket buffer sizing—but it is no longer used as the blob segment size.

Raised wire protocol limits

  • GdsBlob.GetSegment (all 4 variants): cap changed from short.MaxValue - 12 (32755) to ushort.MaxValue (65535).
  • XdrReaderWriter.WriteBlobBuffer: guard changed from short.MaxValue to ushort.MaxValue.
  • IFbClient.isc_get_segment / isc_put_segment: parameter types changed from short / ref short to ushort / ref ushort, matching the Firebird C API's actual unsigned short types. FesBlob updated accordingly.

Stack plumbing

BlobSegmentSize flows through the full stack:

ConnectionString.BlobSegmentSize
  → GdsConnection.BlobSegmentSize / FesDatabase(blobSegmentSize)
  → DatabaseBase.BlobSegmentSize
  → BlobBase._segmentSize  (was db.PacketSize, now db.BlobSegmentSize)

Tests

  • ConnectionStringTests: 7 new tests (default, parsing, synonym, validation boundaries).
  • FbConnectionStringBuilderTests: 3 new tests (default, setter, getter).
  • FbBlobTests: 2 new integration tests exercising blob read/write with BlobSegmentSize = 65535.
- Add new 'BlobSegmentSize' connection string property (range 512-65535 bytes)
  replacing the blob-specific role of PacketSize
- Deprecate PacketSize on FbConnectionStringBuilder and FbConnection
  (use BlobSegmentSize instead)
- Raise wire protocol blob segment limit from 32767 to 65535 bytes in
  GdsBlob, XdrReaderWriter (WriteBlobBuffer) and the native IFbClient
  interface (isc_get_segment / isc_put_segment now take unsigned shorts)
- Plumb BlobSegmentSize through the full stack:
  ConnectionString -> GdsConnection / FesDatabase -> DatabaseBase ->
  BlobBase._segmentSize
- Add tests for: connection string parsing/synonyms/validation,
  FbConnectionStringBuilder getter/setter, and blob read/write with
  BlobSegmentSize=65535

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

Labels

None yet

1 participant