Skip to content

docs(bigquerystorage): fix stale links, deprecated Duration APIs, and sample bugs - #94

Open
lqiu96 wants to merge 1 commit into
mainfrom
docs/bqs-0f-samples-hygiene
Open

lqiu96 wants to merge 1 commit into
mainfrom
docs/bqs-0f-samples-hygiene

Conversation

@lqiu96

@lqiu96 lqiu96 commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Summary (BQS-0f)

Wave 1 hygiene and bug fixes across 12 java-bigquerystorage sample files under samples/snippets/src/main/java/com/example/bigquerystorage/:

  • Canonical URLs: Replaced broken googleapis.dev deep-links (8 occurrences losing class anchors) and legacy cloud.google.com docs/quotas links with live HTTP 200 docs.cloud.google.com URLs.
  • java.time.Duration migration: Replaced deprecated org.threeten.bp.Duration imports and setInitialRetryDelay/setMaxRetryDelay/setKeepAliveTime/setKeepAliveTimeout calls with java.time.Duration *Duration setters across all 10 write samples.
  • Resource leaks:
    • Wrapped BigQueryWriteClient in try-with-resources in WriteCommittedStream and WritePendingStream.
    • Stored and shut down ScheduledExecutorService in cleanup() across WriteToDefaultStream, WriteToDefaultStreamWithArrow, WriteToDefaultStreamTimestampJson, WriteToDefaultStreamTimestampWithArrow, and ExportOpenTelemetry.
  • Concurrency & API contract fixes:
    • Moved inflightRequestCount.register() before ApiFutures.addCallback(..., MoreExecutors.directExecutor()) across all 7 Phaser-tracked samples to eliminate the deregister-before-register race.
    • Stopped retrying closed ArrowRecordBatch instances inside onFailure in WriteToDefaultStreamWithArrow and WriteToDefaultStreamTimestampWithArrow (StreamWriter.append(ArrowRecordBatch) closes batches upon submission; callers must rebuild a fresh batch from source data).
    • Removed dead response.hasError() branches inside onSuccess in JsonWriterStreamCdc and ParallelWriteCommittedStream.
    • Replaced Integer.parseInt with Long.parseLong for snapshotMillis in StorageSample and StorageArrowSample to prevent 32-bit epoch millisecond overflow.

Verification

  • Compiled all 23 main sample sources (including proto generation) and all 15 integration test sources with JDK 25 javac --release 8 -Xlint:deprecation via Maven (BUILD SUCCESS, 0 errors, 0 Duration deprecation warnings).
  • Verified google-java-format --dry-run --set-exit-if-changed passes with 0 diffs on all 12 modified files.
  • Verified 0 remaining googleapis.dev, threeten.bp, or legacy cloud.google.com/(bigquery|java) references in samples/snippets/, and HTTP 200 on all replacement URLs.

… sample bugs (BQS-0f)

- Replace broken googleapis.dev deep-links and legacy cloud.google.com links across samples with canonical docs.cloud.google.com URLs
- Migrate deprecated org.threeten.bp.Duration calls (setInitialRetryDelay/setMaxRetryDelay/setKeepAliveTime/setKeepAliveTimeout) to java.time.Duration *Duration setters across all 10 write samples
- Close leaked BigQueryWriteClient in WriteCommittedStream and WritePendingStream via try-with-resources
- Store and shut down leaked ScheduledExecutorService in WriteToDefaultStream, WriteToDefaultStreamWithArrow, WriteToDefaultStreamTimestampJson, WriteToDefaultStreamTimestampWithArrow, and ExportOpenTelemetry
- Register inflightRequestCount.register() before ApiFutures.addCallback(...) across all Phaser-tracked samples to eliminate deregister-before-register races
- Stop retrying closed ArrowRecordBatch in onFailure in WriteToDefaultStreamWithArrow and WriteToDefaultStreamTimestampWithArrow
- Remove dead response.hasError() branch inside onSuccess in JsonWriterStreamCdc and ParallelWriteCommittedStream
- Replace Integer.parseInt with Long.parseLong for snapshotMillis in StorageSample and StorageArrowSample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant