-
Notifications
You must be signed in to change notification settings - Fork 131
TRT-2741: Expand variant keys and decouple daily summaries from variant_combination_id #3722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mstaeble
wants to merge
2
commits into
openshift:main
Choose a base branch
from
mstaeble:worktree-expand-variant-keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| MIGRATIONS_DIR="pkg/db/migrations" | ||
| MANIFEST="${MIGRATIONS_DIR}/MANIFEST" | ||
|
|
||
| if [ ! -f "$MANIFEST" ]; then | ||
| echo "ERROR: ${MANIFEST} not found." | ||
| exit 1 | ||
| fi | ||
|
|
||
| errors=0 | ||
|
|
||
| # Check each manifest entry has matching .up.sql and .down.sql files. | ||
| prev_num=0 | ||
| while IFS= read -r entry; do | ||
| [ -z "$entry" ] && continue | ||
| [[ "$entry" == \#* ]] && continue | ||
|
|
||
| num=$(echo "$entry" | grep -oE '^[0-9]+' | sed 's/^0*//') | ||
| if [ -z "$num" ]; then | ||
| echo "ERROR: Invalid manifest entry '${entry}' (must start with a zero-padded number)." | ||
| errors=$((errors + 1)) | ||
| continue | ||
| fi | ||
|
|
||
| # Check sequential numbering. | ||
| expected=$((prev_num + 1)) | ||
| if [ "$num" -ne "$expected" ]; then | ||
| echo "ERROR: Expected migration $(printf '%06d' "$expected") but found $(printf '%06d' "$num") (gap or duplicate)." | ||
| errors=$((errors + 1)) | ||
| fi | ||
| prev_num=$num | ||
|
|
||
| if [ ! -f "${MIGRATIONS_DIR}/${entry}.up.sql" ]; then | ||
| echo "ERROR: Manifest lists '${entry}' but ${MIGRATIONS_DIR}/${entry}.up.sql does not exist." | ||
| errors=$((errors + 1)) | ||
| fi | ||
| if [ ! -f "${MIGRATIONS_DIR}/${entry}.down.sql" ]; then | ||
| echo "ERROR: Manifest lists '${entry}' but ${MIGRATIONS_DIR}/${entry}.down.sql does not exist." | ||
| errors=$((errors + 1)) | ||
| fi | ||
| done < "$MANIFEST" | ||
|
|
||
| # Check no extra SQL files exist beyond what the manifest lists. | ||
| expected_sql=$((prev_num * 2)) | ||
| actual_sql=$(find "$MIGRATIONS_DIR" -maxdepth 1 -name '*.sql' | wc -l | tr -d ' ') | ||
| if [ "$actual_sql" -ne "$expected_sql" ]; then | ||
| echo "ERROR: Expected ${expected_sql} .sql files (${prev_num} up + ${prev_num} down) but found ${actual_sql}." | ||
| errors=$((errors + 1)) | ||
| fi | ||
|
|
||
| if [ "$errors" -gt 0 ]; then | ||
| echo "FAILED: ${errors} migration verification error(s)." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Migrations OK: ${prev_num} migrations verified." |
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
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
2 changes: 2 additions & 0 deletions
2
pkg/db/migrations/000004_drop_daily_summary_variant_combination.down.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| TRUNCATE test_daily_summaries; | ||
| ALTER TABLE test_daily_summaries ADD COLUMN IF NOT EXISTS variant_combination_id BIGINT; | ||
5 changes: 5 additions & 0 deletions
5
pkg/db/migrations/000004_drop_daily_summary_variant_combination.up.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| DROP MATERIALIZED VIEW IF EXISTS prow_test_report_7d_collapsed_matview; | ||
| DROP MATERIALIZED VIEW IF EXISTS prow_test_report_2d_collapsed_matview; | ||
| DROP MATERIALIZED VIEW IF EXISTS prow_test_report_7d_matview; | ||
| DROP MATERIALIZED VIEW IF EXISTS prow_test_report_2d_matview; | ||
| ALTER TABLE test_daily_summaries DROP COLUMN IF EXISTS variant_combination_id; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Migration manifest. Each line is a migration prefix (NNNNNN_name) that | ||
| # must have matching .up.sql and .down.sql files in this directory. | ||
| # Versions must be sequential with no gaps or duplicates. | ||
| # | ||
| # When adding a new migration, append it here. This file forces a git | ||
| # merge conflict if two PRs independently add the same version number. | ||
| # | ||
| # Run `make verify-migrations` to validate. | ||
|
|
||
| 000001_create_partitioned_tables | ||
| 000002_create_test_daily_summaries | ||
| 000003_create_variant_combinations | ||
| 000004_drop_daily_summary_variant_combination |
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.