perf: improve presigned Blob V2 reads (#5247)

## Behavior

Presigned Blob V2 reads retry an idempotent ranged GET once after a
recognized disconnect or timeout before the complete response headers
arrive. This includes an abrupt TLS EOF while receiving the headers. A
retry preserves the physical Range and the still-valid URL. Expiry
triggers resolution on the pinned snapshot. Once the complete headers
arrive, the existing status and body paths handle the response.
Enterprise connections default to a 300-second pool idle timeout and
presigned object-store connections default to 30 seconds. The existing
override applies to both pools.

Loopback TCP tests exercise FIN and RST on a reused connection, both
with zero response bytes and after a partial header. They verify the
send count with retries enabled and disabled, the exact replayed Range
and the payload digest. A truncated body after complete headers returns
an error after one send.

Direct reads over 16 MiB stream bounded physical ranges into their
corresponding slices of the final buffer. The per-read fan-out uses
Lance's `LANCE_IO_THREADS`, capped by the connection's existing
`LANCE_CLIENT_BLOB_REQUEST_CONCURRENCY` limit (8 by default). Each
request retains its permit through body consumption. The 10 MiB routing
threshold continues to apply to the full logical read.

The connection can reuse unexpired presigned locations for verified rows
under the same table, column, snapshot and request credentials. Range
offsets and sizes come from the resolver. The existing batch request
covers the requested rows of a shared Packed or Managed sidecar.
Reopening a verified row uses its prior resolution, and the first open
of each unseen SQL descriptor still authorizes just that row. The public
API and REST response format are unchanged.
This commit is contained in:
Xuanwo
2026-11-28 02:29:31 +08:00
committed by GitHub
parent fdc8041b2a
commit 129028f300
7 changed files with 1323 additions and 260 deletions
+6 -4
View File
@@ -36,7 +36,7 @@ __all__ = [
@dataclass
class TimeoutConfig:
"""Timeout configuration for remote HTTP client.
"""Timeout configuration for the Enterprise HTTP client.
Attributes
----------
@@ -58,9 +58,11 @@ class TimeoutConfig:
set via the environment variable
`LANCE_CLIENT_READ_TIMEOUT`, as an integer number of seconds.
pool_idle_timeout: Optional[timedelta]
The timeout for keeping idle connections in the connection pool. Default
is 300 seconds (5 minutes). This can also be set via the environment variable
`LANCE_CLIENT_CONNECTION_TIMEOUT`, as an integer number of seconds.
How long idle connections stay in the pool. The default is 300 seconds
for Enterprise requests and 30 seconds for presigned object-store requests.
A configured value applies to both pools. The
`LANCE_CLIENT_CONNECTION_TIMEOUT` environment variable accepts a value
in whole seconds.
"""
timeout: Optional[timedelta] = None