TRT-2848: Drop unused idx_test_daily_totals_date index - #3880
Conversation
idx_test_daily_totals_date exists only to make an unscoped MAX(date) fast across ~3,700 partitions. TRT-2848 (PR openshift#3852) removes the last two callers of that query pattern, so once it merges the index is pure write overhead. Do not deploy this migration before then, or the currently-fast MaxSummaryDate/MaxDailySummaryDate calls on main will regress to a full partition scan. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@mstaeble: This pull request references TRT-2848 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. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ 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 |
|
Scheduling required tests: |
The "don't deploy before TRT-2848 lands" warning is stale now that openshift#3852 is merged and this PR is rebased on top of it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql (1)
7-7: 🩺 Stability & Availability | 🔵 TrivialSchedule both directions of this migration around blocking DDL.
The forward migration uses
DROP INDEX, which takes anACCESS EXCLUSIVElock. The rollback uses normalCREATE INDEX, which blocks table updates while the index builds. Because the migration runner is transactional, concurrent index operations cannot be added without separate runner support.
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql#L7-L7: run the drop during a suitable maintenance window.pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql#L1-L2: plan rollback for the same write-impact constraint.Based on learnings, ordinary migrations run transactionally, so concurrent index DDL requires separate runner support.
🤖 Prompt for 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. In `@pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql` at line 7, Schedule both directions of migration 000012 around a maintenance window: the up migration’s DROP INDEX requires an ACCESS EXCLUSIVE lock, and the down migration’s CREATE INDEX blocks table updates. Do not use concurrent index DDL unless the migration runner is changed to support non-transactional execution; apply the same write-impact constraint to both pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql lines 7-7 and pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql lines 1-2.Sources: Learnings, Linters/SAST tools
🤖 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.
Nitpick comments:
In `@pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql`:
- Line 7: Schedule both directions of migration 000012 around a maintenance
window: the up migration’s DROP INDEX requires an ACCESS EXCLUSIVE lock, and the
down migration’s CREATE INDEX blocks table updates. Do not use concurrent index
DDL unless the migration runner is changed to support non-transactional
execution; apply the same write-impact constraint to both
pkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sql lines 7-7 and
pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sql lines 1-2.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 72b64d21-5a59-42b6-b6e1-52985baca8ef
📒 Files selected for processing (3)
pkg/db/migrations/000012_drop_test_daily_totals_date_index.down.sqlpkg/db/migrations/000012_drop_test_daily_totals_date_index.up.sqlpkg/db/migrations/MANIFEST
|
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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mstaeble, smg247 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
idx_test_daily_totals_date, a single-column btree index ontest_daily_totals(date)that existed only to make an unscopedSELECT MAX(date) FROM test_daily_totalsfast across ~3,700 partitions.dailysummary.MaxSummaryDateandcumulativesummary.MaxDailySummaryDate), which is why this PR was held until that one merged. With those gone, the index is pure write overhead on every insert intotest_daily_totals, with no remaining reader.dateontest_daily_totals/test_cumulative_summarieswithout areleasepredicate, so nothing else depends on this index.Test plan
make lint/go build ./pkg/db/..../hack/verify-migrations.shpassesidx_test_daily_totals_dateis dropped onupand exactly recreated ondown(verified via\d test_daily_totals)btree (date)) matches what this migration expects to drop/recreate🤖 Generated with Claude Code
Summary by CodeRabbit