Repository navigation
fix(migration): move the table aliases search-settings backfill to an unreleased 2.0.3 slot - #33413
Conversation
…to 2.0.3 2.0.2 is already released, and MigrationWorkflow selects versions by exact set membership against SERVER_CHANGE_LOG: a cluster that has already recorded 2.0.2 never re-applies it, so a data migration retro-fitted into that slot never runs and alias search keeps returning nothing on exactly the upgraded instances it was written for (the searchSettings.json seed only reaches fresh installs). 2.0.3 is unrecorded everywhere, so it is picked up exactly once on the next upgrade whichever train the instance is on. v202 keeps its own two search-settings repairs, which shipped with 2.0.2, and is otherwise restored byte-for-byte to its pre-aliases state. Adds the native 2.0.3 SQL directories for both engines (empty, like 2.0.1 -- this is a data migration only) and a MigrationWiringTest for 2.0.3, because a mismatch between the directory name and the Java package silently resolves to the default no-op migration class with no error. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| try { | ||
| addAliasesSearchSettings(); | ||
| } catch (Exception e) { | ||
| LOG.error("v203: failed to backfill the table 'aliases' search settings", e); | ||
| } |
There was a problem hiding this comment.
If reading or writing the search settings fails, this catch logs the error and returns normally. The migration workflow then records 2.0.3 as successfully applied even though the aliases were not persisted. Because this data-only migration has no new SQL statements, later reprocessing skips it, leaving alias search broken on that cluster. The PostgreSQL implementation has the same issue.
| try { | |
| addAliasesSearchSettings(); | |
| } catch (Exception e) { | |
| LOG.error("v203: failed to backfill the table 'aliases' search settings", e); | |
| } | |
| addAliasesSearchSettings(); |
main added a v203 data migration (glossary term relation cardinality backfill) in the same package this branch created for the table aliases search-settings backfill. Keep both: run the glossary backfill first, then the guarded aliases backfill. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| @Override | ||
| @SneakyThrows | ||
| public void runDataMigration() { | ||
| MigrationUtil migrationUtil = new MigrationUtil(handle); |
There was a problem hiding this comment.
migrationUtil is initialized once and never reassigned, but it is declared without final. The PostgreSQL implementation repeats this at line 21. This violates the repository directive requiring unchanged Java locals and parameters to be marked final, so the requirement must be satisfied before merging.
| MigrationUtil migrationUtil = new MigrationUtil(handle); | |
| final MigrationUtil migrationUtil = new MigrationUtil(handle); |
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Comments Outside DiffThese findings sit on lines the diff does not cover, so they could not be posted inline. Each one leaves this list once its file changes.
|
main added two more v203 data migrations (the DataConsumerPolicy CreateTask-Rule repair) alongside the glossary cardinality backfill this branch already merged with. Keep all of them: the policy repairs run first, then the guarded table aliases search-settings backfill.
main added a third v203 data migration (removeServiceEdgesBypassingPipeline) in the same runDataMigration() as the table aliases backfill. Keep both: the service-edge cleanup runs with the other main migrations, then the guarded aliases search-settings backfill.
Code Review ✅ Approved🟡 Medium risk · Relocates an additive aliases-search-settings backfill into the 2.0.3 upgrade migration. Moves the table-aliases search-settings backfill from the already-released 2.0.2 migration slot into the unreleased 2.0.3 slot so it runs on upgraded instances. Restores v202 migrations to their pre-backfill state, wires the backfill into v203 for both MySQL and PostgreSQL dialects, and adds comprehensive wiring tests. No issues found. OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
The
Table.aliasessearch-settings backfill added by #31829 landed in the 2.0.2 migration slot, which is already released.MigrationWorkflowselects versions by exact set membership againstSERVER_CHANGE_LOG, not by a version cutoff — a cluster that has already recorded2.0.2never re-applies it, and reprocessing only runsrunDataMigration()when the version equals the recorded max. So the migration never runs on precisely the upgraded instances it was written for.That matters because
searchSettings.jsonis seed data: the additive merge on startup only adds whole missing asset types, so an already-installed cluster keeps its owntableentry forever and alias search keeps returning nothing even though the index document and the mapping carry the field. Fresh installs are fine; upgrades are not.This moves the backfill into a new, unrecorded 2.0.3 slot, so it is picked up exactly once on the next upgrade whichever train the instance is on.
Type of change:
High-level design:
utils/v202/TableAliasesSearchSettingsMigration→utils/v203/(pure move, logic unchanged).mysql/v203/Migration.javaandpostgres/v203/Migration.javacarrying the call, keeping the log-and-continue wrapper (alias search degrading is not worth failing an upgrade over — matches v201's pattern).mysql/v202/Migration.javaandpostgres/v202/Migration.javaare restored byte-for-byte to their pre-Fixes 31512: Ingest SQL Server synonyms as Table.aliases #31829 state: the alias call, its import, and the@Slf4j/lombok import that Fixes 31512: Ingest SQL Server synonyms as Table.aliases #31829 added only to carry theLOG.errorare all gone. They keep their own two search-settings repairs, which did ship with 2.0.2.bootstrap/sql/migrations/native/2.0.3/{mysql,postgres}/with emptyschemaChanges.sql+postDataMigrationSQLScript.sql— this is a data migration only, same shape as 2.0.1. The directory is whatMigrationWorkflow.getMigrationFilesFromPathenumerates, so without it the Java class is never reached.No behaviour change for a fresh install (the seed already carries
aliases); the only difference is when an upgraded cluster gets the backfill — which is now "at all".Tests:
migration/utils/v203/MigrationWiringTest(new) — pins that the2.0.3directory resolves toorg.openmetadata.service.migration.{mysql,postgres}.v203.Migrationand that both dialects ship the two SQL files.MigrationFilefalls back to a no-op default class when the package does not match the directory name, silently skipping the whole data migration with no error, so this is the failure mode worth pinning. The existingv202wiring test is kept — v202 still has two live repairs.migration/utils/v203/TableAliasesSearchSettingsMigrationTest— moved with the class, unchanged.mvn -pl openmetadata-service -am install -DskipTestsandmvn -pl openmetadata-service spotless:checkboth pass.Unit tests
Backend integration tests
Playwright (UI) tests
Checklist:
🤖 Generated with Claude Code
The PR is not yet safe to merge because a failed aliases backfill can still be recorded as successfully applied, and an explicit Java finality requirement remains unsatisfied.
Findings
Summary
Moves the table-aliases search-settings backfill from the already-released 2.0.2 migration slot into 2.0.3 so upgraded installations can apply it.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Upgrade[Upgraded installation] --> V203[Select unrecorded 2.0.3 migration] V203 --> MySQL[MySQL v203 migration] V203 --> PostgreSQL[PostgreSQL v203 migration] MySQL --> Backfill[Add aliases search settings] PostgreSQL --> Backfill Backfill --> Persist[Persist updated table search configuration]Reviews (6) · Last reviewed commit: "Merge branch 'main' into migration-table..."