Skip to content

feat: delete orphaned files #1958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9dcb580
feat: delete orphaned files
jayceslesar Apr 29, 2025
e43505c
simpler and a test
jayceslesar Apr 29, 2025
eed5ea8
remove
jayceslesar Apr 29, 2025
8cca600
updates from review!
jayceslesar May 2, 2025
75b1240
include dry run and older than
jayceslesar May 2, 2025
6379480
add case for dry run
jayceslesar May 2, 2025
0c2822e
use .path so we get paths pack
jayceslesar May 3, 2025
aaf8fc2
actually pass in iterable
jayceslesar May 3, 2025
b09641b
capture manifest_list files
jayceslesar May 3, 2025
beec233
refactor into `all_known_files`
jayceslesar May 3, 2025
b888c56
fix type in docstring
jayceslesar May 3, 2025
ff461ed
mildly more readable
jayceslesar May 3, 2025
3b3b10e
beef up tests
jayceslesar May 3, 2025
a62c8cf
make `older_than` required
jayceslesar May 4, 2025
07cbf1b
move under `optimize` namespace
jayceslesar May 4, 2025
54e1e00
add some better logging about what was/was not deleted
jayceslesar May 4, 2025
7c780d3
Merge branch 'main' into feat/orphan-files
jayceslesar May 10, 2025
9b6c9ed
Merge branch 'main' into feat/orphan-files
jayceslesar May 13, 2025
34d10b9
rename optimize -> maintenance
jayceslesar May 17, 2025
0335957
make orphaned_files private
jayceslesar May 17, 2025
9f8145c
correctly coerce list
jayceslesar May 17, 2025
fbdcbd3
add metadata files
jayceslesar May 28, 2025
85b4ab3
Merge branch 'main' into feat/orphan-files
jayceslesar May 28, 2025
c414df8
Merge branch 'main' into feat/orphan-files
jayceslesar Jun 10, 2025
aa9d536
Merge branch 'main' into feat/orphan-files
jayceslesar Jun 21, 2025
b4c14fc
fix test
jayceslesar Jun 21, 2025
f4d98d2
allow older_than to be None
jayceslesar Jun 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
beef up tests
  • Loading branch information
jayceslesar committed May 3, 2025
commit 3b3b10e6c7f5c22f15e13b26274568b6eace75a9
8 changes: 8 additions & 0 deletions tests/table/test_delete_orphans.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ def test_delete_orphaned_files(catalog: Catalog) -> None:
# modify creation date to be older than 3 days
five_days_ago = (datetime.now() - timedelta(days=5)).timestamp()
os.utime(orphaned_file, (five_days_ago, five_days_ago))
tbl.delete_orphaned_files()
assert not orphaned_file.exists()

# assert that all known files still exist...
all_known_files = tbl.inspect.all_known_files()
for files in all_known_files.values():
for file in files:
assert Path(file).exists()


def test_delete_orphaned_files_with_invalid_file_doesnt_error(catalog: Catalog) -> None:
Expand Down