[Server] Force delete of a schema or catalog leaves its uncommitted staging tables behind

未关闭
#2,358 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java, sql
领域
backend, databases

调研方向

Start with SchemaRepository.deleteSchema, which has no step for StagingTableDAO, and compare it with the force-delete steps for tables and volumes. Then read the overlap check and STORAGE_USER_TYPES in ExternalLocationUtils to see which orphaned-row logic can be dropped. Done means a force delete of a catalog or schema removes its uncommitted uc_staging_tables rows, and a test confirms the row is gone.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

Deleting a schema or catalog with force=true removes its tables, volumes, functions and models, but not its uncommitted staging tables. SchemaRepository.deleteSchema has no step for StagingTableDAO, and no other code path deletes those rows, so a staging table that is never committed stays in the database for good. The Delta API also has no call to delete a staging table.

ExternalLocationUtils already works around this. The overlap check for a new path still looks at uncommitted staging tables to cover "orphaned uncommited staging tables remaining after the catalog/schema is gone", and STORAGE_USER_TYPES leaves them out because "orphaned staging rows are never removed and would keep the location in use forever".

To Reproduce

  1. Create a catalog with a local storage_root and a schema in it.
  2. Create a staging table with the Delta API (POST /v1/catalogs/{catalog}/schemas/{schema}/staging-tables) and do not commit it.
  3. Delete the catalog with force=true.
  4. The uc_staging_tables row for that staging table is still there. Its staging_location is still counted by the overlap check in ExternalLocationUtils.

Expected behavior

A force delete of a schema or catalog also removes its uncommitted staging tables, or there is some other way to clean them up, so the overlap check no longer needs to cover orphaned rows.

Additional context

Found while writing a test for #2342, which leaves one staging table behind in a catalog with a random name after cleanup.

主要语言
Java
星标
3.6k
派生
706
平均合并
3 天 5 小时
30 天内合并 PR
135

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

unitycatalog/unitycatalog 的其他 Issue

查看 unitycatalog/unitycatalog 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。