Repository navigation
DM-56864: Replace Dataflow for staging chunks with BigQuery load jobs (PPDB) - #981
Merged
Merged
Conversation
JeremyMcCormick
force-pushed
the
tickets/DM-56864
branch
from
November 3, 2026 21:07
ff88e69 to
61cba43
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
JeremyMcCormick
force-pushed
the
tickets/DM-56864
branch
from
November 3, 2026 21:47
61cba43 to
17ab44f
Compare
Each chunk is loaded into its own landing tables before it is copied into staging. Its tables expire after bigquery_landing_table_expiration_days (1 by default). The stage chunk function can now write to the landing and staging datasets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
Removes the function, its service account, IAM and Cloud SQL user, the track-chunk topic, push and dead-letter subscriptions, and the variables. Only the Dataflow staging job published to the topic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
The stage chunk function stages chunks with BigQuery load jobs. Removes the Dataflow service account and its IAM, the function's Dataflow permissions and environment variables, and their variables. The load_sso Dataflow resources are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
JeremyMcCormick
force-pushed
the
tickets/DM-56864
branch
from
November 3, 2026 22:36
17ab44f to
06d8780
Compare
New variables trigger_stage_chunk_bigquery_job_timeout_seconds (240 by default) and trigger_stage_chunk_bigquery_check_timeout_seconds (60 by default), passed to the function as BIGQUERY_JOB_TIMEOUT_SECONDS and BIGQUERY_CHECK_TIMEOUT_SECONDS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
Renames the bucket that replica chunks are uploaded to, matching ppdb-<env>-sso-ingest. GCS buckets can't be renamed, so Terraform creates the new bucket and deletes ppdb-<env>-ingest, which must be empty first. The bucket's IAM bindings and variables move with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
Renames the file, resources and variables, the function, its service account cloudrun-stage-chunk and its Pub/Sub subscription stage-chunk. GCP can't rename these, so the apply replaces them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
…ngest bucket Replace project-wide storage.admin with storage.objectViewer on the chunk ingest bucket, and drop the unneeded topic subscriber role (the function is invoked by a push subscription). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
JeremyMcCormick
force-pushed
the
tickets/DM-56864
branch
from
November 4, 2026 03:13
3e42f9e to
e765614
Compare
New variable stage_chunk_bigquery_retry_timeout_seconds (300 by default), passed to the function as BIGQUERY_RETRY_TIMEOUT_SECONDS. The job timeout's description no longer mentions the Pub/Sub deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
Replace the shared pubsub_max_delivery_attempts with stage_chunk_pubsub_max_delivery_attempts (100, so a chunk can wait out a BigQuery quota for about 16 hours before dead-lettering) and load_sso_pubsub_max_delivery_attempts (15, unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
The Cloud Run service and scheduler retry settings for promote chunks are no longer used by any resource since it became a Cloud Run job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7
Contributor
Author
|
@fajpunk This is tested and working in dev now (staging and promotion). Some resources like deprecated storage buckets may need to be cleaned-up/deleted manually. |
fajpunk
approved these changes
Nov 5, 2026
fajpunk
left a comment
Contributor
There was a problem hiding this comment.
I applied this manually. As you said, I had to destroy a vestigial bucket manually, and we had to do some manual stuff in the database to dissociate database objects from service accounts we are getting rid of.
Contributor
Author
|
@fajpunk I am going to merge this as I need to work on getting the changes deployed to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PPDB infrastructure for staging replica chunks with BigQuery load jobs instead of a Dataflow job. The stage chunk function now loads each chunk into temporary landing tables and copies them into the staging tables itself (lsst/dax_ppdb#69, lsst-dm/ppdb-cloud-functions#38). The Dataflow staging resources and the track chunk function are removed, and the function and the ingest bucket are renamed.
Changes
All changes are in
environment/deployments/ppdb/.services/bigquery.tf)ppdb_landingdataset for the per-chunk landing tables, in the same location (US) as stagingbigquery_landing_table_expiration_days(default 1)services/stage-chunk.tf, renamed fromtrigger-stage-chunk.tf)trigger-stage-chunktostage-chunk, along with its service account (cloudrun-stage-chunk), Cloud SQL user, push subscription and variables (trigger_stage_chunk_*→stage_chunk_*)dataEditoron the landing and staging datasets (staging wasdataViewer)storage.objectVieweron the chunk ingest bucket (was project-widestorage.admin), and its unneeded topic subscriber role is removedBIGQUERY_CHECK_TIMEOUT_SECONDS,BIGQUERY_JOB_TIMEOUT_SECONDSandBIGQUERY_RETRY_TIMEOUT_SECONDS, fromstage_chunk_bigquery_check_timeout_seconds(60),stage_chunk_bigquery_job_timeout_seconds(240) andstage_chunk_bigquery_retry_timeout_seconds(300)min_instance_count = 1) to avoid cold startsstage_chunk_pubsub_max_delivery_attempts), about 16 hours of retries, so a chunk can wait out a BigQuery quotaservices/dataflow-stage-chunk.tf): the Dataflow service account and its IAM, and the template path and temp location variables. Theload_ssoDataflow resources are unchanged.pubsub_max_delivery_attemptsis replaced bystage_chunk_pubsub_max_delivery_attempts(100) andload_sso_pubsub_max_delivery_attempts(15, unchanged)services/track-chunk.tf): the function, its service account and Cloud SQL user, thetrack-chunk-topicandtrack-chunk-dlttopics, its subscriptions and variablesservices/gcs.tf):ppdb-<env>-ingestis replaced byppdb-<env>-chunk-ingest, with its IAM bindings and variables moved overSQL/iam-sa-permissions.sqlupdated for the renamed and removed service accountsBefore applying
ppdb-replicationuploads. The apply deploys placeholder code forstage-chunk, which drops messages until the real function is deployed from ppdb-cloud-functions.ppdb-<env>-ingestfirst. GCS can't rename buckets, so the apply deletes it, and it must be empty.cloudrun-track-chunksandcloudrun-trigger-stage-chunkPostgres users, so their Cloud SQL users can be dropped.trigger-stage-chunksubscription drain. It is replaced, and messages still in it are lost.After applying
cloudrun-stage-chunkitschunk_trackingpermissions (SQL/iam-sa-permissions.sql).bucket_name: ppdb-<env>-chunk-ingesttogs://ppdb-<env>-config.stage-chunkfrom ppdb-cloud-functions, then resume the uploads.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_01VJ51nAbGJ4BBgwpjau1VX7