Skip to content

Core: Implement unregister table in catalogs and RCKs - #18203

Open
mkroll-db wants to merge 8 commits into
apache:mainfrom
mkroll-db:unregister-table
Open

mkroll-db wants to merge 8 commits into
apache:mainfrom
mkroll-db:unregister-table

Conversation

@mkroll-db

@mkroll-db mkroll-db commented Sep 22, 2026

Copy link
Copy Markdown

Adds catalog-level unregisterTable support introduced in #16400 in the REST catalog fixture and compatibility kit.

Unregister removes a table from the catalog without deleting its data or metadata files.
It returns a read-only table containing the last registered metadata. This can be used to register the table (with another catalog) again.

Disclaimer
Parts of the code were generated with AI.
This is a reopen of #16584 from @rambleraptor

@mkroll-db
mkroll-db marked this pull request as ready for review September 22, 2026 16:55
Comment thread core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java Outdated
mutationHeaders,
ErrorHandlers.tableErrorHandler());
StaticTableOperations ops = new StaticTableOperations(response.metadata(), io);
return new BaseTable(ops, fullTableName(identifier));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to include the fullTableName. This should be the name component of the table without the namespace. At this point the table is unregistered, so it does not live in a namespace.

Comment thread api/src/main/java/org/apache/iceberg/Table.java Outdated
Comment thread core/src/main/java/org/apache/iceberg/BaseTable.java Outdated
Comment thread core/src/main/java/org/apache/iceberg/SerializableTable.java Outdated
@rambleraptor

Copy link
Copy Markdown
Contributor

Thanks for getting this going again @mkroll-db! This fell off my radar.

}

@Test
public void testUnregisterRetriesAfterConcurrentCommit() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two tests don't make sense to me. We should just be testing the unregister functionality in isolation. I don't think concurrent commit is any different from just validating that the table no longer exists (loading the table doesn't start any sort of transaction, so this is more performative than practical)


assertThatThrownBy(() -> unregisteringCatalog.unregisterTable(tableIdentifier))
.isInstanceOf(CommitFailedException.class)
.hasMessage("Cannot unregister table db.table: metadata location changed concurrently");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's currently no way to determine that the metadata location changed, so this test doesn't make sense.

String.format(
"{\n"
+ " \"metadata-location\" : \"metadata-location\",\n"
+ " \"metadata\" : {\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel like we need all of the table metadata hard coded like this. We're round tripping the request/response object parser, not the table metadata parser. We should be able to reuse the table metadata parser and simply this a lot.

@mkroll-db

mkroll-db commented Sep 22, 2026

Copy link
Copy Markdown
Author

@rambleraptor I'm fine in closing the current PR and reviving yours. I just wanted to ensure that we continue working on it. It fell off my radar first so.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants