laskoviymishka opened a new pull request, #2617: URL: https://github.com/apache/iceberg-go/pull/2617
`sql.NewCatalog` and `hive.NewCatalog` now take `ctx context.Context` first, matching `rest.NewCatalog`, `hadoop.NewCatalog` and `dynamodb.NewCatalog`. The SQL catalog runs its table setup and schema-version queries on the caller's context instead of `context.Background()`, and the Hive client checks the context before connecting to the metastore. The `catalog.Register` callbacks for both now pass their ctx through, so `catalog.Load` honours cancellation for these catalog types. The migration is `sql.NewCatalog(name, db, dialect, props)` to `sql.NewCatalog(ctx, name, db, dialect, props)` and `hive.NewCatalog(props, opts...)` to `hive.NewCatalog(ctx, props, opts...)`, noted in `releases.md`. `hive.NewCatalogWithClient` and `glue.NewCatalog` do no I/O and are unchanged. New tests build each catalog with an already-cancelled context, both directly and through `catalog.Load`, and expect `context.Canceled`; the SQL test covers `init_catalog_tables` on and off. `go build ./...`, `go vet ./...` and the sql, hive, catalog and cmd/iceberg tests pass. gohive's `ConnectToMetastore` takes no context, so for Hive the context is only checked before dialing and cannot interrupt a connect already in progress. Dialing with `DialContext` ourselves could be a follow-up. Part of #2062. AI-assisted, reviewed by a human. -- 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]
