danhuawang commented on PR #13673:
URL: https://github.com/apache/gravitino/pull/13673#issuecomment-6819589225

   @dennismdejong Hi — please merge these two PRs into one. Right now they ship 
the same migrate logic twice under different values (schemaMigration vs 
entity.initializeSchema).
   
   What we’d like to see (same idea for bundled and external DB):
   
   One script + one Job — Put all SQL logic in a single chart script (e.g. via 
ConfigMap). One migrate Job runs it for both in-chart MySQL/PostgreSQL and 
external JDBC; templates only wire env/secrets and pick the DB endpoint 
(helpers + entity.jdbcUrl).
   
   Migrate Job is a normal Job, not a Helm hook — A hook that waits on a 
bundled DB can deadlock on first install (your design doc already explains 
this). Use a Job name that includes the release revision. On upgrade, add a 
pre-upgrade hook that scales Gravitino to 0 before any DDL.
   
   Stop running DDL in Pod inits — Keep staging scripts/version if you need 
them, but change init-mysql / init-postgresql to wait only until the DB is 
ready for the new image (see point 4). That fixes races when several replicas 
start at once (#11099).
   
   How to track schema version
   
   Target version: from the Gravitino image (jar → version.txt), same as today.
   Current version: a small DB table (e.g. gravitino_schema_migration, one row 
with schema_version), updated by the migrate script.
   New empty DB: run schema-*.sql only, then write the target version.
   DB with data but no row: use a values knob like baselineVersion, or infer 
from existing tables; if still unknown, fail with clear instructions — don’t 
pick a random upgrade script.
   Upgrade: run upgrade-A-to-B scripts in order until you reach the image 
version; don’t re-apply the full schema-*.sql on a non-empty DB.
   CI: add a kind test that does install → helm upgrade and checks the migrate 
Job, schema version (if you add the table), and Ready pods — not only helm 
unittest / single install.
   
   Pull the good pieces from each PR: JDBC gating + design doc (#13673), opt-in 
defaults / Secret / PG docs (#13674), into one values section and one Job.
   
   Thanks — happy to re-review the combined diff.
   
   


-- 
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]

Reply via email to