TRT-2803: Consolidate release loader PG and BQ queries into bulk operations#3766
TRT-2803: Consolidate release loader PG and BQ queries into bulk operations#3766mstaeble wants to merge 1 commit into
Conversation
Replace per-tag sequential processing with a pipelined approach: - Parallel HTTP fetches for stream tags and tag details (10 workers) - Temp table + COPY to bulk-filter new tags and update phase changes - Single BQ query for all job run labels instead of one per tag - COPY + SQL for PR resolution and all DB writes (tags, repositories, job runs, join table) instead of per-tag GORM creates - All tag inserts wrapped in a transaction for atomicity Tested against staging with identical results and ~4.6x speedup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mstaeble The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@coderabbiai review |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
WalkthroughRelease synchronization now uses concurrent tag loading, batched label and pull-request resolution, and pgx-based transactional persistence. Job-run construction is separated from bulk label application, with updated unit and functional tests. ChangesRelease synchronization
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ReleaseLoader
participant ReleaseStreams
participant BigQuery
participant PostgreSQL
ReleaseLoader->>ReleaseStreams: fetch streams and tags concurrently
ReleaseLoader->>PostgreSQL: identify new phase-relevant tags
ReleaseLoader->>BigQuery: fetch labels for built job runs
ReleaseLoader->>PostgreSQL: resolve pull requests and persist associations
Suggested reviewers: 🚥 Pre-merge checks | ✅ 19 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (19 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/dataloader/releaseloader/releasesync.go`:
- Around line 448-462: Update the release-tag insertion flow around the INSERT
into release_tags to prevent duplicate release_tag values from being written
when tmp_release_tags_insert contains repeated tags. Prefer an upsert or input
deduplication keyed by release_tag, while preserving the existing field
population and returning the database error from this operation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 94ede468-597c-4e65-a3fd-1ac097721d49
📒 Files selected for processing (3)
pkg/dataloader/releaseloader/releasesync.gopkg/dataloader/releaseloader/releasesync_functional_test.gopkg/dataloader/releaseloader/releasesync_test.go
|
Scheduling required tests: |
|
@mstaeble: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
@mstaeble: This pull request references TRT-2801 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@mstaeble: This pull request references TRT-2802 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@mstaeble: This pull request references TRT-2803 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Summary
Load()into a staged pipeline: fetch all stream tags, update phase changes and find new tags via temp table, fetch tag details, apply bulk labels, resolve all PRs, and bulk writeCopyToTempTablehelper from Add pgx helpers: PgxSession interface and CopyToTempTable generic #3759sync.WaitGroup.GoGatherLabelsFromBQcall across all new tagsStaging results
Tested against a staging DB clone (23h behind prod).
Single release (4.22, 10 new tags):
Full all-releases catch-up (128 new tags):
Steady-state (no new tags): 508ms (just the temp table filter).
Test plan
make lintpassesmake testpassesmake e2epasses🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Summary by CodeRabbit