Repository navigation
feat(table): Implement snapshot expiration - #401
Conversation
zeroshade
left a comment
There was a problem hiding this comment.
Looks good! other than a few comments, the only thing missing here is some tests. Can you add some tests please?
|
Hi @zeroshade Sure, I'll add tests.
If we decide to handle file removal as part of ExpireSnapshots, we would have to postpone the actual deletion after the commit is successful. I don't see any easy way to do it. |
|
@kevinjqliu @Fokko do either of you know the answers to @arnaudbriche's questions here you both have more experience with the spec side of things than I do as far as what makes sense for those situations. |
a4b4b36 to
ec8d33b
Compare
|
I just added a test and implemented snapshot-log pruning because it's growing unbounded otherwise. |
|
Regarding file deletion, maybe we can add a new method to the |
It's a good question. If we have the table, then we have the file system interface so that we can remove the files. It might make sense for us to simply have an option to tell it whether or not to delete the files (rather than allow generic post-commit code). |
the
From the ExpireSnapshots javadoc, it looks you can optionally remove the data and metadata files, but its set to true by default
Also from the java docs for When committing, these changes will be applied to the latest table metadata. Commit conflicts will be resolved by applying the changes to the new latest metadata and reattempting the commit. A new snapshot should be created reflecting the newest table update, i.e. old snapshots removed Hope this helps! Happy to help point to any other questions :) |
ec8d33b to
97a5820
Compare
Thx for all the answers @kevinjqliu. I have a hard time figuring out how a new snapshot could be created, I we technically don't write , update or delete any data from the table here. |
| b.schemaList = metadata.Schemas() | ||
| b.schemaList = slices.Clone(metadata.Schemas()) | ||
| b.currentSchemaID = metadata.CurrentSchema().ID | ||
| b.specs = metadata.PartitionSpecs() | ||
| b.specs = slices.Clone(metadata.PartitionSpecs()) | ||
| b.defaultSpecID = metadata.DefaultPartitionSpec() | ||
| b.lastPartitionID = metadata.LastPartitionSpecID() | ||
| b.props = metadata.Properties() | ||
| b.snapshotList = metadata.Snapshots() | ||
| b.sortOrderList = metadata.SortOrders() | ||
| b.props = maps.Clone(metadata.Properties()) | ||
| b.snapshotList = slices.Clone(metadata.Snapshots()) | ||
| b.sortOrderList = slices.Clone(metadata.SortOrders()) |
There was a problem hiding this comment.
I wonder if there's a way we could lazily do this cloning? Avoid performing the copies until we actually need to?
zeroshade
left a comment
There was a problem hiding this comment.
This is shaping up nicely! Just a few questions left.
|
@arnaudbriche any updates? |
b860a6a to
1766ac2
Compare
|
@zeroshade Sorry, I've been 100% focused on something else these past weeks. |
313d23e to
dfe4601
Compare
|
@arnaudbriche looks like one of the tests are failing: |
…e slice's underlying arrays with the old one
… would be automatically expired
dfe4601 to
e6af8ce
Compare
zeroshade
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks for this!
Hi @zeroshade,
As discussed on a previous PR, I'm trying to implement snapshots expiration now.
This is not complete, but I wanted to discuss it with you before I further work on it.
If the design looks ok to you, here are a few technical questions regarding snapshot expiration:
References