Repository navigation
fix: see tables other clients create or drop after the catalog is built - #166
Open
NoahKusaba wants to merge 2 commits into
Open
NoahKusaba wants to merge 2 commits into
NoahKusaba wants to merge 2 commits into
Conversation
`IcebergCatalogProvider` lists each namespace's tables once, when it is
built, and `table()` returned `None` for any name not in that list. A
long-lived session (a server, a notebook) never saw tables created by
other engines until it was rebuilt, and a table another client dropped
stayed listed and failed every lookup with `TableNotFound`, which also
broke `information_schema.columns` for the whole catalog.
The catalog, not the build-time list, now decides whether a table
exists:
- `table()` in a namespace built by listing the catalog also loads names
missing from the list. Every catalog-backed lookup, including fixed
sets (`with_fixed_tables`), returns `None` when the catalog reports
`TableNotFound` or `NamespaceNotFound`. Fixed sets keep their
membership otherwise.
- `register_table` no longer refuses names on the list. It refused to
recreate a table another client had dropped ("already exists"); the
catalog reports real duplicates itself.
- `deregister_table` loads the table from the catalog instead of checking
the list. `DROP TABLE` looks a table up with `table()` and then calls
`deregister_table`, ignoring its result, so dropping a table found only
through the catalog would have reported success and dropped nothing.
Both now reject names containing `$`, which `table()` reads as a metadata
table (`t$snapshots`). The list checks used to stop some of these by
accident; `CREATE TABLE "x$snapshots"` with no table `x` created a table
that could never be read.
The listing itself (`SHOW TABLES`, `information_schema.tables`) still
reflects the build plus DDL through this provider: `table_names` is
synchronous. Namespaces are still listed once.
The Hive Metastore catalog reports a missing table as `Unexpected`, so
there a dropped table still fails its lookup.
NoahKusaba
force-pushed
the
fix/lookup-tables-created-after-listing
branch
from
December 4, 2026 13:51
d8bbbe9 to
d8d8873
Compare
`register_table` and `deregister_table` now reject `$` names through one helper, `ensure_not_metadata_name`, with the same error. Comments and docs follow the new behaviour: the `tables` field doc no longer says the names were listed (fixed sets configure them) and says what still relies on it; the note on duplicate names sits at `create_table`; `catalog_builder`'s docs and `AGENTS.md` say that table lookups, `CREATE TABLE` and `DROP TABLE` ask the catalog while namespaces stay fixed (apache#165).
NoahKusaba
marked this pull request as ready for review
December 4, 2026 14:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Part of #24: the follow-up promised in this comment. Namespaces have the same problem but can't be fixed this way; that's #165. This PR is also what #165's fixes build on: a namespace found later has no listed tables, so its tables must be found through the catalog.
Rationale for this change
A catalog built with
IcebergCatalogProvider::catalog_builderlists each namespace's tables once, when it's built, andtable()returnedNonefor any name not in that list. In a long-lived session (a server, a notebook):TableNotFound.information_schema.columnscallstable()for every listed name, so one dropped table makes it fail for the whole catalog.register_tablechecked the same list.What changes are included in this PR?
The catalog, not the list taken at build time, now decides whether a table exists:
table(): in a namespace built by listing the catalog, a name that isn't listed is loaded from the catalog too. Every lookup through the catalog returnsNonewhen the catalog reportsTableNotFoundorNamespaceNotFound. Fixed sets (with_fixed_tables, static catalogs) keep their membership.register_tableno longer checks the list; the catalog reports real duplicates itself.deregister_tableloads the table from the catalog instead of checking the list. This is needed with thetable()change:DROP TABLElooks the table up withtable(), then callsderegister_tableand ignores its result, so a list check would have reported success for a table found only through the catalog, and dropped nothing.$, whichtable()reads as a metadata table (t$snapshots). The list checks used to stop some of these by accident. Onmain,CREATE TABLE c.ns."x$snapshots"with no tablexcreates a table that can never be read.The
catalog_builderdocs andAGENTS.mddescribe the new behaviour.Not changed:
table_names()(SHOW TABLES,information_schema.tables) is synchronous, so it still lists the tables found at build time plus DDL run through this provider.Unexpected, notTableNotFound, so there a dropped table still fails its lookup. REST, SQL, Glue, S3 Tables and the in-memory catalog reportTableNotFound.Are these changes tested?
Yes, in
tests/table_lookup.rs, through SQL with a second client of the same catalog:uses_a_table_another_client_created: read, insert,t$snapshots,CREATE TABLE(fails) andCREATE TABLE IF NOT EXISTS(no-op).drops_a_table_another_client_created: the table is really gone for the other client afterwards.forgets_a_table_another_client_dropped:information_schema.columnsstill works,SELECTandDROP TABLEreport "not found",DROP TABLE IF EXISTSsucceeds, and the table can be created again.forgets_a_namespace_another_client_dropped: lookups in it report "not found" instead ofNamespaceNotFound.refuses_to_create_a_table_named_like_a_metadata_table,refuses_to_drop_a_metadata_table.The first three, the namespace test and the
CREATEtest fail onmain. Each of the fix's parts is caught when reverted on its own: not looking up unlisted names,deregister_tablechecking the list, not mappingNamespaceNotFound, and the$check on drop.Are there any user-facing changes?
Yes, behaviour only, with no API changes:
CREATE TABLEandDROP TABLEreject names containing$.