Skip to content

BigQuery: Align metastore default read timeout with the SDK - #18420

Open
fivetran-rahulprakash wants to merge 4 commits into
apache:mainfrom
fivetran-rahulprakash:fix/bigquery-metastore-timeout
Open

fivetran-rahulprakash wants to merge 4 commits into
apache:mainfrom
fivetran-rahulprakash:fix/bigquery-metastore-timeout

Conversation

@fivetran-rahulprakash

@fivetran-rahulprakash fivetran-rahulprakash commented Oct 8, 2026 •

Copy link
Copy Markdown

BigQueryMetastoreClientImpl now honors the HTTP timeout values in BigQueryOptions. For standard catalog initialization this aligns the HTTP read timeout with the SDK default, changing it from 20 seconds to 60 seconds; the connect timeout remains 20 seconds. Direct callers can supply custom connect/read timeouts. Negative values retain HTTP-client defaults, and zero means no timeout. Credential initialization, trusted transport, retry policy, and Iceberg error conversion remain unchanged. The standard catalog exposes no timeout properties, so configuring these values through catalog properties is deferred to a follow-up. This does not change uncertain-commit recovery.

Test plan: verify configured timeouts on table and dataset requests, SDK defaults versus explicitly unset transport values, independent connect/read overrides, zero forwarding, authentication preservation, and HTTP 409 conversion. Expected defaults are derived from the SDK and unconfigured HTTP requests. The focused tests and complete BigQuery module suite pass, as do Checkstyle and Spotless.


AI Disclosure

  • Model: GPT-6 Astra (gpt-6-astra)
  • Platform/Tool: GitHub Copilot
  • Human Oversight: [unknown - human to fill in]
  • Prompt Summary: Investigate BQMS timeout propagation and address reviewer feedback. The original constructor proposal, this follow-up's SDK-derived test expectations and test/comment cleanup, and the revised PR description were AI-generated.

BigQueryMetastoreClientImpl accepted BigQueryOptions but left outgoing
requests at the HTTP client's 20-second defaults, ignoring any connect
or read timeouts configured in the supplied options.

Add a package-private transport-injection constructor that reads
HttpTransportOptions from the supplied BigQueryOptions and applies
non-negative connect/read timeout values to each outgoing HttpRequest.
Zero is forwarded as "no timeout" per the SDK contract; negative values
leave the HttpRequest defaults intact. The public constructor delegates
to this overload via GoogleNetHttpTransport.newTrustedTransport(),
preserving the existing trusted-transport production behavior.

Plain BigQueryOptions supplies a 60-second read timeout by default, so
honoring it changes BQMS reads from 20 to 60 seconds on that path.

Add TestBigQueryMetastoreClientImpl with deterministic regression
coverage using an in-memory recording HttpTransport: configured
timeouts, SDK defaults vs. explicit-unset options, independent
connect/read overrides, zero-forwarding, authentication preservation,
409-to-AlreadyExistsException conversion, and no cross-client leakage.
assertThatThrownBy must include a .hasMessage* check per Iceberg's
RegexpMultilineCheck. Add hasMessageContaining to the conflict-response
error-conversion test.
@github-actions github-actions Bot added the GCP label Oct 8, 2026
Move the org.apache.iceberg.relocated VisibleForTesting import into the
org.apache.iceberg import group rather than between com.google.cloud
and java imports; spotted by spotlessJavaCheck on CI.
@fivetran-rahulprakash

Copy link
Copy Markdown
Author

Hi @nastra @uros-b
Could you please review the PR? Thanks!

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request-initializer copy is correct for anyone who constructs BigQueryMetastoreClientImpl with BigQueryOptions (>= 0 applied, 0 = no timeout, auth and 409 conversion kept). Through the shipped catalog it is not configurable: BigQueryMetastoreCatalog.initialize uses metastoreOptions(), which never calls setTransportOptions, and the client-injecting initialize(...) is package-private. Catalog users only see the read timeout move from HttpRequest's 20 s to the SDK's 60 s (BigQueryOptions.getDefaultHttpTransportOptions()); connect stays 20 s; there is no way back. A hung list(..., listAllTables=false) load now waits 3× as long; a timed-out commit still goes through checkCommitStatus.

I'd retitle this as aligning with the SDK default read timeout and call out 20 s → 60 s in the body. Catalog properties (gcp.bigquery.http.connect-timeout-ms / read-timeout-ms) can be a follow-up.

Nits if you're already in the test file: take 60 s from getDefaultHttpTransportOptions().getReadTimeout() and 20 s from a plain HttpRequest instead of hardcoding; drop noCrossClientTimeoutLeakage (nothing is static); CapturingTransport keeps the last request, not the first; the "the fix must" comments describe the PR.

Keep timeout coverage aligned with SDK defaults and remove redundant cross-client coverage.

Generated-by: GitHub Copilot
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@fivetran-rahulprakash fivetran-rahulprakash changed the title BigQuery: Honor HTTP connect and read timeouts in metastore requests BigQuery: Align metastore default read timeout with the SDK Oct 28, 2026

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants