Skip to content
OCTAVIIUS DOCSCore & Studio 0.2.83
Integrations / 0.2.83

HTTP cursors, backpressure and recovery

Bounded queues, acknowledged sequences, expiration, structured errors and uncertain outcomes.

Stream lifecycle

A cursor connects SQL production to network consumption. Bounded queues propagate consumer backpressure to the producer. Sequenced protocols can replay the last retained packet; requesting the next implicitly acknowledges the previous one. Fetch recovery retains the same sequence, whereas submitting query again creates a new execution with its own effects.

Default limits and server configuration

Environment variableDefaultAccepted range
OCTAVIIUS_API_MAX_BATCH_ROWS655361..1048576
OCTAVIIUS_API_BATCH_BYTES10485761024..16777216, <= MAX_BATCH_BYTES
OCTAVIIUS_API_MAX_BATCH_BYTES83886081024..67108864
OCTAVIIUS_API_MAX_ROW_BYTES167772161024..67108864
OCTAVIIUS_API_CURSOR_TTL300 seconds1..86400
OCTAVIIUS_API_MAX_CURSORS641..1024
OCTAVIIUS_API_MAX_USER_CURSORS81..128

Variables are read at Core startup. Read effective capabilities instead of assuming defaults. batch_rows defaults to 500; 8192 and 32768 are possible within limits. batch_bytes targets serialized row data, not the complete HTTP envelope or total process memory. Incoming HTTP bodies remain limited to 2 MiB.

Bounded memory, large cells and snapshots

Producer queues are bounded: slow clients eventually apply backpressure. A simple scan can return before reading the entire table; sorting, joins and aggregation may require earlier work and temporary files. Streaming transport does not mean every SQL operator avoids materialization.

A row larger than the packet target can be sent alone below the absolute serialized-row limit. Larger rows fail explicitly with ROW_TOO_LARGE; they are not silently truncated. A SELECT pins snapshot roots while producing results; concurrent writes do not change that result. Two SELECTs in a script do not share a transaction-level snapshot.

Bounded replay and uncertain results

With protocols 3/4, repeat the same sequence only when a fetch response was lost. Only one packet is replayable; legacy protocol 2 offers no such recovery. Do not increment on pending. Close cursors even after their final packet to release quota.

A lost initial query response cannot be durably recovered through query_id. Do not blindly resend SQL, especially writes, scripts or procedures. Cancellation does not roll back published writes. Detected disconnects stop production; silently disappeared clients are handled through idle expiry.

Application error handling

SituationTypical code / SQLSTATEAction
AuthenticationHTTP 401 / 42501Check secret, expiry and revocation.
Permissions / OriginACCESS_DENIED / 42501Check all objects, then Host/Origin/proxy.
SyntaxSQL_ERROR / 42000Fix SQL; no automatic retry.
Missing / existing objectOBJECT_NOT_FOUND / 42S02; OBJECT_EXISTS / 42S01Check catalog/schema/object; protocol 4 refines classification.
CancelledQUERY_CANCELLED / HY008Report cancellation and close cursor.
TimeoutQUERY_TIMEOUT / HYT00Writes may have an uncertain outcome.
Expired cursorCURSOR_EXPIRED / HY010, HTTP 410Close local state; explicitly decide on a new read.
Invalid sequenceINVALID_SEQUENCE / HY092 or HY010Do not skip batches.
SaturationRESOURCE_LIMIT / HY001, HTTP 429Release resources and reduce concurrency.
Not implementedUNSUPPORTED_FEATURE / HYC00Change approach; do not simulate a transaction.
InternalINTERNAL_ERROR / HY000Keep identifiers and contact operations.