Repository navigation
Fix flaky test_e2e_catalogs[glue]: implement wait_for_table_ready - #108604
Conversation
AwsGlueCatalogManager.wait_for_table_ready and wait_for_table_gone were bare `pass` no-ops, while the sibling BigLake and OneLake managers implement them as bounded pyiceberg polling loops. The module-scoped fixtures (sales_table, customers_table, types_table, complex_table) and several tests call wait_for_table_ready(name) right after create_table expecting it to block until the table is catalog-visible. AWS Glue is eventually-consistent for GetTables listing (GlueCatalog::getTablesForDatabase issues a GetTables call per query with no server-side cache), so for the glue backend the no-op returned immediately and the first resolve_table_name / SHOW TABLES could race ahead of Glue's listing propagation. resolve_table_name retries for ~15s, which was not always enough, surfacing intermittently as: AssertionError: Table 'tbl_xxxxxxxx' not found in SHOW TABLES output: Implement both methods to poll self.catalog (pyiceberg glue) until the table is loadable AND listed (ready) or load_table raises (gone), bounded by a wall-clock deadline, mirroring the proven BigLakeCatalogManager / OneLakeCatalogManager pattern. Glue places each table in its own namespace, so _namespace_for resolves the namespace from _tables_created. Assertions and resolve_table_name's existing retry are unchanged.
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-0:20260626-120500 |
|
cc @fm4v — could you review? |
|
Workflow [PR], commit [fb1000f] Summary: ✅ AI ReviewSummaryThis PR implements real wait helpers for the AWS Glue Missing context / blind spots
Findings
Tests
Final VerdictStatus: Minimum required actions: wait for namespace visibility on create, wait for listing absence on delete, and verify with the private Glue e2e backend. |
| attempt += 1 | ||
| try: | ||
| self.catalog.load_table(identifier) | ||
| listed = self.catalog.list_tables(namespace) |
There was a problem hiding this comment.
The ready condition still does not prove the contract the fixtures rely on. SHOW TABLES for Glue calls GlueCatalog::getTables, which first enumerates databases with GetDatabases and only then calls GetTables for each database. Since this helper creates a fresh Glue namespace per table, load_table(identifier) plus list_tables(namespace) can succeed while the namespace itself is still absent from the database listing, and ClickHouse will skip it completely. Please include the namespace-listing condition, for example poll list_namespaces/GetDatabases until namespace is present, before returning ready.
| attempt += 1 | ||
| try: | ||
| self.catalog.load_table(identifier) | ||
| except Exception: |
There was a problem hiding this comment.
This returns as soon as direct load_table fails, but wait_for_table_gone is used immediately before SHOW TABLES assertions. SHOW TABLES is driven by Glue's listing path (GetDatabases -> GetTables), so a stale GetTables result can still list the dropped table even after direct GetTable/load_table has started failing. Please mirror the ready-side listing check and return only once the table is not loadable and list_tables(namespace) no longer contains it, or the namespace itself has disappeared.
The e2e-catalog BigLake helper's create_table performs the REST create_table + table.append with no retry of its own. pyiceberg's REST client only retries auth errors (stop_after_attempt(2), reraise), so a single transient BigLake blip (5xx ServerError, ServiceUnavailableError, CommitStateUnknownException, connection reset) propagates out and fails the module-scoped types_table fixture, taking test_primitive_types[biglake] and test_primitive_values[biglake] down together. Wrap create+append in a bounded wall-clock retry loop, mirroring the existing wait_for_table_ready and resolve_table_name patterns in the same file. Only the specific transient REST/network exceptions are retried; every other error still propagates immediately. Each attempt uses a fresh table name and best-effort drops a partially-created attempt, so a retry after a partial success can neither hit TableAlreadyExistsError nor duplicate appended rows: table creation stays exactly-once and no assertion is weakened. After the deadline the last transient error is re-raised. Create-path analogue of the glue listing-race fix (ClickHouse#108604). Co-Authored-By: Claude Opus 4.8 <[email protected]>
The e2e-catalog BigLake helper's create_table performs the REST create_table + table.append with no retry of its own. pyiceberg's REST client only retries auth errors (stop_after_attempt(2), reraise), so a single transient BigLake blip (5xx ServerError, ServiceUnavailableError, CommitStateUnknownException, connection reset) propagates out and fails the module-scoped types_table fixture, taking test_primitive_types[biglake] and test_primitive_values[biglake] down together. Wrap create+append in a bounded wall-clock retry loop, mirroring the existing wait_for_table_ready and resolve_table_name patterns in the same file. Only the specific transient REST/network exceptions are retried; every other error still propagates immediately. Each attempt uses a fresh table name and best-effort drops a partially-created attempt, so a retry after a partial success can neither hit TableAlreadyExistsError nor duplicate appended rows: table creation stays exactly-once and no assertion is weakened. After the deadline the last transient error is re-raised. Create-path analogue of the glue listing-race fix (ClickHouse#108604). Co-Authored-By: Claude Opus 4.8 <[email protected]>
…-test-e2e-catalogs-glue-wait-for-table-ready Fix flaky test_e2e_catalogs[glue]: implement wait_for_table_ready
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Fixes a flaky failure in
test_e2e_catalogson the AWS Glue backend that surfaces as:AwsGlueCatalogManager.wait_for_table_readyandwait_for_table_gonewere barepassno-ops, whereas the sibling
BigLakeCatalogManagerandOneLakeCatalogManagerimplementthem as bounded pyiceberg polling loops. The module-scoped fixtures (
sales_table,customers_table,types_table,complex_table) and several tests callwait_for_table_ready(name)right aftercreate_table, expecting it to block until thetable is catalog-visible.
AWS Glue is eventually-consistent for
GetTableslisting (GlueCatalog::getTablesForDatabaseissues a
GetTablescall per query with no server-side cache), so for the glue backend theno-op returned immediately and the first
resolve_table_name/SHOW TABLEScould raceahead of Glue's listing propagation.
resolve_table_nameretries for ~15s, which was notalways enough.
This implements both methods to poll
self.catalog(pyiceberg glue) until the table isloadable AND listed (ready) or
load_tableraises (gone), bounded by a wall-clock deadline,mirroring the proven
BigLakeCatalogManager/OneLakeCatalogManagerpattern. Glue placeseach table in its own namespace, so
_namespace_forresolves the namespace from_tables_created. Test assertions andresolve_table_name's existing retry backstop areunchanged.
Note: the
[glue]E2E job requires real AWS Glue credentials and does not run on the publicCI dashboard.
Version info
26.7.1.1026(included in26.7and later)