-
Notifications
You must be signed in to change notification settings - Fork 227
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
Implement write.metadata.delete-after-commit.enabled
to clean up old metadata files
#1607
Changes from 12 commits
0985972
d244ffd
4807040
352b972
a375e1c
1f631c2
7e4c4b3
d1ed69c
f440ac1
4b36bfc
f7b7c03
d30bbaf
01fb388
462f3d4
45516dc
e8277c8
ed7a705
ec3de23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -219,6 +219,9 @@ class TableProperties: | |||||||||||||||||||||||||||||||||||
METADATA_PREVIOUS_VERSIONS_MAX = "write.metadata.previous-versions-max" | ||||||||||||||||||||||||||||||||||||
METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT = 100 | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
METADATA_DELETE_AFTER_COMMIT_ENABLED = "write.metadata.delete-after-commit.enabled" | ||||||||||||||||||||||||||||||||||||
METADATA_DELETE_AFTER_COMMIT_ENABLED_DEFAULT = False | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
MAX_SNAPSHOT_AGE_MS = "history.expire.max-snapshot-age-ms" | ||||||||||||||||||||||||||||||||||||
MAX_SNAPSHOT_AGE_MS_DEFAULT = 5 * 24 * 60 * 60 * 1000 # 5 days | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
@@ -1179,6 +1182,11 @@ def refs(self) -> Dict[str, SnapshotRef]: | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
def _do_commit(self, updates: Tuple[TableUpdate, ...], requirements: Tuple[TableRequirement, ...]) -> None: | ||||||||||||||||||||||||||||||||||||
response = self.catalog.commit_table(self, requirements, updates) | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
# https://github.com/apache/iceberg/blob/f6faa58/core/src/main/java/org/apache/iceberg/CatalogUtil.java#L527 | ||||||||||||||||||||||||||||||||||||
# delete old metadata if METADATA_DELETE_AFTER_COMMIT_ENABLED is set to true | ||||||||||||||||||||||||||||||||||||
self.catalog._delete_old_metadata(self.io, self.metadata, response.metadata) | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add a comment here explaining how
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also maybe we want to wrap this in try/catch and throw a warning as to not block the commit process There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added a try-catch, but the iceberg-python/pyiceberg/catalog/__init__.py Lines 254 to 269 in dd175aa
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
self.metadata = response.metadata | ||||||||||||||||||||||||||||||||||||
self.metadata_location = response.metadata_location | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
https://iceberg.apache.org/docs/1.6.0/maintenance/#remove-old-metadata-files