Repository navigation
Conversation
Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Adds MySQL 8.4 to the test database harness (testMySQL8) and a CI job. Test databases use the case-sensitive utf8mb4_0900_bin collation. The isolation test now reads the database's default level instead of assuming READ_COMMITTED. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Without an ORDER BY, MySQL returned columns (and function parameters) in its own order. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Storage paths and names are case-sensitive, but MySQL's default collation is not. Log a warning at startup and document the utf8mb4_0900_bin collation. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
MySQL and PostgreSQL now share one harness: Hibernate builds the schema once per JVM into a template and each test clones it. Both containers keep their data in memory with durability off. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Fix harness comments and docs, assign the cached database only after it started, drop duplicate test dependencies, request a different isolation level in the restore test, check the MySQL template has every mapped table, and cover parameter order in the function CRUD test. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The MYSQL_8 CI row runs SdkDeltaCommitsCRUDTest on MySQL, so the class that started its own MySQL container is no longer needed. Its lock-reading test moves into SdkDeltaCommitsCRUDTest and runs on every database. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
A @TempDatabase field gets a fresh TestDatabase, per test for an instance field and per class for a static one. The extension stores it in the JUnit store, which closes it after every @AfterEach, so a test's server always closes before its database is dropped, and a failing setUp still drops it. TestDatabase no longer takes a ServerProperties (it overwrote everything the properties set) and offers hibernateProperties(), hibernateConfigurator() and sessionFactory(). All tests that made their own database now use the annotation. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…eSQL containers Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…lt_on_error The isolation test asks for a level other than the default, because asking for the default would pass even if nothing were restored. The MySQL template keeps halt_on_error off only for the one index InnoDB rejects; a TODO removes it once the schema migration steps build the template. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Adds Flyway 13.10.3, the V1 baseline of the 0.7 schema and V2 (type_json widening) for H2, PostgreSQL and MySQL; empty test databases, @TempDatabase and TestDatabase.dataSource()/kind() in the harness; and a schema snapshot check that the steps build the schema the entities expect. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Adds Migrator, which classifies a database (empty, current, pending, newer than this release, an unversioned 0.7 database, not a Unity Catalog database, failed step) and, under a run lock, sets up an empty database, adopts a 0.7 one (version 1 recorded as the baseline) and applies the pending steps. The run lock is pg_advisory_lock on PostgreSQL, GET_LOCK on MySQL and an in-process lock per database file on H2. bin/uc-migrate runs `migrate` and `info` against the database in etc/conf/hibernate.properties. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…ases with Flyway The server sets up an empty database itself (a second server starting at the same time waits on the run lock) and refuses any other schema version with a message that names the fix. Hibernate never alters the schema: hbm2ddl.auto is forced to none, even if an old hibernate.properties says update. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…ases Adds V3. On MySQL it converts the database and every Unity Catalog table (and casbin_rule, when it exists) to utf8mb4_0900_bin, so a database created with MySQL's case-insensitive default compares names and storage paths like PostgreSQL and H2. Converting is safe to repeat, so the step holds several statements. On PostgreSQL and H2, V3 does nothing. The startup collation warning skips Flyway's history table, which keeps the database's original collation. Test-only steps move to version 1000 and tests read the latest version instead of hard-coding it. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Every test database now gets its schema from Migrator, never from Hibernate DDL: the PostgreSQL and MySQL templates are migrated once, and each H2 test database is migrated when it is created. Hibernate runs with hbm2ddl.auto=none in every test. MySQL clones now also copy the template's rows (Flyway's history), as PostgreSQL's TEMPLATE does, so a clone is at the current version. The MySQL template no longer needs halt_on_error=false or the check that every mapped table exists: Flyway stops on any failed statement. PopulateTestDatabase migrates its database before opening it. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Describe how Flyway manages the schema, how to upgrade without Helm with bin/uc-migrate, the first start on an empty database, the MySQL case-sensitivity change, going back to 0.7, and each error message with what to do. Replace the outdated Hibernate auto-update paragraph in the deployment guide with a link to the guide. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
- The server and bin/uc-migrate print the same refusal for a foreign, newer or failed schema (Migrator.refusal); "Stop the servers and run bin/uc-migrate migrate" is kept for a 0.7 or pending database. - bin/uc-migrate runs from the repository or tarball root, so it reads etc/conf/hibernate.properties from any directory; it exits 1 when it finds neither, and builds a missing classpath file. - The MySQL run lock is per database, not per MySQL server. - Flyway fails on missing step locations; a jar without steps says so. - uc-migrate reuses the server's Hikari settings. - The shaded server jar keeps META-INF/services (merged), so Flyway finds its database support in connector tests. - The Helm chart no longer sets hibernate.hbm2ddl.auto=update. - Tests: release-to-release upgrade, casbin_rule conversion on MySQL, server properties always turn Hibernate schema updates off. - Docs: messages say who prints them; going back to 0.7 needs no restore; waiting applies to PostgreSQL and MySQL. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…6 via 0.7 RealUpgradeTest runs real server images on each UpgradePath and test database: the first image writes a data set through the API with authorization on, later images just start, then the current server refuses the database until Migrator.migrate() upgrades it to the fresh install schema, and the data reads back. The test kit gains AcrossUpgradePaths, UpgradePath (BASE built from UC_TEST_BASE_REF by dev/build-image.sh, LATEST, V0_6_VIA_0_7), OldImage, OldServer and DataSet. The tests are tagged "upgrades": the default test and coverage runs leave them out, and testUpgrades, testUpgradesPostgres18 and testUpgradesMySQL8 run them, also in a new CI job. Real 0.7 databases showed that Hibernate's auto-update names the unique constraints of uc_columns, uc_delta_commits and uc_properties, so the H2 and PostgreSQL baselines now name them the same way, and the baseline check builds its reference schema with "update", as 0.7 installs did. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The classpath file used by bin/start-uc-server and bin/uc-migrate listed both
server/target/classes and the server jar, so Flyway found every migration step
twice ("Found more than one migration with version 1") when running from a
source checkout or the Docker image. The jar holds the same classes.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
etc/db/h2db (the quickstart database) was created before 0.7 and had 10 of the 0.7 schema's 18 tables; older servers added the rest at startup with Hibernate auto-update, which this release turns off, so the server refused it. Upgraded the way a user upgrades: started v0.7.0 on it once (its auto-update added the missing tables), then ran bin/uc-migrate migrate (0.7 baseline, then steps 2 and 3). The sample data is unchanged. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
MigrationOutcome, SchemaState and DatabaseKind become nested types of SchemaMigrator, and RunLock a private nested class. No behaviour change. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Every server start now sets up an empty database, adopts a database without schema history and applies the pending steps, under the run lock; it still refuses a newer, foreign or failed schema. Every start path (bin/start-uc-server, the Docker image, a Helm pod) goes through it, so bin/uc-migrate and UcMigrate are removed. The upgrade guide describes the new procedure: stop the servers, back up the database, start the new release. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…ore it SchemaMigrator.BASELINE_RELEASE (0.7.0) is the one place the baseline release is named; messages use it and comments say "the baseline release". Before adopting a database without schema history, the migrator checks that it has every table the baseline step creates, and otherwise refuses it, naming the missing tables: such a database is from an earlier release, which has to be started on 0.7.0 once first. The upgrade guide says so. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… built image UpgradePath.BASE now runs the base commit's shaded server jar as a child process on the test database, so the upgrade tests build no Docker image (dev/build-image.sh is removed). The jar comes from UC_TEST_BASE_JAR, the local cache ~/.cache/uc-upgrade-base/<sha>.jar, or is built once there from git archive. CI saves the jar of every main commit in the Actions cache and the upgrade job restores the one of the merge commit's first parent; the job runs only when schema-related paths change. Published releases keep their Docker Hub images, now pinned by digest; the moving "latest" path becomes a pinned V0_7. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Move the upgrade tests out of unit-tests.yml into upgrade-tests.yml, which runs only when a change touches the schema, its migration code or the upgrade test kit. A base-jar job builds the server jar of the commit the PR starts from and shares it as an artifact. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The upgrade tests now have two paths, and every old server is a server jar run as a child process (no release images, no Docker container mode): - BASE: the jar of the code this change starts from (UC_TEST_BASE_REF). - RELEASE_CHAIN: one jar per release, oldest first, from the release tags: strict vX.Y.Z, from SchemaMigrator.BASELINE_RELEASE up to, not including, this build's version, latest patch per minor. UC_TEST_RELEASE_CHAIN sets the tags (CI computes them once); unset, the kit computes them from git. Each jar is found by its commit: UC_TEST_JAR_DIR/<sha>.jar, else ~/.cache/uc-upgrade-base/<sha>.jar, else built once from that commit and cached. This replaces UC_TEST_BASE_JAR. The first jar writes the data set; every later jar reads it back, then the current server upgrades the database and reads it back; failures name the server that read it. The data set now has one column (and one function parameter) per column type, with every field set, and is compared as whole objects, ignoring only the fields a server fills in itself. The managed table is Delta, whose columns can't have the types Delta lacks (interval, void, user-defined, table), so it has the other 18; the external table is Parquet and has all 22. Dropped: V0_7, V0_6_VIA_0_7 and the pinned release images. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
A refs job picks the base commit (the merge commit's first parent) and the release chain from the tags; a build-jars matrix builds each one's server jar and uploads it as jar-<sha>; the upgrade tests download them all and find each by its commit through UC_TEST_JAR_DIR. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…iting its own data The upgrade test now takes one path: every release tag from the baseline release up to this build's version, in version order (not only the latest patch of each minor), then the current server. Each release writes its own copy of the data set, named for the release (catalog, user email, sibling storage directories); the current server checks the schema against a fresh install and reads every copy back. The path from the PR's base commit is gone, with its jar in CI: unreleased code never writes a user's database. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… check its whole schema etc/db/h2db was first created by a release before 0.4.1, so its CHECKs on uc_function_params.type_name and uc_functions.data_type still allowed column types 0..20 (VARIANT, 21, came in 0.4.1), and the name columns of uc_catalogs, uc_schemas, uc_tables and uc_volumes were nullable. The schema check on start refused it, so bin/start-uc-server failed on the sample database and with it the Python client tests. The repair widens the two CHECKs to 0..21 under their existing names and makes the four name columns NOT NULL (no row has a NULL name). Data and schema history rows are unchanged. SampleDatabaseIsCurrentTest now also compares the sample database's whole schema with the H2 dump of a fresh install, so drift in it fails a test instead of the server start. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…d sample database Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… database Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
added a commit
to shba24/unitycatalog
that referenced
this pull request
Oct 25, 2026
…database Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…r's pool
The server's pool doesn't autocommit (Hibernate manages transactions), and
the migration took its connections from it. On PostgreSQL the lock-wait SET
then opened a transaction, so a bad-row check's setReadOnly(true) failed
("Cannot change transaction read-only property in the middle of a
transaction") and every check refused the start. A statement run on such a
connection outside Flyway would also never be committed.
connection() now sets autocommit before the SET, as the backup's connections
do; a check still runs in its own read-only transaction. Flyway gets the same
autocommit connections the tests always gave it. The new test runs the checks
and the upgrade on a pool built like the server's.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
…plete copies The MySQL restore dropped the database's tables one by one, then moved the copies back. A restore that failed partway (a lock a client held past the lock-wait cap) left dropped tables, and the next start, seeing a database at the previous release, dropped the only good copy and backed up the gutted database. - The restore moves the database's tables to <db>_uc_trash and the copy's tables back in one RENAME TABLE, which MySQL runs whole or not at all, then drops the trash and the copy. - The copy is complete once it has the table uc_backup_complete, the last statement of the copy. A copy without it (a server killed or disconnected while copying) is replaced at the previous release and refused partway through the steps, instead of being restored over the database. - A complete copy that has tables the database lacks is never dropped: the start refuses and names the copy. PostgreSQL's CREATE DATABASE and H2's .part file plus atomic move are whole or nothing, so their copies need no mark. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The type-change probe compared only the type and size, so a step that restates them and changes something else was recorded without running: a MySQL MODIFY c varchar(64) NOT NULL over a nullable varchar(64), or a PostgreSQL ALTER COLUMN c TYPE varchar(64) COLLATE "C". The probe now recognises a type change only when nothing but NULL or NOT NULL follows the type; any other clause (DEFAULT, COLLATE, CHARACTER SET, USING, ...) gets no probe, so the step runs. A NULL or NOT NULL must match the column's nullability. MySQL's MODIFY and H2's ALTER COLUMN c <type> restate the column: they drop its default, and MySQL's makes it nullable unless it says NOT NULL, so for them the column must also have no default, and on MySQL be nullable when the statement says nothing. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The run checks for SIGTERM before each step and between a data step's batches, but not after the last step. SIGTERM during the last step let the run pass the schema check and drop the backup, so the process exited with the upgraded database and no backup, although the docs promise a restore. The run now checks once more after the steps and the schema check, before it drops the backup, and restores when a stop was requested. The new test sends SIGTERM to a server process during a slow last SQL step (PostgreSQL and MySQL; H2 has no sleep function). Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…tore CREATE DATABASE ... TEMPLATE copies the tables, not the database's own attributes, and the restore renames the copy in place of the dropped database. A restore therefore lost ALTER DATABASE ... SET settings (a search_path that selects UC's schema among them, after which the previous release sees an empty catalog), ALTER ROLE ... IN DATABASE settings, GRANTs on the database, its owner and its connection limit. The backup now creates the copy as <db>_uc_backup_part, gives it those attributes of <db>, then renames it to <db>_uc_backup, so a copy under the backup's name is always complete. A copy restored by hand keeps them too. List settings such as search_path are re-quoted element by element, as pg_dump does. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… in the URL
Connections to the companion database <db>_uc_upgrade take the
server's URL, parameters included. With ?currentSchema=uc there, the
companion has no such schema, so creating or reading the restored mark
failed ("no schema has been selected to create in") and, with
UC_CHART_REVISION set, every start with the backup on refused.
The mark's table is now public.uc_restored on PostgreSQL.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
…set step
The release before this build's was the highest listed release below it. A
patch release without steps of its own then moved it: with 0.7.0=1, 0.8.0=3
and 0.8.1=3, a 0.8.2 build refused a 0.7.0 database and a 0.8.0 upgrade that
stopped midway ("Upgrade to 0.8.1 first"), and no step was this release's, so
the every-start schema check compared no table.
The release before is now the first listed release of the minor line before
this build's: any release of that line, or a later one such as an earlier
patch of this build's own line, upgrades, and this release's steps are those
above that release's last step. This follows the project's policy of testing
upgrades from the latest patch of each minor line. The refusal names the
line: "... upgrades only from 0.7.0 or a later 0.7 release (version 3 or
later). Upgrade to the latest 0.7 release first, ...". upgrades.md and the
releases.properties header say so.
MySQL's step 3 converts the character set of every table, which made every
table one this release changes, so the every-start check refused, for
example, an index a DBA added to uc_catalogs. A statement that changes only a
table's character set or collation (not compared by the schema check) no
longer counts as changing the table.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
… like the start
- PostgreSQL applies lock_timeout to advisory-lock waits too. With the
backup on, the run lock is taken on a companion connection that has
the run's 60-second lock wait, so a second starting server failed
("canceling statement due to lock timeout") instead of waiting, as
upgrades.md says it does. A pooled connection can keep an earlier
run's lock wait as well. The run lock's connection now sets
lock_timeout = 0 before it waits.
- bin/start-uc-server --check-schema ignored server.migration.backup,
so on PostgreSQL it locked <db> while a start with the backup on held
the lock in <db>_uc_upgrade: the two didn't exclude each other. It
now turns the backup on from the same setting, taking the lock where
the start does. upgrades.md says to give every server of a database
the same setting.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
…ty H2 mark file
- --check-schema with the backup on now prints the restored mark's
refusal and exits 1 when a start of this release in this chart
revision would refuse. It exited 0 ("The upgrade would go through")
while every start refused.
- An H2 mark file without its release or revision (a crash while
writing it) is no mark. It threw a bare NullPointerException on every
start.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
Adoption compared every table in the schema with the 0.7.0 schema, so a
database whose schema also holds another application's tables was refused
("differs from the 0.7.0 schema in ways the server can't repair"), which
0.7.0's Hibernate update accepted.
It now compares only Unity Catalog's tables: those of the baseline dump and
of this build's dump (casbin_rule and uc_schema_history stay left out). An
extra or missing column, index or key on one of them is still refused.
Co-authored-by: Isaac <[email protected]>
Signed-off-by: Shubham Bansal <[email protected]>
…e probe The add-column probe also matched ALTER TABLE t ADD UNIQUE (c), ADD PRIMARY KEY, ADD INDEX and the like, taking the keyword for a column name. It then reported the change as absent instead of "can't tell", so a failed step of that form whose change was there was run again: an unnamed unique key was added twice, and a named index failed again on every start. These forms now get no probe: a failed one is refused with the "can't tell" message, a pending one runs. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Conflicts: SchemaMigrator type-change probe keeps the Optional return with the new end-anchored regex and the nullable/restates hasType arguments; StepAlreadyInDatabaseTest keeps both test-step directories. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Conflict: BadRowCheckTest imports. SchemaSnapshot is in the migrate package on this branch, so the kit import goes; the HikariDataSource and HibernateConfigurator imports of the new pool test stay. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Conflict: SchemaMigrator.connection() keeps the autocommit fix and this branch's static lockWaitSql(kind, lockWait). Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… new rule The release before this build's is now the first listed release of the minor line before it. BackupTest's map 0.7.0=1, 0.7.5=6000 then made 0.7.0 (version 1) the release before, so a database at 6000 counted as partway through this release's steps: takesAFreshBackupAtThePreviousRelease reused the older copy and lost the row written after it. The map is now 0.6.0=1, 0.7.0=6000, which keeps version 6000 as the last step of the release before this one, as the tests intend. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Conflicts in SchemaMigrator: the class comment keeps the adoption paragraph and takes the minor-line release rule; checkSchema checks the restored mark, then the release rule, then lists the adoption's drifts; the backed-up run passes the drifts to upgrade() and stops at the end of the upgrade on SIGTERM. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
…way applied A start with the backup on keeps a copy that is already there only when the database is partway through this release's steps. That check used the threshold of the skipped-release rule: the last step of the first release of the minor line before this build's. With releases 0.6.0=1, 0.7.0=3 and 0.7.5=6000, a clean 0.7.5 database at 6000 counted as partway through an 0.8 upgrade. A complete leftover copy (an earlier upgrade whose drop failed) was then reused, and a failed upgrade restored it, losing the rows written after it; an incomplete one made the start refuse. The check now uses the latest release listed before this build's, the one the database was at before the upgrade started. The skipped-release refusal keeps the minor-line threshold. BackupTest covers a database at 0.7.5's last step with an older copy: the upgrade fails and the restore brings back the current rows. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
… mid-upgrade Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
added a commit
to shba24/unitycatalog
that referenced
this pull request
Oct 25, 2026
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
added a commit
to shba24/unitycatalog
that referenced
this pull request
Oct 25, 2026
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Collaborator
Author
|
Closing this draft. Its code is kept as a reference on |
shba24
added a commit
to shba24/unitycatalog
that referenced
this pull request
Nov 4, 2026
… unverified asides - CODE_REVIEW.md names RealUpgradeTest as the upgrade test, run with UC_TEST_UPGRADES=true. - deployment.md and upgrades.md drop claims about later releases, the hbm2ddl setting the server reads, and the Messages entries for the unsupported-database and connection-failure errors, which the migration no longer prints as such. - Comments: the TODO(unitycatalog#2053) on BASELINE_TABLES becomes a plain sentence; the Flyway connection counts and the Casbin and PostgreSQL rollback asides that were not checked are removed; the isTrue Javadoc says that only NULL throws; the DataSet and RealUpgradeTest class Javadocs are shorter. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
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.
🥞 Stacked PR
Use this link to review incremental changes.
PR Checklist
docsis updatedDescription of changes
A database first created by a release before 0.7.0 is now checked against the 0.7.0 schema when it's adopted: the known differences are repaired, and anything else stops the start before any change.
Before this PR, such a database (upgraded once by a 0.7.0 server) was adopted as it was. Starting releases 0.2.1, 0.3.1, 0.4.0, 0.4.1, 0.5.1 and 0.6.0 on H2, PostgreSQL 18 and MySQL 8.4, then 0.7.0 once, leaves exactly three differences from a fresh 0.7.0 database, the same on every engine:
uc_function_params.type_nameanduc_functions.data_typeallows0..20(0.7.0:0..21), so a function with aTABLE_TYPEparameter or result fails0..21uc_users_external_id_keyis missing (Hibernate'sALTERfailed silently)server/src/main/resources/schema/baseline/<db>.txt(a database built by step 1 alone; [Server] Check schema migration steps on every pull request #2046's dump test keeps it current). Differences other than D1/D3 (and changes a later step already made) stop the start before any change: "The database differs from the 0.7.0 schema in ways the server can't repair (-: the 0.7.0 schema, +: what the database has): …", at most 20 lines.--check-schemalists the repairs it would make and the refusals.docs/server/upgrades.md"Adopting an older database", with the manual fixes for D2 and D3.Testing
AdoptionRepairTeston H2, PostgreSQL 18 and MySQL 8.4, on databases built by step 1 with the drift applied by hand (migrate.*: H2 77 passed, PostgreSQL 79, MySQL 79; skipped tests are for other databases);testUpgradespasses on H2 (a database built by the real 0.7.0 server passes the guard):0..21, the schema equals a fresh install. D3 → adopted, the key is there.From the final review (reproduced first): adoption compares only Unity Catalog's tables, so another application's tables in the same schema don't stop it; extra or missing columns and indexes on UC tables are still refused.
📐 Design notes & details
Why D2 isn't repaired automatically. A function written by 0.3.1 and one written by 0.4.1 in the same database both store 17 for different types, and no column records which server wrote a row. The
+1update is valid only if every listed function predates the database's first 0.4.1+ start; otherwise recreate the functions.Why D3 duplicates aren't fixed automatically. Which user keeps an external id is a security decision.
Why the PostgreSQL/MySQL repair keeps the constraint name. One
ALTERkeeps PostgreSQL's fixed names; on H2 the wide check is added before the narrow one is dropped, so a stop in between is repaired on the next start.Not tested: 0.1.0 (no shaded jar), 0.3.0 and 0.5.0 (expected like 0.3.1 and 0.5.1), MySQL before 8.0.16, non-utf8mb4 MySQL, MariaDB, older PostgreSQL. A real
0.4.0 → 0.7.0 → this buildtest passed by hand but needs a launcher workaround for 0.4.0 (hibernate.connection.user) and a 0.4.0 jar in CI, so it isn't committed.This pull request and its description were written by Isaac.