Skip to content

[python] Fix cascade drop ignoring tables found during recheck - #10425

Merged
JingsongLi merged 5 commits into
apache:masterfrom
XiaoHongbo-Hope:codex/catalog-drop-database-safety
Oct 8, 2026
Merged

JingsongLi merged 5 commits into
apache:masterfrom
XiaoHongbo-Hope:codex/catalog-drop-database-safety

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

During newer-PyArrow compatibility work in #9821, we found a pre-existing Catalog bug: drop_database(cascade=True) lists tables again after deleting the initially listed tables, but ignores a nonempty result and recursively deletes the database directory. A newly created table already visible in that second listing is therefore deleted too.

Raise an error when the second listing finds remaining tables, preserving those tables for inspection or an explicit retry. This fix is independent of the PyArrow upgrade.

Scope: this protects tables observed by the second listing. It does not make database drop atomic or address tables created after that listing. FileIO deletion behavior is unchanged.

Validation

A real local Catalog regression creates a new table after deletion of the original table, verifies the new table remains loadable after the error, and verifies an explicit retry succeeds. This regression fails on the unmodified base.

Catalog/FileIO tests: 49 passed (PyArrow 19.0.1). Flake8 and git diff --check pass. Remote object stores were not tested.

@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Avoid recursive database cleanup after dropping tables [python] Fix unintended table deletion during database drop Oct 8, 2026
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Fix unintended table deletion during database drop [python] Fix cascade drop ignoring tables found during recheck Oct 8, 2026
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review October 8, 2026 10:06

@JingsongLi JingsongLi left a comment

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.

+1

@JingsongLi
JingsongLi merged commit f38de63 into apache:master Oct 8, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants