laskoviymishka commented on PR #3071: URL: https://github.com/apache/iceberg-rust/pull/3071#issuecomment-6410947509
Agree with @blackmwk on this, and I think we should change direction here: instead of making catalog init recover from a failed `ALTER`, make migration an explicit step. My last round comments were based on the current approach, so please ignore those. I pushed us a bit too far down the retry path. The race only happens when several instances start with `sql.schema-version=V1` against the same V0 db. If migration runs once before they start, there is nothing to race on and init does not need retry logic. I’d reshape this PR as: 1. Revert the init changes: `SchemaVersion::migrate`, the backoff retry, and the probe rewrite unless the CLI needs it. Init stays as on main, including the existing opt-in `ALTER`. We can discuss deprecating that separately later. 2. Add one public function in `iceberg-catalog-sql` that detects the schema version and runs the V0 → V1 `ALTER` only when needed, e.g. `migrate_catalog_schema(uri) -> Result<SchemaVersion>`. On V1 it is a no-op. 3. Add a small CLI around that, in its own crate so the catalog library does not pick up CLI deps. It takes `--uri`, prints the resulting version, and exits non-zero on error. If two runs collide, one can fail and be rerun; for a migration tool that is fine. 4. Add CI with Postgres and MySQL service containers: run the migration once, then run the SQL catalog tests against each via `ICEBERG_SQL_TEST_URI`. That keeps Postgres/MySQL out of unit tests. @manuzhang WDYT about such pivot? If this easier to done in separate PR we can close this one and open a new one. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
