LiJie20190102 opened a new pull request, #14320: URL: https://github.com/apache/gravitino/pull/14320
### What changes were proposed in this pull request? - Guard the unique-key conversions in `upgrade-0.8.0-to-0.9.0-mysql.sql` and `upgrade-0.9.0-to-1.0.0-mysql.sql` (ADD COLUMN, DROP INDEX, ADD UNIQUE KEY, ALTER COLUMN DROP DEFAULT) with `information_schema` checks, so only the exact completed steps are skipped on retry; unexpected schema states still fail instead of being silently accepted. - Guard the ADD COLUMN and CREATE INDEX statements in `upgrade-1.2.0-to-1.3.0-mysql.sql`, and let the `view_meta.audit_info` backfill also cover the empty string left by a non-strict SQL mode, so a retry can finish a partial backfill. - Add `testMySqlUpgradeScriptsRetryable` to `TestSQLScripts`: upgrade step by step from the 0.5.0 schema, re-run every MySQL upgrade script, and compare the resulting columns and indexes with a fresh install of the latest schema. - Document the retry behavior in the upgrade guide. The remaining scripts up to 1.2.0 are unchanged: they only contain `CREATE TABLE IF NOT EXISTS` and `MODIFY COLUMN` statements, which are naturally re-runnable. No stored routines or extra privileges are required; all guards run inside the upgrade session via `PREPARE`/`EXECUTE`. ### Why are the changes needed? The MySQL upgrade scripts are not retryable today: if an upgrade fails halfway, the already-applied statements make the re-run fail, so users cannot recover by simply retrying the script. The 1.3.0-to-2.0.0 scripts were made retryable by #13689; this PR covers the remaining MySQL scripts, following the same approach. Fix: #14312 ### Does this PR introduce _any_ user-facing change? No API or configuration changes. Operators can now re-run the MySQL upgrade scripts (up to upgrade-1.2.0-to-1.3.0) after a partial or completed run without `--force`. ### How was this patch tested? - `./gradlew :core:test --tests org.apache.gravitino.storage.TestSQLScripts -PskipITs` (embedded H2 mode; the new test skips non-MySQL backends) - The MySQL path is exercised by CI with Docker: `./gradlew :core:test --tests org.apache.gravitino.storage.TestSQLScripts -PskipITs -PskipDockerTests=false` - `./gradlew :core:spotlessApply :core:compileTestJava` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
